Vuo  2.3.2
Macros | Typedefs | Functions
VuoGlContext.h File Reference

Description

VuoGlContext interface.

Definition in file VuoGlContext.h.

Go to the source code of this file.

Macros

#define VuoGlContext_disuse(glContext)   VuoGlContext_disuseF(glContext, __FILE__, __LINE__, __func__)
 Throws the specified VuoGlContext back in the pool. More...
 
#define VGL()   _VGL(cgl_ctx, __FILE__, __LINE__, __func__);
 If there's an OpenGL error, prints info about it. More...
 

Typedefs

typedef void * VuoGlContext
 A framebuffer and state for GL rendering. More...
 

Functions

int VuoGlContext_getMaximumSupportedMultisampling (VuoGlContext context)
 Returns the maximum supported multisampling level for this GPU. More...
 
void VuoGlContext_setGlobalRootContext (void *rootContext)
 Specifies a platform-specific context to be used as the base for all of Vuo's shared GL contexts. More...
 
VuoGlContext VuoGlContext_use (void)
 Finds an unused GL context in the process-wide shared context pool (or creates one if none is available), marks it used, and returns it. More...
 
void VuoGlContext_perform (void(^function)(CGLContextObj cgl_ctx))
 Executes code using the global OpenGL context. More...
 
void VuoGlContext_disuseF (VuoGlContext glContext, const char *file, const unsigned int linenumber, const char *func)
 Throws the specified context back in the pool. More...
 
void * VuoGlContext_makePlatformPixelFormat (bool hasDepthBuffer, bool openGL32Core, GLint displayMask)
 Returns a platform-specific OpenGL pixelformat description. More...
 
bool VuoGlContext_isOpenGL32Core (VuoGlContext context)
 Returns true if the specified context is OpenGL 3.2+ Core Profile. More...
 

Macro Definition Documentation

◆ VGL

#define VGL ( )    _VGL(cgl_ctx, __FILE__, __LINE__, __func__);

If there's an OpenGL error, prints info about it.

Useful for debugging.

Example:
void nodeEvent()
{
CGLContextObj cgl_ctx = (CGLContextObj)VuoGlContext_use();
glEnable(GL_ALPHA);
VGL();
}

Definition at line 62 of file VuoGlContext.h.

◆ VuoGlContext_disuse

#define VuoGlContext_disuse (   glContext)    VuoGlContext_disuseF(glContext, __FILE__, __LINE__, __func__)

Throws the specified VuoGlContext back in the pool.

This function may be called from any thread.

Definition at line 39 of file VuoGlContext.h.

Typedef Documentation

◆ VuoGlContext

typedef void* VuoGlContext

A framebuffer and state for GL rendering.

Definition at line 23 of file VuoGlContext.h.

Function Documentation

◆ VuoGlContext_disuseF()

void VuoGlContext_disuseF ( VuoGlContext  glContext,
const char *  file,
const unsigned int  linenumber,
const char *  func 
)

Throws the specified context back in the pool.

This function may be called from any thread.

Definition at line 298 of file VuoGlContext.cc.

◆ VuoGlContext_getMaximumSupportedMultisampling()

int VuoGlContext_getMaximumSupportedMultisampling ( VuoGlContext  context)

Returns the maximum supported multisampling level for this GPU.

Multisampling is known to break point rendering on some GPUs, so we intentionally disable it on those.

Definition at line 603 of file VuoGlContext.cc.

◆ VuoGlContext_isOpenGL32Core()

bool VuoGlContext_isOpenGL32Core ( VuoGlContext  context)

Returns true if the specified context is OpenGL 3.2+ Core Profile.

Changed in Vuo 2.0.0:
New.

Definition at line 765 of file VuoGlContext.cc.

◆ VuoGlContext_makePlatformPixelFormat()

void* VuoGlContext_makePlatformPixelFormat ( bool  hasDepthBuffer,
bool  openGL32Core,
GLint  displayMask 
)

Returns a platform-specific OpenGL pixelformat description.

On Mac OS X, this is a CGLPixelFormatObj.

Parameters
hasDepthBufferIf true, the returned context will have a depth buffer.
openGL32CoreIf true, the returned context will be OpenGL 3.2 Core Profile. If false, OpenGL 2.1.
displayMaskIf -1, the context will not be restricted by display. If nonzero, the context will be restricted to the specified displays (CGDisplayIDToOpenGLDisplayMask()). If the low byte is 0xff, the context will use the Apple Software Renderer.
Returns
-1 if the displayMask is invalid. NULL if another error occurred.

Definition at line 645 of file VuoGlContext.cc.

◆ VuoGlContext_perform()

void VuoGlContext_perform ( void(^)(CGLContextObj cgl_ctx)  function)

Executes code using the global OpenGL context.

Example:
VuoGlContext_perform(^(CGLContextObj cgl_ctx){
glClear(…);
});

This function may be called from any thread.

Definition at line 397 of file VuoGlContext.cc.

◆ VuoGlContext_setGlobalRootContext()

void VuoGlContext_setGlobalRootContext ( void *  rootContext)

Specifies a platform-specific context to be used as the base for all of Vuo's shared GL contexts.

On Mac, this should be a CGLContext. The CGLContext must be unlocked when calling this function, but after that you may lock it at any time (Vuo doesn't require it to be locked or unlocked).

Must be called before any Vuo composition is loaded, and before any other VuoGlContext_* methods.

This function may be called from any thread.

Definition at line 556 of file VuoGlContext.cc.

◆ VuoGlContext_use()

VuoGlContext VuoGlContext_use ( void  )

Finds an unused GL context in the process-wide shared context pool (or creates one if none is available), marks it used, and returns it.

This function may be called from any thread.

Definition at line 259 of file VuoGlContext.cc.