Loaction of glClearColor() and glGetString()

Started by deebee396, March 24, 2012, 18:20:14

Previous topic - Next topic

deebee396

Hi,
   I've been trying to learn the basics of OpenGL by following http://openglbook.com , but it uses methods like glClearColor() and glGetString() which aren't in the GL40 class. I've noticed that they are in GL11 though, why aren't they in GL40, and can I use methods from GL11 and GL40 together?
Thanks in advance,  :)

matheus23

heh :D
There is no Method twice.
As you might have noticed the GL[number] classes are GL-Function classes where [number] is kind of the version of the OpenGL functions.
Only new Functions will be added in newer versions, so there will be no glVertex or glClearColor in GL40, only in GL11.
SHORT: Use The Functions where they are, so use GL11.
LONG: The Classes are divided, and there is no General GL Class, because you might want to do version checking. Some Graphics cards can't support GL40 functions (Make sure your graphics card supports these functions, before using GL40). For example my Graphics card (A nVidia GeForce 7600 GS) supports up to GL version 2.1, so I am able to use all GL-Classes up to GL21. My Graphics card is a bit crappy... But that off-topic :D
Also, if you want to get the current GL version, just use GL11.glGetString(GL11.GL_VERSION);
You wont get any problems with not supporting that functions, because GL11 is always supported :)

Hope I covered everything, that needs to be said, feel free to ask :)
My github account and currently active project: https://github.com/matheus23/UniverseEngine

deebee396

Thanks, that make sense, is there anywhere I can go to check the version that a method was introduced? I've had a look but cant seem to find any. Is the best way just to 'import static' every version?

matheus23

yep, just Import static all the GL versions you want. (thats how I do it, although I only use up to GL version 2.1 an that version is supported from almost every graphics card nowadays)
My github account and currently active project: https://github.com/matheus23/UniverseEngine