Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What OpenGL version to use in LWJGL?

Tags:

opengl

lwjgl

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?

like image 331
Oscar Sjöstedt Avatar asked Oct 26 '19 14:10

Oscar Sjöstedt


People also ask

Is LWJGL good for game development?

The only thing lower than using OpenGL/LWJGL is writing your own software renderer and that is not (usually) part of making a game. If you want to make a game I don't think even LWJGL is even a good choice for you, you should probably find a 2D framework for Java and use that.

Does LWJGL use GLFW?

GLFW is the preferred windowing system for LWJGL 3 applications.

Is LWJGL a game engine?

Frameworks & Game Engines using LWJGLjMonkeyEngine is a 3D game engine for adventurous Java developers. It's open-source, cross-platform, and cutting-edge. The engine is used by several commercial game studios and computer-science courses.


1 Answers

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.

like image 154
Nicol Bolas Avatar answered Oct 05 '22 20:10

Nicol Bolas