Solved GL_PRIMITIVE_RESTART_FIXED_INDEX not works on Android's OpenGL ES
-
Hi, I want to render multiple objects based on Qt 5.12/Qml/OpenGL ES 3.1+ via GL_TRIANGLE_STRIP and splitted by 'Primitive Restart'. I tested it on Win10 and everything works fine. The problem now is that
m_func->glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
is only accepted from usual OpenGL. The reason is that Qt's glEnable() supports only OpenGL ES 2.0 and GL_PRIMITIVE_RESTART_FIXED_INDEX is only up from OpenGL ES 3.x.
So does maybe someone know how to
- use consequently in Qt OpenGL ES 3.x and not extraFunctions()?
- use 'Primitive Restart' with Qt?
Thanks in advance...
-
Hi,
Please take a look at the OpenGL ES 3 example to see how to enable a different version of OpenGL.
-
@SGaist Thxs, but as I mentioned in point 1. I already use
m_func = QOpenGLContext::currentContext()->extraFunctions();
The problem is that GL_PRIMITIVE_RESTART_FIXED_INDEX is unknown using with
m_func->glEnable(...);
for OpenGL ES. glEnable() is from QOpenGLFunctions and QOpenGLExtraFunctions is only inherited from it.
-
I am not sure I am following you as QOpenGLExtraFunctions already support OpenGL ES 3.
-
@SGaist Yes QOpenGLExtraFunctions supports OpenGL ES 3, but the function glEnable() contains to QOpenGLFunctions and this supports only OpenGL ES 2.
"The QOpenGLFunctions class provides cross-platform access to the OpenGL ES 2.0 API"
And GL_PRIMITIVE_RESTART_FIXED_INDEX was only introduced with OpenGL ES 3.x.
So my question is how can I use in Qt with OpenGL ES GL_PRIMITIVE_RESTART_FIXED_INDEX to render multiple objects using only one draw command glDrawElements()?
-
@PowerNow said in GL_PRIMITIVE_RESTART_FIXED_INDEX not works on Android's OpenGL ES:
GL_PRIMITIVE_RESTART_FIXED_INDEX
While the primitive name itself seems to not be defined, what you can do is:
#ifndef GL_PRIMITIVE_RESTART_FIXED_INDEX #define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 #endif
Note that this is taken from within Qt's source code.
Does that work ?
-
@SGaist Yeah, this works, thxs! But also if GL_PRIMITIVE_RESTART_FIXED_INDEX is defined how can it work with glEnable() from QOpenGLFunctions? Should be there not an overwritten member function glEnable() of QOpenGLExtraFunctions?
-
Because you requested the adequate context version.