![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QOpenGLSharedResource class is used to keep track of resources that are shared between OpenGL contexts (like textures, framebuffer objects, shader programs, etc), and clean them up in a safe way when they're no longer needed. \inmodule QtGui. More...
#include <qopenglcontext_p.h>
Public Member Functions | |
QOpenGLSharedResource (QOpenGLContextGroup *group) | |
virtual | ~QOpenGLSharedResource ()=0 |
QOpenGLContextGroup * | group () const |
void | free () |
Protected Member Functions | |
virtual void | invalidateResource ()=0 |
virtual void | freeResource (QOpenGLContext *context)=0 |
Friends | |
class | QOpenGLContextGroup |
class | QOpenGLContextGroupPrivate |
class | QOpenGLMultiGroupSharedResource |
The QOpenGLSharedResource class is used to keep track of resources that are shared between OpenGL contexts (like textures, framebuffer objects, shader programs, etc), and clean them up in a safe way when they're no longer needed. \inmodule QtGui.
The QOpenGLSharedResource instance should never be deleted, instead free() should be called when it's no longer needed. Thus it will be put on a queue and freed at an appropriate time (when a context in the share group becomes current).
The sub-class needs to implement two pure virtual functions. The first, freeResource() must be implemented to actually do the freeing, for example call glDeleteTextures() on a texture id. Qt makes sure a valid context in the resource's share group is current at the time. The other, invalidateResource(), is called by Qt in the circumstance when the last context in the share group is destroyed before free() has been called. The implementation of invalidateResource() should set any identifiers to 0 or set a flag to prevent them from being used later on.
Definition at line 39 of file qopenglcontext_p.h.
QOpenGLSharedResource::QOpenGLSharedResource | ( | QOpenGLContextGroup * | group | ) |
Definition at line 1147 of file qopenglcontext.cpp.
|
pure virtual |
Definition at line 1154 of file qopenglcontext.cpp.
void QOpenGLSharedResource::free | ( | ) |
Definition at line 1159 of file qopenglcontext.cpp.
|
protectedpure virtual |
|
inline |
Definition at line 45 of file qopenglcontext_p.h.
|
protectedpure virtual |
|
friend |
Definition at line 60 of file qopenglcontext_p.h.
|
friend |
Definition at line 61 of file qopenglcontext_p.h.
|
friend |
Definition at line 62 of file qopenglcontext_p.h.