Re: unusable profile selected with GL2ES2 capabilities - a bug or a ..feature?
Posted by
Xerxes Rånby on
Aug 30, 2013; 12:45pm
URL: https://forum.jogamp.org/unusable-profile-selected-with-GL2ES2-capabilities-a-bug-or-a-feature-tp4029916p4029917.html
eimaiosatanas wrote
Hi,
I'm developing an OpenGL ES2.0 application with jogl, primarily on desktop platforms with possible android platform expansion in the future.
With relatively newer GPUs when I try to get a profile by specifying GL2ES2 as capability, the GL4bc profile is selected. On Mac OS X / Intel graphics as well as Linux / AMD graphics, this profile would fail to compile the ES shaders with:
a) complaining about a missing #version directive, regarding which AFAIK it is not necessary and
b) complaining about GL3 forward compatible context.
Please have a look at the sample output regarding the error.
The simplest solution is to ask for a GL3bc or even a GL2 profile, which actually compiles the shaders and performs perfectly.
Why is the GL4bc profile returned as a viable profile when specifying GL2ES2 as capability when this is clearly not the case?
Looking forward to any explanation.
Regards
-----sample output of the error on linux / AMD graphics platform -------------
Chosen GLCapabilities: GLCaps[glx vid 0xc8, fbc 0xc8: rgba 8/8/8/8, trans-rgba 0xff/ff/ff/ff, accum-rgba 0/0/0/0, dp/st/ms 24/0/0, dbl, mono , hw, GLProfile[GL2ES2/GL4.hw], on-scr[.]]
INIT GL IS: jogamp.opengl.gl4.GL4bcImpl
GL_VENDOR: ATI Technologies Inc.
GL_RENDERER: AMD Radeon HD 7700 Series
GL_VERSION: 4.2.12217 Core Profile Context 12.104
Error compiling the vertex shader: Vertex shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors. No code generated
If you look close enough GLProfile[GL2ES2/GL4.hw] context is selected, that is GL4 without backward compatibility.
We are discussing this inside the following bug:
https://jogamp.org/bugzilla/show_bug.cgi?id=821According to the JogAmp JOGL spec the current JOGL implementation is correct:
"GL2ES2 The intersection of the desktop
GL3, GL2 and embedded ES2 profile"
https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/javax/media/opengl/GL2ES2.htmlIts the intersection of GL3 (core) that makes GL2ES2 return a non backward compatible context and require you to use VBO for best compatibility on both desktop and mobile devices.
You can add a header to your vertex shader in order to make it compile on more drivers:
#if __VERSION__ >= 130
#define attribute in
#define varying out
#endif
#ifdef GL_ES
precision mediump float;
precision mediump sampler2D;
precision mediump int;
#endif
and similar for the fragment shader:
#if __VERSION__ >= 130
#define varying in
out vec4 mgl_FragColor;
#define texture2D texture
#else
#define mgl_FragColor gl_FragColor
#endif
#ifdef GL_ES
precision mediump float;
precision mediump sampler2D;
precision mediump int;
#endif