In configuration of libgdx, there is a useGL30 boolean. As I've never worked with OpenGL I'm not sure what that method does. And btw. should i set it to false or true? Which is better for my game?
The other answer is very extensive but unfortunately not correct at some parts. First to answer your questions:
You want to set the config.useGL30
member to false
, regardless the platform (desktop or android).
You should not set the config.useGL30 member to true
, unless you have an actual need to use OpenGL ES 3.0 functionality. In which case (if you need to use GLES3 functionality) you will need to take care of compatibility, even at places where you don't need that functionality.
Simply setting config.useGL30
to true
will not be better for your game. In fact, it might introduce issues.
To clarify a few things:
OpenGL
and OpenGL ES
are two different things, the versions can not be compared. If you really want to compare the versions, then OpenGL ES 2.0 can be compared with (is a subset of) OpenGL 4.3 and OpenGL ES 3.0 can be compared with (is a subset of) OpenGL 4.5.
In that respect the naming useGL30
, Gdx.gl20
, Gdx.gl30
can be considered misleading, because the 20
and 30
in that naming is actually referring to the OpenGLES version and not the OpenGL version. A better naming would be perhaps useGLES30
, Gdx.gles20
and Gdx.gles30
.
OpenGL ES 3.0 is not fully backwards compatible with OpenGL ES 2.0, which is also true for desktop (on which OpenGL ES is emulated through OpenGL). Even though the API itself is compatible, this isn't the case for the shader language used. So, if you set config.useGL30
to true
then chances are quite big that your shaders won't work anymore as you'd expect. This includes the shaders that come with libgdx (SpriteBatch, ShapeRenderer, ModelBatch, etc).
So, it doesn't make sense to set the useGL30
member only to true for your desktop project, especially if you aren't making other adjustments to your code as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With