Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QPlatformOpenGLContext Class Referenceabstract

The QPlatformOpenGLContext class provides an abstraction for native GL contexts. More...

#include <qplatformopenglcontext.h>

Inheritance diagram for QPlatformOpenGLContext:
Collaboration diagram for QPlatformOpenGLContext:

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.
QOpenGLContextcontext () const

Static Public Member Functions

static bool parseOpenGLVersion (const QByteArray &versionString, int &major, int &minor)

Friends

class QOpenGLContext
class QOpenGLContextPrivate

Detailed Description

The QPlatformOpenGLContext class provides an abstraction for native GL contexts.

Since
4.8

\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.

Constructor & Destructor Documentation

◆ QPlatformOpenGLContext()

QPlatformOpenGLContext::QPlatformOpenGLContext ( )

Definition at line 53 of file qplatformopenglcontext.cpp.

◆ ~QPlatformOpenGLContext()

QPlatformOpenGLContext::~QPlatformOpenGLContext ( )
virtual

Definition at line 58 of file qplatformopenglcontext.cpp.

Member Function Documentation

◆ beginFrame()

void QPlatformOpenGLContext::beginFrame ( )
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 QCocoaGLContext, and QtWaylandClient::QWaylandGLContext.

Definition at line 136 of file qplatformopenglcontext.cpp.

◆ context()

QOpenGLContext * QPlatformOpenGLContext::context ( ) const

Definition at line 82 of file qplatformopenglcontext.cpp.

◆ defaultFramebufferObject()

GLuint QPlatformOpenGLContext::defaultFramebufferObject ( QPlatformSurface * surface) const
virtual

Reimplement in subclass if your platform uses framebuffer objects for surfaces.

The default implementation returns 0.

Reimplemented in QIOSContext, QtWaylandClient::QWaylandGLContext, and QWasmOpenGLContext.

Definition at line 77 of file qplatformopenglcontext.cpp.

◆ doneCurrent()

◆ endFrame()

void QPlatformOpenGLContext::endFrame ( )
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.

◆ format()

virtual QSurfaceFormat QPlatformOpenGLContext::format ( ) const
pure virtual

◆ getProcAddress()

virtual QFunctionPointer QPlatformOpenGLContext::getProcAddress ( const char * procName)
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 QCocoaGLContext, QEGLPlatformContext, QGLXContext, QIOSContext, QtWaylandClient::QWaylandBrcmGLContext, QWasmOpenGLContext, and QWindowsGLContext.

◆ initialize()

void QPlatformOpenGLContext::initialize ( )
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 QCocoaGLContext, QEGLPlatformContext, and QtWaylandClient::QWaylandGLContext.

Definition at line 68 of file qplatformopenglcontext.cpp.

◆ isSharing()

virtual bool QPlatformOpenGLContext::isSharing ( ) const
inlinevirtual

◆ isValid()

virtual bool QPlatformOpenGLContext::isValid ( ) const
inlinevirtual

◆ makeCurrent()

◆ parseOpenGLVersion()

bool QPlatformOpenGLContext::parseOpenGLVersion ( const QByteArray & versionString,
int & major,
int & minor )
static

Definition at line 94 of file qplatformopenglcontext.cpp.

◆ swapBuffers()

virtual void QPlatformOpenGLContext::swapBuffers ( QPlatformSurface * surface)
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 QAndroidPlatformOpenGLContext, QCocoaGLContext, QEglFSContext, QEGLPlatformContext, QGLXContext, QIOSContext, QQnxGLContext, QtWaylandClient::QWaylandBrcmGLContext, QtWaylandClient::QWaylandGLContext, QWasmOpenGLContext, QWindowsGLContext, and QXcbEglContext.

◆ QOpenGLContext

friend class QOpenGLContext
friend

Definition at line 64 of file qplatformopenglcontext.h.

◆ QOpenGLContextPrivate

friend class QOpenGLContextPrivate
friend

Definition at line 65 of file qplatformopenglcontext.h.

Referenced by QOpenGLContextVersionData::forContext().


The documentation for this class was generated from the following files: