Thanks to the LWJGL (LightWeight Java Game Library), I have access to plenty of static OpenGL classes. However, one think I don't understand is why should I use a specific version. In the LWJGL 3 wiki, they say:
The static classes GL11, GL12, GL13, GL20, GL21, GL22,... can be used the access functions of a certain GL Version where GL11 would correspond to OpenGL 1.1, and GL20 would correspond to OpenGL 2.0
I understand that each class is a different version of OpenGL, but I often see many tutorials that depending on what they're doing will use a different class, switching between GL11, GL13 etc. in the same function. Wouldn't it be safer to use the same class everywhere for consistency sake? And why stay with GL11, when GL41 is available? Couldn't it be faster, since it's a more recent version?
The LWJGL wiki appears to be out of date. It states that:
Note, only functions which were added in a specific OpenGL version are in a GLXX class (eg. functions in OpenGL 1.2 which were in OpenGL 1.1 are in GL11, not GL12)
Emphasis added. This was true for LWJGL 2.x. This would mean that you have to access a 1.1 function through GL11
, even though as far as the OpenGL specification is for, that function would be available through version 4.6.
It's still technically true in LWJGL 3.x, in that each GLXX
class only defines the functions added to that specific version. However, in LWJGL 3.x, all of the versioned classes inherit from the previous version. So while the 1.1 functions are still defined in the GL11
class, they are accessible from any higher version.