Qt 4.8
Public Functions | Static Public Functions | Protected Variables | Private Functions | Friends | List of all members
QPlatformGLContext Class Referenceabstract

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

#include <qplatformglcontext_qpa.h>

Inheritance diagram for QPlatformGLContext:
EAGLPlatformContext QBBGLContext QDirectFbGLContext QDri2Context QEGLPlatformContext QGLXContext QGLXContext QWaylandGLContext QWaylandReadbackEglContext QWaylandReadbackGlxContext QWaylandXCompositeEGLContext QWaylandXCompositeGLXContext

Public Functions

virtual void doneCurrent ()
 Reimplement in subclass to release current context. More...
 
virtual void * getProcAddress (const QString &procName)=0
 Reimplement in subclass to native getProcAddr calls. More...
 
virtual void makeCurrent ()
 Reimplement in subclass to do makeCurrent on native GL context. More...
 
virtual QPlatformWindowFormat platformWindowFormat () const =0
 QWidget has the function qplatformWindowFormat(). More...
 
 QPlatformGLContext ()
 All subclasses needs to specify the platformWindow. More...
 
virtual void swapBuffers ()=0
 Reimplement in subclass to native swap buffers calls. More...
 
virtual ~QPlatformGLContext ()
 If this is the current context for the thread, doneCurrent is called. More...
 

Static Public Functions

static const QPlatformGLContextcurrentContext ()
 Returns the last context which called makeCurrent. More...
 

Protected Variables

QScopedPointer< QPlatformGLContextPrivated_ptr
 

Private Functions

void deleteQGLContext ()
 
 Q_DECLARE_PRIVATE (QPlatformGLContext)
 
 Q_DISABLE_COPY (QPlatformGLContext)
 
void * qGLContextHandle () const
 
void setQGLContextHandle (void *handle, void(*qGLContextDeleteFunction)(void *))
 

Friends

class QGLContext
 
class QWidgetPrivate
 

Detailed Description

The QPlatformGLContext class provides an abstraction for native GL contexts.

Since
4.8
Warning
This function is not part of the public interface. This function is under development and subject to change.

In QPA the way to support OpenGL or OpenVG or other technologies that requires a native GL context is through the QPlatformGLContext wrapper.

There is no factory function for QPlatformGLContexts, but rather only one accessor function. The only place to retrieve a QPlatformGLContext from is through a QPlatformWindow.

The context which is current for a specific thread can be collected by the currentContext() function. This is how QPlatformGLContext also makes it possible to use the QtOpenGL module withhout using QGLWidget. When using QGLContext::currentContext(), it will ask QPlatformGLContext for the currentContext. Then a corresponding QGLContext will be returned, which maps to the QPlatformGLContext.

Definition at line 56 of file qplatformglcontext_qpa.h.

Constructors and Destructors

◆ QPlatformGLContext()

QPlatformGLContext::QPlatformGLContext ( )
explicit

All subclasses needs to specify the platformWindow.

It can be a null window.

Definition at line 112 of file qplatformglcontext_qpa.cpp.

114 {
115 }
QScopedPointer< QPlatformGLContextPrivate > d_ptr

◆ ~QPlatformGLContext()

QPlatformGLContext::~QPlatformGLContext ( )
virtual

If this is the current context for the thread, doneCurrent is called.

Definition at line 120 of file qplatformglcontext_qpa.cpp.

121 {
122  if (QPlatformGLContext::currentContext() == this) {
123  doneCurrent();
124  }
125 
126 }
static const QPlatformGLContext * currentContext()
Returns the last context which called makeCurrent.
virtual void doneCurrent()
Reimplement in subclass to release current context.

Functions

◆ currentContext()

const QPlatformGLContext * QPlatformGLContext::currentContext ( )
static

Returns the last context which called makeCurrent.

This function is thread aware.

Definition at line 100 of file qplatformglcontext_qpa.cpp.

Referenced by QDri2Context::QDri2Context(), QWaylandGLContext::setEglSurface(), QWaylandReadbackEglContext::swapBuffers(), QWaylandReadbackGlxContext::swapBuffers(), and ~QPlatformGLContext().

101 {
102  QPlatformGLThreadContext *threadContext = qplatformgl_context_storage.localData();
103  if(threadContext) {
104  return threadContext->context;
105  }
106  return 0;
107 }
static QThreadStorage< QPlatformGLThreadContext * > qplatformgl_context_storage

◆ deleteQGLContext()

void QPlatformGLContext::deleteQGLContext ( )
private

Definition at line 162 of file qplatformglcontext_qpa.cpp.

163 {
165  if (d->qGLContextDeleteFunction && d->qGLContextHandle) {
166  d->qGLContextDeleteFunction(d->qGLContextHandle);
167  d->qGLContextDeleteFunction = 0;
168  d->qGLContextHandle = 0;
169  }
170 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QPlatformGLContext class provides an abstraction for native GL contexts.

◆ doneCurrent()

void QPlatformGLContext::doneCurrent ( )
virtual

◆ getProcAddress()

void * QPlatformGLContext::getProcAddress ( const QString procName)
pure virtual

◆ makeCurrent()

void QPlatformGLContext::makeCurrent ( )
virtual

◆ platformWindowFormat()

QPlatformWindowFormat QPlatformGLContext::platformWindowFormat ( ) const
pure virtual

QWidget has the function qplatformWindowFormat().

That function is for the application programmer to request the format of the window and the context that he wants.

Reimplement this function in a subclass to indicate what format the glContext actually has.

Implemented in EAGLPlatformContext, QGLXContext, QBBGLContext, QWaylandXCompositeGLXContext, QGLXContext, QDri2Context, QWaylandReadbackEglContext, QWaylandReadbackGlxContext, QWaylandXCompositeEGLContext, QWaylandGLContext, QDirectFbGLContext, and QEGLPlatformContext.

Referenced by QGLWidget::event().

◆ Q_DECLARE_PRIVATE()

QPlatformGLContext::Q_DECLARE_PRIVATE ( QPlatformGLContext  )
private

◆ Q_DISABLE_COPY()

QPlatformGLContext::Q_DISABLE_COPY ( QPlatformGLContext  )
private

◆ qGLContextHandle()

void * QPlatformGLContext::qGLContextHandle ( ) const
private

Definition at line 149 of file qplatformglcontext_qpa.cpp.

Referenced by QGLWidget::event().

150 {
151  Q_D(const QPlatformGLContext);
152  return d->qGLContextHandle;
153 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QPlatformGLContext class provides an abstraction for native GL contexts.

◆ setQGLContextHandle()

void QPlatformGLContext::setQGLContextHandle ( void *  handle,
void(*)(void *)  qGLContextDeleteFunction 
)
private

Definition at line 155 of file qplatformglcontext_qpa.cpp.

156 {
158  d->qGLContextHandle = handle;
159  d->qGLContextDeleteFunction = qGLContextDeleteFunction;
160 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QPlatformGLContext class provides an abstraction for native GL contexts.

◆ swapBuffers()

void QPlatformGLContext::swapBuffers ( )
pure virtual

Friends and Related Functions

◆ QGLContext

friend class QGLContext
friend

Definition at line 78 of file qplatformglcontext_qpa.h.

◆ QWidgetPrivate

friend class QWidgetPrivate
friend

Definition at line 79 of file qplatformglcontext_qpa.h.

Properties

◆ d_ptr

QScopedPointer<QPlatformGLContextPrivate> QPlatformGLContext::d_ptr
protected

Definition at line 74 of file qplatformglcontext_qpa.h.


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