EdenCGL |
Interface to the Apple CGL API for full screen OpenGL rendering.
Version: 1.1.0
The purpose of EdenCGL is to create and manage one or more full screen
OpenGL context using Apple's CoreGraphics DirectDisplay and Core OpenGL (CGL)
applications programming interfaces (APIs).
Fullscreen OpenGL contexts may exploit certain OpenGL driver optimisations
including hardware accelerated rendering, direct memory access (DMA) to pixels
and page-flipped buffer swaps.
EdenCGLCleanup |
Cleanup and remve all full screen OpenGL contexts and restore displays.
EDEN_BOOL EdenCGLCleanup( void);
Returns TRUE if successful, FALSE if an error occured.
This function destroys all full screen OpenGL contexts, disposes of the resources used, and returns all captured displays to the system.
EdenCGLContextFlush |
Flush all pending OpenGL commands and swap the back buffer to the screen.
void EdenCGLContextFlush( const int index);
index
This routine calls through to CGL's implementation of the familiar OpenGL buffer swap routine, and should be called at the completion of each drawing frame.
EdenCGLContextSelect |
Select the context to which subsequent OpenGL commands will apply.
EDEN_BOOL EdenCGLContextSelect( const int index);
index
Returns TRUE if successful, FALSE if an error occured.
Before issuing commands to OpenGL, a rendering context must be active. The purpose of EdenCGL is to create and manage such a context. This function makes a particular CGL context (set up with a call to EdenCGLSetup()) the target for future OpenGL commands. Only one context can be the active for OpenGL commands at any one time. The context to make active is specified in the index parameter. Where more than one context has been created with EdenCGLSetup(), this function should be used to switch between the contexts.
EdenCGLContextSetVBLSync |
Turn synchronisation of buffer swaps to VBL on or off for an established fullscreen CGL context.
EDEN_BOOL EdenCGLContextSetVBLSync( const int index, const EDEN_BOOL sync);
index
sync
Returns TRUE if successful, FALSE if an error occured.
When a full screen CGL context is first set up, a parameter in the EDEN_CGL_DISPLAY_MODE structure specifies whether buffer swaps are to be synchronised to the display's vertical blanking interval (VBL). This function allows the synchronisation to be turned on or off.
EdenCGLSetup |
Use CGL to setup full screen OpenGL contexts on one or more displays.
EDEN_BOOL EdenCGLSetup( const int displayCountDesired, const EDEN_CGL_DISPLAY_MODE *displayModesDesired, const EDEN_BOOL captureAll);
displayCountDesired
displayModesDesired
captureAll
Returns TRUE if successful, FALSE if an error occured.
This function creates one or more full screen accelerated OpenGL contexts
via the CGL API. Each display on which a context is set up is captured,
preventing its use by other programs in the system. Optionally, a more
optimal path in which all displays on the system are captured can be
enabled.
This function may be called more than once. Subsequent calls will add to the
number of full screen contexts already set up. The parameter captureAll is
ignored on subsequent calls unless EdenCGLCleanup() is called first.
EDEN_CGL_DISPLAY_MODE |
Structure to specify a mode at which to drive a display for a fullscreen OpenGL context.
typedef struct { size_t width; size_t height; size_t depth; CGRefreshRate refresh; int display; EDEN_BOOL syncToVBL; EDEN_BOOL stereo; } EDEN_CGL_DISPLAY_MODE;
width
- Width of the desired display mode, in pixels (e.g. 640).
height
- Height of the desired display mode, in pixels (e.g. 480).
depth
- Depth of the desired display mode, in bits per pixel (e.g. 32).
refresh
- Refresh rate of the desired display mode, in hertz (e.g. 60.0), or 0.0 if any available refresh rate may be used. Specifying a non-zero value for this parameter may have no effect on digitally-driven displays (e.g. LCD panels) which do not have a conventional refresh cycle.
display
- Index to the display which is to be set to this mode. This is a zero-based index, where display 0 is always the main display.
display
- A value of TRUE indicates that buffer swaps on this display should be synced to the vertical blanking interval (VBL) to prevent "tearing" which might occur when a swap occurs part way through a display refresh. Specifying a value for this parameter may have no effect for digitally-driven displays which do not have a VBL period.
Prior to building an OpenGL fullscreen context on a display, it switches the display to a mode requested by user. This structure is used to specify the requested mode for a single display.
gEdenCGLActive |
Indicates whether the displays are in use by EdenCGL.
extern EDEN_BOOL gEdenCGLActive;
Will be TRUE after a successful call to EdenCGLSetup() has been made and EdenCGL is using the displays, and will be FALSE if after a call to EdenCGLCleanup() or if EdenCGLSetup() has never been called.
© 2001-2006 Philip Lamb Last Updated: Tuesday, April 05, 2005