Search code examples
javaopengllibgdxlwjgl

LibGDX with openGL 2.0


Is there any possibility to use libGDX (version does not matter) without OpenGL SE? I would like to target Desktop PC only and work with OpenGL 2.0. (Or higher, if possible) LibGDX does support OpenGL 2.0 till 4.5, but it only offers to use lwjgl calls to do so. I would like to use the whole libGdx without any custom lwjgl calls for OpenGL 2.0


Solution

  • It is very unclear what you exactly want to do. But to answer your question: you don't have to do anything. LibGDX already uses OpenGL on desktop. Only on Android and iOS it uses OpenGL ES and for HTML it uses WebGL.

    Ofcourse, because libgdx is targeting all those platforms, its classes are implemented using only the functionality available in both OpenGL and OpenGL ES. If you only want to target desktop then you can access the OpenGL methods directly in your desktop project. You don't need a core project or any other project than desktop in that case. How you can access those depends on the backend you are using (lwjgl, lwjgl3 or jglfw), consult the manual of those frameworks for more information about that. For example, you could directly call org.lwjgl.opengl.GL12.glTexSubImage3D or any other opengl method you need like that.

    The config of your launcher defines which version of OpenGL is used. If you want to specify that, then you need to set config.useGL30 to true and can then specify the exact version using config.gles30ContextMajorVersion and config.gles30ContextMinorVersion. Which defaults to version 3.2. If you don't set useGL30 to true then no specific context will be requested, which means that the driver will be more forgiving and is comparable with (not equal to) around OpenGL ES 2.