Re: JOGL 2.0 (OpenGL/OpenGL-ES) backend for LibGDX
Posted by
Xerxes Rånby on
Jun 10, 2015; 1:33pm
URL: https://forum.jogamp.org/JOGL-2-0-OpenGL-OpenGL-ES-backend-for-LibGDX-tp4027689p4034639.html
Xerxes Rånby wrote
Peter wrote
The is also a lot of erros when i try to run project at Eclipse:
...
Caused by: java.lang.IllegalArgumentException: Error compiling shader: ERROR: 0:1: '' : #version required and missing.
ERROR: 0:1: 'attribute' : syntax error: syntax error
ERROR: 0:1: '' : #version required and missing.
ERROR: 0:7: 'varying' : syntax error: syntax error
at com.badlogic.gdx.graphics.g2d.SpriteBatch.createDefaultShader(SpriteBatch.java:157)
at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:120)
...
Like Gouessej said, this is caused by your new OpenGL driver.
This is caused by changes in the OpenGL GLSL standard between different OpenGL versions.
We have a tutorial in the jogamp wiki how to write cross GLProfile compatible GLSL shaders:
http://jogamp.org/wiki/index.php/How_to_write_cross_GLProfile_compatible_shader_using_JOGLThe default GLSL shader used by gdx SpriteBatch needs to be updated to work with non backward compatible OpenGL 3 and 4 profiles.
A workaround for this bug is to explicitly request an "old" GLProfile such as GLES2 and if that is not found try with GL2. This can be done by reverting the following block inside
backends/gdx-backend-jogamp/src/com/badlogic/gdx/backends/jogamp/JoglGraphicsBase.java
https://github.com/gouessej/libgdx/commit/b44dfbb89175e549ae5d31fa32cdd6fcd6232fd9#diff-edd3ab0e3f9dee326e91e15898bf85f6R48Maybe we should only try to use GLProfile.getMaxProgrammable(true) if the user explicitly request GL30 ?
Hence use the old logic to try GLES2 and GL2 for GL20.