Force to gles2 (OpenGL ES 2.0)
Hi All
I'm making an app that should be used with OpenGL ES 2.0. I have taken an example gles2 but modifying it has automatically changed to gles3. I need it to be gles2.
How do I force it to compile gles2? I use Qt5.7 but originally example is Qt4.8.
Code:
std::string glVersion = reinterpret_cast<const char*>(glGetString(GL_VERSION));
std::string glslVer = reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
qDebug("glVer: %s\nglslVer: %s", glVersion.c_str(), glslVer.c_str());
Quote:
glVer: OpenGL ES 3.0 Mesa 12.0.6
glslVer: OpenGL ES GLSL ES 3.00
Thank you.
Re: Force to gles2 (OpenGL ES 2.0)
I tested hellogl_es2 example and works! But my app use same include and not works.
Added after 10 minutes:
We start from an example of Qt (hellogl_es2) and we added texture to the ground, some billboard icons that rotate and updated the app to Qt5.7. While I only use gles2 functions in a qDebug I see that Qt5.7 is compiling for gles3.
std::string glVersion = reinterpret_cast<const char*>(glGetString(GL_VERSION));
std::string glslVer = reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
qDebug("glVer: %s\nglslVer: %s", glVersion.c_str(), glslVer.c_str());
glVer: OpenGL ES 3.0 Mesa 12.0.6
glslVer: OpenGL ES GLSL ES 3.00
hellogl_es2 qt example works fine on both but in my app only black box is seen with nothing.}
GPU supports Open GL ES 3.1
Yocto distribution has partial support for GL ES 3.0
but Qt toolchain for crosscopile supports only GL ES 2.0
How do I force Qt to compile on gles2?
I've tried code like the following and it returns "2.0" but compiles to gles3.
QSurfaceFormat format;
format.setVersion(2,0);
int majorVersion = format.majorVersion();
int minorVersion = format.minorVersion();
qDebug("Major Version %d", majorVersion);
qDebug("Minor Version %d", minorVersion);
I appreciate who can help me.
Greetings.
Re: Force to gles2 (OpenGL ES 2.0)
OpenGLES 3.0 is backward compatible with OpenGLES 2.0 so if you only use 2.0 code in your shaders, it should be working. Are you sure the problem is not elsewhere?