Author: eilemann@gmail.com
State:
- Implemented in 0.5
- Upgraded to GLEW 1.5.7 in 1.0-alpha
Overview
Equalizer uses GLEW for OpenGL extension handling, particularly the GLEW MX implementation for multiple context support.
Implementation
Each eq::Window
has a GLEWContext
. This context can
be obtained by using glewGetContext
on the window or
channel. GLEW MX uses this function to dispatch the functions to the correct
context. Equalizer (re-)initializes the GLEW context whenever a new OpenGL
context is set on the window.
Each eq::Pipe
has a WGLEWContext
. This context
is intended to be used for generic functions needed during window creation,
e.g., for the WGL_NV_gpu_affinity
extension used to create
a GPU-specific rendering context. Note that this is an abstraction for WGL,
not OpenGL functions.
Usage
Extended OpenGL functions called from a window or channel instance can be
called directly. GLEW will call the object's glewGetContext
to
obtain the correct context.
Extended OpenGL functions called from another place need to have the macro or
function glewGetContext
that returns the pointer to the
GLEWContext of the appropriate window.
Examples
void eqPly::Channel::_drawModel( const Model* model ) { ... glUseProgram( program ); ... } // state has GLEWContext* from window define glewGetContext state.glewGetContext /* Set up rendering of the leaf nodes. */ void VertexBufferLeaf::setupRendering( VertexBufferState& state, GLuint* data ) const { ... glBindBuffer( GL_ARRAY_BUFFER, data[VERTEX_OBJECT] ); glBufferData( GL_ARRAY_BUFFER, _vertexLength * sizeof( Normal ), &_globalData.normals[_vertexStart], GL_STATIC_DRAW ); ... }
API
WGLEWContext* eq::Pipe::wglewGetContext(); GLEWContext* eq::Window::glewGetContext(); GLEWContext* eq::Channel::glewGetContext();
File Format
No Changes.
Open Issues
None known