QOpenGLFunctions seems to be missing important functions such as glInvalidateFramebuffer and glMapBuffer. From what I understand QOpenGLFunctions loads the intersection of both desktop OpenGL functions and ES functions. If that's the case, why aren't these two functions present? From what I can tell glMapBuffer is in both.
Am I misunderstanding QOpenGLFunctions, or are they actually missing functions(unlikely)?
QOpenGLFunctions
just exposes the common subset of OpenGL 2 (+FBO) and OpenGL ES 2. That's why your functions are not there. glMapBuffer
is in OpenGL 2 but not in ES 2 (but there's an OES extension); glInvalidateFramebuffer
is in OpenGL 4.3.
If you need any other function apart from those of the common subset you can:
Starting with Qt 5.6, use QOpenGLExtraFunctions
, which aims at the OpenGL ES 3.0 / 3.1 API (and the rough equivalent functionality on desktop OpenGL). As such, it does have both glMapBuffer
and glInvalidateFramebuffer
.
resolve it yourself via QOpenGLContext::getProcAddress
use QOpenGLContext::versionFunctions<T>()
to get a function object containing all the functions for a given OpenGL version, for instance
auto functions = context->versionFunctions<QOpenGLFunctions_4_3_Core>();
if (!functions) error();
functions->initializeOpenGLFunctions();
functions->glInvalidateFramebuffer(...);
#include <QOpenGLExtensions>
and use the class(es) wrapping the extensions you need, for instance
auto functions = new QOpenGLExtension_ARB_invalidate_subdata;
if (!functions->initializeOpenGLFunctions()) error();
functions->glInvalidateFramebuffer(...)
wrap a combination of the above in a class that will use the resolved calls given a suitable GL version, or fall back to extensions, or fail (e.g.: QOpenGLTexture).
For glMapBuffer
, it is actually exposed somehow wrapped by QOpenGLBuffer
.
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