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

Description

VuoGlContext interface.

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)
 Helper for VuoGlContext_disuse. More...
 
void * VuoGlContext_makePlatformPixelFormat (bool hasDepthBuffer, bool openGL32Core, GLint displayMask)
 Returns a platform-specific OpenGL pixelformat description. More...
 
void _VGL (CGLContextObj cgl_ctx, const char *file, const unsigned int linenumber, const char *func)
 Helper for VGL(). 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();
}

◆ 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.

Typedef Documentation

◆ VuoGlContext

typedef void* VuoGlContext

A framebuffer and state for GL rendering.

Function Documentation

◆ _VGL()

void _VGL ( CGLContextObj  cgl_ctx,
const char *  file,
const unsigned int  linenumber,
const char *  func 
)

Helper for VGL().

◆ VuoGlContext_disuseF()

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

Helper for VuoGlContext_disuse.

◆ 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.

◆ 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 0xff, the context will use the Apple Software Renderer.
Returns
-1 if the displayMask is invalid. NULL if another error occurred.

◆ VuoGlContext_perform()

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


Executes code using the global OpenGL context.

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

◆ 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.

◆ 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.