Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 QtWaylandClient::QWaylandGLContext.

Definition at line 136 of file qplatformopenglcontext.cpp.

◆ context()

QOpenGLContext * QPlatformOpenGLContext::context ( ) const

◆ 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, QWasmOpenGLContext, and QtWaylandClient::QWaylandGLContext.

Definition at line 77 of file qplatformopenglcontext.cpp.

Referenced by QWasmOpenGLContext::defaultFramebufferObject().

+ Here is the caller graph for this function:

◆ 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()

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 QEGLPlatformContext, QCocoaGLContext, QIOSContext, QWasmOpenGLContext, QWindowsGLContext, QGLXContext, QtWaylandClient::QWaylandBrcmGLContext, and QtWaylandClient::QWaylandGLContext.

◆ 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 QEGLPlatformContext, and QCocoaGLContext.

Definition at line 68 of file qplatformopenglcontext.cpp.

Referenced by QOpenGLContextPrivate::adopt().

+ Here is the caller graph for this function:

◆ isSharing()

virtual bool QPlatformOpenGLContext::isSharing ( ) const
inlinevirtual

Reimplemented in QEGLPlatformContext, QCocoaGLContext, QIOSContext, QWasmOpenGLContext, QWindowsGLContext, and QGLXContext.

Definition at line 54 of file qplatformopenglcontext.h.

Referenced by QOpenGLContextPrivate::adopt().

+ Here is the caller graph for this function:

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

References QByteArrayLiteral, qWarning, QByteArray::split(), and QByteArray::startsWith().

Referenced by QIOSContext::QIOSContext(), QWindowsOpenGLContextFormat::current(), and updateFormatFromContext().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ swapBuffers()

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 QEGLPlatformContext, QAndroidPlatformOpenGLContext, QCocoaGLContext, QEglFSContext, QIOSContext, QQnxGLContext, QWasmOpenGLContext, QWindowsGLContext, QXcbEglContext, QGLXContext, QtWaylandClient::QWaylandBrcmGLContext, and QtWaylandClient::QWaylandGLContext.

Friends And Related Symbol Documentation

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


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