|
| vtkOpenGLState () |
|
void | GetBlendFuncState (int *) |
|
bool | GetEnumState (unsigned int name) |
|
void | SetEnumState (unsigned int name, bool value) |
|
void | ResetEnumState (unsigned int name) |
| convenience method to reset an enum state from current openGL context More...
|
|
void | Initialize (vtkOpenGLRenderWindow *) |
| Initialize OpenGL context using current state. More...
|
|
|
void | vtkglClearColor (float red, float green, float blue, float alpha) |
|
void | vtkglClearDepth (double depth) |
|
void | vtkglDepthFunc (unsigned int val) |
|
void | vtkglDepthMask (unsigned char flag) |
|
void | vtkglColorMask (unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
|
void | vtkglViewport (int x, int y, int width, int height) |
|
void | vtkglScissor (int x, int y, int width, int height) |
|
void | vtkglEnable (unsigned int cap) |
|
void | vtkglDisable (unsigned int cap) |
|
void | vtkglBlendFunc (unsigned int sfactor, unsigned int dfactor) |
|
void | vtkglBlendFuncSeparate (unsigned int sfactorRGB, unsigned int dfactorRGB, unsigned int sfactorAlpha, unsigned int dfactorAlpha) |
|
void | vtkglBlendEquation (unsigned int val) |
|
void | vtkglBlendEquationSeparate (unsigned int col, unsigned int alpha) |
|
void | vtkglCullFace (unsigned int val) |
|
|
void | ResetGlClearColorState () |
|
void | ResetGlClearDepthState () |
|
void | ResetGlDepthFuncState () |
|
void | ResetGlDepthMaskState () |
|
void | ResetGlColorMaskState () |
|
void | ResetGlViewportState () |
|
void | ResetGlScissorState () |
|
void | ResetGlBlendFuncState () |
|
void | ResetGlBlendEquationState () |
|
void | ResetGlCullFaceState () |
|
|
void | vtkglClear (unsigned int mask) |
|
|
void | vtkglGetBooleanv (unsigned int pname, unsigned char *params) |
|
void | vtkglGetIntegerv (unsigned int pname, int *params) |
|
void | vtkglGetDoublev (unsigned int pname, double *params) |
|
void | vtkglGetFloatv (unsigned int pname, float *params) |
|
OpenGL state storage.
vtkOpenGLState is a class designed to keep track of the state of an OpenGL context. Applications using VTK have so much ontrol over the rendering process that is can be difficult in VTK code to know if the OpenGL state is correct for your code. The two traditional solutions have been to set everything yourself and to save and restore OpenGL state that you change. The former makes your code work, the latter hels prevent your code from breaking something else. The problem is that the former results in tons of redundent OpenGL calls and the later is done by querying the OpenGL state which can cause a pipeline sync/stall which is very slow.
To address these issues this class stores OpenGL state for commonly used functions. Requests made to change state to the current state become no-ops. Queries of state can be done by querying the state stored in this class without impacting the OpenGL driver.
To fascilitate saving state and restoring it this class contains a number of nested classes named Scoped<glFunction> that store the state of that glFunction and when they go out of scope they restore it. This is useful when you want to change the OpenGL state and then automatically restore it when done. They can be used as follows
{ vtkOpenGLState *ostate = renWin->GetState(); vtkOpenGLState::ScopedglDepthMask dmsaved(ostate); // the prior state is now saved ... ostate->glDepthMask(GL_TRUE); // maybe change the state ... etc } // prior state will be restored here as it goes out of scope
You must use this class to make stat changing OpenGL class otherwise the results will be undefined.
For convenience some OpenGL calls that do not impact state are also provided.
Definition at line 67 of file vtkOpenGLState.h.