![]() |
Qt 6.x
The Qt SDK
|
The QPlatformOpenGLContext class provides an abstraction for native GL contexts. More...
#include <qplatformopenglcontext.h>
Public Member Functions | |
QPlatformOpenGLContext () | |
virtual | ~QPlatformOpenGLContext () |
virtual void | initialize () |
Called after a new instance is constructed. | |
virtual QSurfaceFormat | format () const =0 |
virtual void | swapBuffers (QPlatformSurface *surface)=0 |
Reimplement in subclass to native swap buffers calls. | |
virtual GLuint | defaultFramebufferObject (QPlatformSurface *surface) const |
Reimplement in subclass if your platform uses framebuffer objects for surfaces. | |
virtual bool | makeCurrent (QPlatformSurface *surface)=0 |
virtual void | doneCurrent ()=0 |
virtual void | beginFrame () |
Called when the RHI begins rendering a new frame in the context. | |
virtual void | endFrame () |
Called when the RHI ends rendering a in the context. | |
virtual bool | isSharing () const |
virtual bool | isValid () const |
virtual QFunctionPointer | getProcAddress (const char *procName)=0 |
Reimplement in subclass to allow dynamic querying of OpenGL symbols. | |
QOpenGLContext * | context () const |
Static Public Member Functions | |
static bool | parseOpenGLVersion (const QByteArray &versionString, int &major, int &minor) |
Friends | |
class | QOpenGLContext |
class | QOpenGLContextPrivate |
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
\preliminary
In QPA the way to support OpenGL or OpenVG or other technologies that requires a native GL context is through the QPlatformOpenGLContext wrapper.
There is no factory function for QPlatformOpenGLContexts, but rather only one accessor function. The only place to retrieve a QPlatformOpenGLContext from is through a QPlatformWindow.
The context which is current for a specific thread can be collected by the currentContext() function. This is how QPlatformOpenGLContext also makes it possible to use the Qt GUI module withhout using QOpenGLWidget. When using QOpenGLContext::currentContext(), it will ask QPlatformOpenGLContext for the currentContext. Then a corresponding QOpenGLContext will be returned, which maps to the QPlatformOpenGLContext.
Definition at line 33 of file qplatformopenglcontext.h.
QPlatformOpenGLContext::QPlatformOpenGLContext | ( | ) |
Definition at line 53 of file qplatformopenglcontext.cpp.
|
virtual |
Definition at line 58 of file qplatformopenglcontext.cpp.
|
virtual |
Called when the RHI begins rendering a new frame in the context.
Will always be paired with a call to \l endFrame().
Reimplemented in QtWaylandClient::QWaylandGLContext.
Definition at line 136 of file qplatformopenglcontext.cpp.
QOpenGLContext * QPlatformOpenGLContext::context | ( | ) | const |
Definition at line 82 of file qplatformopenglcontext.cpp.
References d.
Referenced by QtWaylandClient::DecorationsBlitter::DecorationsBlitter(), QGLXContext::QGLXContext(), QWindowsGLContext::QWindowsGLContext(), QtWaylandClient::DecorationsBlitter::blit(), QCocoaGLContext::initialize(), QWindowsGLContext::isSharing(), QWasmOpenGLContext::makeCurrent(), QtWaylandClient::QWaylandGLContext::makeCurrent(), and QGLXContext::queryDummyContext().
|
virtual |
Reimplement in subclass if your platform uses framebuffer objects for surfaces.
The default implementation returns 0.
Reimplemented in QIOSContext, QWasmOpenGLContext, and QtWaylandClient::QWaylandGLContext.
Definition at line 77 of file qplatformopenglcontext.cpp.
Referenced by QWasmOpenGLContext::defaultFramebufferObject().
|
pure virtual |
|
virtual |
Called when the RHI ends rendering a in the context.
Is always preceded by a call to \l beginFrame().
Reimplemented in QtWaylandClient::QWaylandGLContext.
Definition at line 144 of file qplatformopenglcontext.cpp.
|
pure virtual |
Implemented in QEGLPlatformContext, QCocoaGLContext, QIOSContext, QWasmOpenGLContext, QWindowsGLContext, QGLXContext, and QtWaylandClient::QWaylandBrcmGLContext.
Referenced by QGLXContext::QGLXContext().
|
pure virtual |
Reimplement in subclass to allow dynamic querying of OpenGL symbols.
As opposed to e.g. the wglGetProcAddress function on Windows, Qt expects this methods to be able to return valid function pointers even for standard OpenGL symbols.
Implemented in QEGLPlatformContext, QCocoaGLContext, QIOSContext, QWasmOpenGLContext, QWindowsGLContext, QGLXContext, QtWaylandClient::QWaylandBrcmGLContext, and QtWaylandClient::QWaylandGLContext.
|
virtual |
Called after a new instance is constructed.
The default implementation does nothing.
Subclasses can use this function to perform additional initialization that relies on virtual functions.
Reimplemented in QEGLPlatformContext, and QCocoaGLContext.
Definition at line 68 of file qplatformopenglcontext.cpp.
Referenced by QOpenGLContextPrivate::adopt().
|
inlinevirtual |
Reimplemented in QEGLPlatformContext, QCocoaGLContext, QIOSContext, QWasmOpenGLContext, QWindowsGLContext, and QGLXContext.
Definition at line 54 of file qplatformopenglcontext.h.
Referenced by QOpenGLContextPrivate::adopt().
|
inlinevirtual |
Reimplemented in QEGLPlatformContext, QCocoaGLContext, QIOSContext, QWasmOpenGLContext, QWindowsGLContext, and QGLXContext.
Definition at line 55 of file qplatformopenglcontext.h.
|
pure virtual |
|
static |
Definition at line 94 of file qplatformopenglcontext.cpp.
References QList< T >::at(), QByteArrayLiteral, qWarning, QList< T >::size(), QByteArray::split(), and QByteArray::startsWith().
Referenced by QIOSContext::QIOSContext(), QWindowsOpenGLContextFormat::current(), and updateFormatFromContext().
|
pure virtual |
Reimplement in subclass to native swap buffers calls.
The implementation must support being called in a thread different than the gui-thread.
Implemented in QEGLPlatformContext, QAndroidPlatformOpenGLContext, QCocoaGLContext, QEglFSContext, QIOSContext, QQnxGLContext, QWasmOpenGLContext, QWindowsGLContext, QXcbEglContext, QGLXContext, QtWaylandClient::QWaylandBrcmGLContext, and QtWaylandClient::QWaylandGLContext.
|
friend |
Definition at line 64 of file qplatformopenglcontext.h.
Referenced by QEGLPlatformContext::createFrom().
|
friend |
Definition at line 65 of file qplatformopenglcontext.h.