QPlatformOpenGLContext Class

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

Header: #include <QPlatformOpenGLContext>
Inherited By:

QEGLPlatformContext

Public Functions

virtual void beginFrame()
virtual GLuint defaultFramebufferObject(QPlatformSurface *surface) const
virtual void endFrame()
virtual void initialize()

Detailed Description

\since4.8 \internal \preliminary \ingroup qpa

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.

Member Function Documentation

[virtual] void QPlatformOpenGLContext::beginFrame()

Called when the RHI begins rendering a new frame in the context. Will always be paired with a call to endFrame().

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

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

The default implementation returns 0.

[virtual] void QPlatformOpenGLContext::endFrame()

Called when the RHI ends rendering a in the context. Is always preceded by a call to beginFrame().

[virtual] void QPlatformOpenGLContext::initialize()

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.