Loading...
Searching...
No Matches
GlfSharedGLContextScopeHolder Class Referencefinal

Helper class to make the shared GL context current. More...

#include <glContext.h>

+ Inheritance diagram for GlfSharedGLContextScopeHolder:

Detailed Description

Helper class to make the shared GL context current.

Example:

class MyTexture {
public:
MyTexture() : _textureId(0) {
// allocate from the shared context pool.
GlfSharedGLContextScopeHolder sharedContextScopeHolder;
glGenTextures(1, &_textureId);
}
~MyTexture() {
// delete from the shared context pool.
GlfSharedGLContextScopeHolder sharedContextScopeHolder;
glDeleteTextures(1, &_texureId);
_textureId = 0;
}
// The caller is responsible for making sure that a suitable
// GL context is current before calling other methods.
void Bind() {
glBindTexture(GL_TEXTURE_2D, _textureId);
}
void Unbind() {
glBindTexture(GL_TEXTURE_2D, 0);
}
...
private:
GLuint _textureId;
};
Helper class to make the shared GL context current.
Definition: glContext.h:237

Definition at line 236 of file glContext.h.

Constructor & Destructor Documentation

◆ GlfSharedGLContextScopeHolder()

Definition at line 239 of file glContext.h.


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