VVISF & VVGL
VVGL::GLContext Class Reference

GLContext is an attempt to make a platform/SDK-agnostic representation of an OpenGL context. More...

#include <GLContext.hpp>

Public Member Functions

GLContextRef newContextSharingMe () const
 Creates and returns a new OpenGL context in the same sharegroup as the receiver.
 
void makeCurrent ()
 Makes this GL context current.
 
void makeCurrentIfNotCurrent ()
 Makes this GL context current if it isn't already current.
 
void makeCurrentIfNull ()
 Makes this GL context current if no context is current.
 
bool sameShareGroupAs (const GLContextRef &inCtx)
 Returns a true if the passed context is in the same sharegroup as the receiver.
 

Public Attributes

GLVersion version = GLVersion_Unknown
 The version of OpenGL this context is using.
 

Related Functions

(Note that these are not member functions.)

using GLContextRef = shared_ptr< GLContext >
 A GLContextRef is a shared pointer around a GLContext.
 
GLContextRef CreateGLContextRefUsing (EGLDisplay inDisplay, EGLSurface inWinSurface, EGLContext inSharedCtx, EGLContext inCtx)
 Doesn't create any GL resources, just makes a new GLContext instance around the passed EGLContext.
 
GLContextRef CreateNewGLContextRef (EGLDisplay inDisplay, EGLSurface inWinSurface, EGLContext inSharedCtx)
 Makes a new OpenGL context and GLContext instance.
 
GLContextRef CreateNewGLContextRef ()
 Creates a generic OpenGL context and GLContext instance using whatever the default settings are for this platform and SDK.
 

Detailed Description

GLContext is an attempt to make a platform/SDK-agnostic representation of an OpenGL context.

GLContext is a OpenGL context- this class wraps up whatever the native object is for whatever platform/SDK you're compiling VVGL against, and presents a single standard interface across all platforms for the rest of VVGL and any libs that derive from it. You can create a GLContext around an existing platform-specific OpenGL context- which makes integration with existing codebases easy- or you can also create new OpenGL contexts by making a new instance of GLContext or using the newContextSharingMe() member function of an existing context. Has explicit support for sharing of multiple contexts so resources (textures, models, etc) can be shared between contexts.

Notes on use:

  • You should strive whenever possible to work with GLContextRef instead of GLContext.
  • If you want to create a GLContext, you should try using one of the non-member creation functions listed on this page. These functions return a GLContextRef instead of just a GLContext, and their function names are slightly more verbose and descriptive than GLContext's constructors.
  • The specific constructor (or create functions) for creating a GLContext is going to depend on the SDK you're working with, because they generally require some sort of platform- or SDK-specific object or pointer to a native GL context.

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