VTK
9.1.0
|
OpenGL state storage. More...
#include <vtkOpenGLState.h>
Classes | |
class | BufferBindingState |
class | GLState |
class | ScopedglActiveTexture |
class | ScopedglBlendFuncSeparate |
class | ScopedglClearColor |
class | ScopedglColorMask |
class | ScopedglDepthFunc |
class | ScopedglDepthMask |
class | ScopedglEnableDisable |
class | ScopedglScissor |
class | ScopedglViewport |
class | ScopedValue |
Public Types | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual vtkTypeBool | IsA (const char *type) |
Return 1 if this class is the same type of (or a subclass of) the named class. | |
vtkOpenGLState * | NewInstance () const |
void | PrintSelf (ostream &os, vtkIndent indent) override |
Methods invoked by print to print information about the object including superclasses. | |
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 | |
void | ActivateTexture (vtkTextureObject *) |
Activate a texture unit for this texture. | |
void | DeactivateTexture (vtkTextureObject *) |
Deactivate a previously activated texture. | |
int | GetTextureUnitForTexture (vtkTextureObject *) |
Get the texture unit for a given texture object. | |
void | VerifyNoActiveTextures () |
Check to make sure no textures have been left active. | |
void | Initialize (vtkOpenGLRenderWindow *) |
Initialize OpenGL context using current state. | |
void | SetTextureUnitManager (vtkTextureUnitManager *textureUnitManager) |
Set the texture unit manager. | |
vtkTextureUnitManager * | GetTextureUnitManager () |
Returns its texture unit manager object. | |
virtual vtkOpenGLShaderCache * | GetShaderCache () |
virtual vtkOpenGLVertexBufferObjectCache * | GetVBOCache () |
void | SetVBOCache (vtkOpenGLVertexBufferObjectCache *val) |
int | GetDefaultTextureInternalFormat (int vtktype, int numComponents, bool needInteger, bool needFloat, bool needSRGB) |
Get a mapping of vtk data types to native texture formats for this window we put this on the RenderWindow so that every texture does not have to build these structures themselves. | |
void | GetCurrentDrawFramebufferState (unsigned int &drawBinding, unsigned int &drawBuffer) |
Get the current stored state of the draw buffer and binding. | |
void | vtkglBlitFramebuffer (int, int, int, int, int, int, int, int, unsigned int, unsigned int) |
Perform a blit but handle some driver bugs safely. | |
void | Reset () |
Record the OpenGL state into this class. | |
void | Push () |
Push all the recorded state onto the stack. | |
void | Pop () |
Pop the state stack to restore a previous state. | |
std::string const & | GetVersion () |
Return the opengl version for this context. | |
std::string const & | GetVendor () |
Return the opengl vendor for this context. | |
std::string const & | GetRenderer () |
Return the opengl renderer for this context. | |
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 | vtkglActiveTexture (unsigned int) |
void | vtkglBindFramebuffer (unsigned int target, unsigned int fb) |
void | vtkglDrawBuffer (unsigned int) |
void | vtkglDrawBuffers (unsigned int n, unsigned int *) |
void | vtkglReadBuffer (unsigned int) |
void | vtkglPointSize (float) |
void | vtkglLineWidth (float) |
void | vtkglStencilMaskSeparate (unsigned int face, unsigned int mask) |
void | vtkglStencilMask (unsigned int mask) |
void | vtkglStencilOpSeparate (unsigned int face, unsigned int sfail, unsigned int dpfail, unsigned int dppass) |
void | vtkglStencilOp (unsigned int sfail, unsigned int dpfail, unsigned int dppass) |
void | vtkglStencilFuncSeparate (unsigned int face, unsigned int func, int ref, unsigned int mask) |
void | vtkglStencilFunc (unsigned int func, int ref, unsigned int mask) |
void | vtkBindFramebuffer (unsigned int target, vtkOpenGLFramebufferObject *fo) |
void | vtkDrawBuffers (unsigned int n, unsigned int *, vtkOpenGLFramebufferObject *) |
void | vtkReadBuffer (unsigned int, vtkOpenGLFramebufferObject *) |
void | vtkglPixelStorei (unsigned int, int) |
void | ResetGLClearColorState () |
void | ResetGLClearDepthState () |
void | ResetGLDepthFuncState () |
void | ResetGLDepthMaskState () |
void | ResetGLColorMaskState () |
void | ResetGLViewportState () |
void | ResetGLScissorState () |
void | ResetGLBlendFuncState () |
void | ResetGLBlendEquationState () |
void | ResetGLCullFaceState () |
void | ResetGLActiveTexture () |
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) |
void | PushFramebufferBindings () |
Store/Restore the current framebuffer bindings and buffers. | |
void | PushDrawFramebufferBinding () |
Store/Restore the current framebuffer bindings and buffers. | |
void | PushReadFramebufferBinding () |
Store/Restore the current framebuffer bindings and buffers. | |
void | PopFramebufferBindings () |
Store/Restore the current framebuffer bindings and buffers. | |
void | PopDrawFramebufferBinding () |
Store/Restore the current framebuffer bindings and buffers. | |
void | PopReadFramebufferBinding () |
Store/Restore the current framebuffer bindings and buffers. | |
void | ResetFramebufferBindings () |
Store/Restore the current framebuffer bindings and buffers. | |
Public Member Functions inherited from vtkObject | |
vtkBaseTypeMacro (vtkObject, vtkObjectBase) | |
virtual void | DebugOn () |
Turn debugging output on. | |
virtual void | DebugOff () |
Turn debugging output off. | |
bool | GetDebug () |
Get the value of the debug flag. | |
void | SetDebug (bool debugFlag) |
Set the value of the debug flag. | |
virtual void | Modified () |
Update the modification time for this object. | |
virtual vtkMTimeType | GetMTime () |
Return this object's modified time. | |
void | PrintSelf (ostream &os, vtkIndent indent) override |
Methods invoked by print to print information about the object including superclasses. | |
void | RemoveObserver (unsigned long tag) |
void | RemoveObservers (unsigned long event) |
void | RemoveObservers (const char *event) |
void | RemoveAllObservers () |
vtkTypeBool | HasObserver (unsigned long event) |
vtkTypeBool | HasObserver (const char *event) |
int | InvokeEvent (unsigned long event) |
int | InvokeEvent (const char *event) |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
vtkCommand * | GetCommand (unsigned long tag) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
void | RemoveObserver (vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
void | RemoveObservers (unsigned long event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
void | RemoveObservers (const char *event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
vtkTypeBool | HasObserver (unsigned long event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
vtkTypeBool | HasObserver (const char *event, vtkCommand *) |
Allow people to add/remove/invoke observers (callbacks) to any VTK object. | |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
Overloads to AddObserver that allow developers to add class member functions as callbacks for events. | |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
Overloads to AddObserver that allow developers to add class member functions as callbacks for events. | |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
Allow user to set the AbortFlagOn() with the return value of the callback method. | |
int | InvokeEvent (unsigned long event, void *callData) |
This method invokes an event and return whether the event was aborted or not. | |
int | InvokeEvent (const char *event, void *callData) |
This method invokes an event and return whether the event was aborted or not. | |
Public Member Functions inherited from vtkObjectBase | |
const char * | GetClassName () const |
Return the class name as a string. | |
virtual vtkTypeBool | IsA (const char *name) |
Return 1 if this class is the same type of (or a subclass of) the named class. | |
virtual vtkIdType | GetNumberOfGenerationsFromBase (const char *name) |
Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). | |
virtual void | Delete () |
Delete a VTK object. | |
virtual void | FastDelete () |
Delete a reference to this object. | |
void | InitializeObjectBase () |
void | Print (ostream &os) |
Print an object to an ostream. | |
virtual void | Register (vtkObjectBase *o) |
Increase the reference count (mark as used by another object). | |
virtual void | UnRegister (vtkObjectBase *o) |
Decrease the reference count (release by another object). | |
int | GetReferenceCount () |
Return the current reference count of this object. | |
void | SetReferenceCount (int) |
Sets the reference count. | |
bool | GetIsInMemkind () const |
A local state flag that remembers whether this object lives in the normal or extended memory space. | |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
Methods invoked by print to print information about the object including superclasses. | |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
Methods invoked by print to print information about the object including superclasses. | |
Static Public Member Functions | |
static vtkOpenGLState * | New () |
static vtkTypeBool | IsTypeOf (const char *type) |
static vtkOpenGLState * | SafeDownCast (vtkObjectBase *o) |
Static Public Member Functions inherited from vtkObject | |
static vtkObject * | New () |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on. | |
static void | BreakOnError () |
This method is called when vtkErrorMacro executes. | |
static void | SetGlobalWarningDisplay (int val) |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
static void | GlobalWarningDisplayOn () |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
static void | GlobalWarningDisplayOff () |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
static int | GetGlobalWarningDisplay () |
This is a global flag that controls whether any debug, warning or error messages are displayed. | |
Static Public Member Functions inherited from vtkObjectBase | |
static vtkTypeBool | IsTypeOf (const char *name) |
Return 1 if this class type is the same type of (or a subclass of) the named class. | |
static vtkIdType | GetNumberOfGenerationsFromBaseType (const char *name) |
Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). | |
static vtkObjectBase * | New () |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on. | |
static void | SetMemkindDirectory (const char *directoryname) |
The name of a directory, ideally mounted -o dax, to memory map an extended memory space within. | |
static bool | GetUsingMemkind () |
A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space. | |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
vtkOpenGLState () | |
~vtkOpenGLState () override | |
void | BlendFuncSeparate (std::array< unsigned int, 4 > val) |
void | ClearColor (std::array< float, 4 > val) |
void | ColorMask (std::array< unsigned char, 4 > val) |
void | Scissor (std::array< int, 4 > val) |
void | Viewport (std::array< int, 4 > val) |
void | InitializeTextureInternalFormats () |
void | CheckState () |
Check that this OpenGL state has consistent values with the current OpenGL context. | |
Protected Member Functions inherited from vtkObject | |
vtkObject () | |
~vtkObject () override | |
void | RegisterInternal (vtkObjectBase *, vtkTypeBool check) override |
void | UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr) |
These methods allow a command to exclusively grab all events. | |
void | InternalReleaseFocus () |
These methods allow a command to exclusively grab all events. | |
Protected Member Functions inherited from vtkObjectBase | |
vtkObjectBase () | |
virtual | ~vtkObjectBase () |
virtual void | RegisterInternal (vtkObjectBase *, vtkTypeBool check) |
virtual void | UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) |
virtual void | ReportReferences (vtkGarbageCollector *) |
vtkObjectBase (const vtkObjectBase &) | |
void | operator= (const vtkObjectBase &) |
Protected Attributes | |
int | TextureInternalFormats [VTK_UNICODE_STRING][3][5] |
vtkTextureUnitManager * | TextureUnitManager |
std::map< const vtkTextureObject *, int > | TextureResourceIds |
std::list< BufferBindingState > | DrawBindings |
std::list< BufferBindingState > | ReadBindings |
int | MajorVersion |
int | MinorVersion |
int | MaxTextureSize |
std::string | Vendor |
std::string | Renderer |
std::string | Version |
std::stack< GLState > | Stack |
vtkOpenGLVertexBufferObjectCache * | VBOCache |
vtkOpenGLShaderCache * | ShaderCache |
Protected Attributes inherited from vtkObject | |
bool | Debug |
vtkTimeStamp | MTime |
vtkSubjectHelper * | SubjectHelper |
Protected Attributes inherited from vtkObjectBase | |
std::atomic< int32_t > | ReferenceCount |
vtkWeakPointerBase ** | WeakPointers |
Additional Inherited Members | |
Static Protected Member Functions inherited from vtkObjectBase | |
static vtkMallocingFunction | GetCurrentMallocFunction () |
static vtkReallocingFunction | GetCurrentReallocFunction () |
static vtkFreeingFunction | GetCurrentFreeFunction () |
static vtkFreeingFunction | GetAlternateFreeFunction () |
OpenGL state storage.
vtkOpenGLState is a class designed to keep track of the state of an OpenGL context. Applications using VTK have so much control 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 helps prevent your code from breaking something else. The problem is that the former results in tons of redundant 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.
This class is designed to hold all context related values and could just as well be considered a representation of the OpenGL context.
To facilitate 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 state 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 81 of file vtkOpenGLState.h.
typedef vtkObject vtkOpenGLState::Superclass |
Definition at line 85 of file vtkOpenGLState.h.
|
protected |
|
overrideprotected |
|
static |
|
static |
|
virtual |
Return 1 if this class is the same type of (or a subclass of) the named class.
Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObjectBase.
|
static |
|
protectedvirtual |
vtkOpenGLState * vtkOpenGLState::NewInstance | ( | ) | const |
|
overridevirtual |
void vtkOpenGLState::vtkglClearColor | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha | ||
) |
void vtkOpenGLState::vtkglClearDepth | ( | double | depth | ) |
void vtkOpenGLState::vtkglDepthFunc | ( | unsigned int | val | ) |
void vtkOpenGLState::vtkglDepthMask | ( | unsigned char | flag | ) |
void vtkOpenGLState::vtkglColorMask | ( | unsigned char | r, |
unsigned char | g, | ||
unsigned char | b, | ||
unsigned char | a | ||
) |
void vtkOpenGLState::vtkglViewport | ( | int | x, |
int | y, | ||
int | width, | ||
int | height | ||
) |
void vtkOpenGLState::vtkglScissor | ( | int | x, |
int | y, | ||
int | width, | ||
int | height | ||
) |
void vtkOpenGLState::vtkglEnable | ( | unsigned int | cap | ) |
void vtkOpenGLState::vtkglDisable | ( | unsigned int | cap | ) |
|
inline |
Definition at line 102 of file vtkOpenGLState.h.
void vtkOpenGLState::vtkglBlendFuncSeparate | ( | unsigned int | sfactorRGB, |
unsigned int | dfactorRGB, | ||
unsigned int | sfactorAlpha, | ||
unsigned int | dfactorAlpha | ||
) |
void vtkOpenGLState::vtkglBlendEquation | ( | unsigned int | val | ) |
void vtkOpenGLState::vtkglBlendEquationSeparate | ( | unsigned int | col, |
unsigned int | alpha | ||
) |
void vtkOpenGLState::vtkglCullFace | ( | unsigned int | val | ) |
void vtkOpenGLState::vtkglActiveTexture | ( | unsigned int | ) |
void vtkOpenGLState::vtkglBindFramebuffer | ( | unsigned int | target, |
unsigned int | fb | ||
) |
void vtkOpenGLState::vtkglDrawBuffer | ( | unsigned int | ) |
void vtkOpenGLState::vtkglDrawBuffers | ( | unsigned int | n, |
unsigned int * | |||
) |
void vtkOpenGLState::vtkglReadBuffer | ( | unsigned int | ) |
void vtkOpenGLState::vtkglPointSize | ( | float | ) |
void vtkOpenGLState::vtkglLineWidth | ( | float | ) |
void vtkOpenGLState::vtkglStencilMaskSeparate | ( | unsigned int | face, |
unsigned int | mask | ||
) |
void vtkOpenGLState::vtkglStencilMask | ( | unsigned int | mask | ) |
void vtkOpenGLState::vtkglStencilOpSeparate | ( | unsigned int | face, |
unsigned int | sfail, | ||
unsigned int | dpfail, | ||
unsigned int | dppass | ||
) |
void vtkOpenGLState::vtkglStencilOp | ( | unsigned int | sfail, |
unsigned int | dpfail, | ||
unsigned int | dppass | ||
) |
void vtkOpenGLState::vtkglStencilFuncSeparate | ( | unsigned int | face, |
unsigned int | func, | ||
int | ref, | ||
unsigned int | mask | ||
) |
void vtkOpenGLState::vtkglStencilFunc | ( | unsigned int | func, |
int | ref, | ||
unsigned int | mask | ||
) |
void vtkOpenGLState::vtkBindFramebuffer | ( | unsigned int | target, |
vtkOpenGLFramebufferObject * | fo | ||
) |
void vtkOpenGLState::vtkDrawBuffers | ( | unsigned int | n, |
unsigned int * | , | ||
vtkOpenGLFramebufferObject * | |||
) |
void vtkOpenGLState::vtkReadBuffer | ( | unsigned int | , |
vtkOpenGLFramebufferObject * | |||
) |
void vtkOpenGLState::vtkglPixelStorei | ( | unsigned int | , |
int | |||
) |
void vtkOpenGLState::ResetGLClearColorState | ( | ) |
void vtkOpenGLState::ResetGLClearDepthState | ( | ) |
void vtkOpenGLState::ResetGLDepthFuncState | ( | ) |
void vtkOpenGLState::ResetGLDepthMaskState | ( | ) |
void vtkOpenGLState::ResetGLColorMaskState | ( | ) |
void vtkOpenGLState::ResetGLViewportState | ( | ) |
void vtkOpenGLState::ResetGLScissorState | ( | ) |
void vtkOpenGLState::ResetGLBlendFuncState | ( | ) |
void vtkOpenGLState::ResetGLBlendEquationState | ( | ) |
void vtkOpenGLState::ResetGLCullFaceState | ( | ) |
void vtkOpenGLState::ResetGLActiveTexture | ( | ) |
void vtkOpenGLState::vtkglClear | ( | unsigned int | mask | ) |
void vtkOpenGLState::vtkglGetBooleanv | ( | unsigned int | pname, |
unsigned char * | params | ||
) |
void vtkOpenGLState::vtkglGetIntegerv | ( | unsigned int | pname, |
int * | params | ||
) |
void vtkOpenGLState::vtkglGetDoublev | ( | unsigned int | pname, |
double * | params | ||
) |
void vtkOpenGLState::vtkglGetFloatv | ( | unsigned int | pname, |
float * | params | ||
) |
void vtkOpenGLState::GetBlendFuncState | ( | int * | ) |
bool vtkOpenGLState::GetEnumState | ( | unsigned int | name | ) |
void vtkOpenGLState::SetEnumState | ( | unsigned int | name, |
bool | value | ||
) |
void vtkOpenGLState::ResetEnumState | ( | unsigned int | name | ) |
convenience method to reset an enum state from current openGL context
void vtkOpenGLState::ActivateTexture | ( | vtkTextureObject * | ) |
Activate a texture unit for this texture.
void vtkOpenGLState::DeactivateTexture | ( | vtkTextureObject * | ) |
Deactivate a previously activated texture.
int vtkOpenGLState::GetTextureUnitForTexture | ( | vtkTextureObject * | ) |
Get the texture unit for a given texture object.
void vtkOpenGLState::VerifyNoActiveTextures | ( | ) |
Check to make sure no textures have been left active.
|
inline |
Store/Restore the current framebuffer bindings and buffers.
Definition at line 223 of file vtkOpenGLState.h.
void vtkOpenGLState::PushDrawFramebufferBinding | ( | ) |
Store/Restore the current framebuffer bindings and buffers.
void vtkOpenGLState::PushReadFramebufferBinding | ( | ) |
Store/Restore the current framebuffer bindings and buffers.
|
inline |
Store/Restore the current framebuffer bindings and buffers.
Definition at line 231 of file vtkOpenGLState.h.
void vtkOpenGLState::PopDrawFramebufferBinding | ( | ) |
Store/Restore the current framebuffer bindings and buffers.
void vtkOpenGLState::PopReadFramebufferBinding | ( | ) |
Store/Restore the current framebuffer bindings and buffers.
void vtkOpenGLState::ResetFramebufferBindings | ( | ) |
Store/Restore the current framebuffer bindings and buffers.
void vtkOpenGLState::Initialize | ( | vtkOpenGLRenderWindow * | ) |
Initialize OpenGL context using current state.
void vtkOpenGLState::SetTextureUnitManager | ( | vtkTextureUnitManager * | textureUnitManager | ) |
Set the texture unit manager.
vtkTextureUnitManager * vtkOpenGLState::GetTextureUnitManager | ( | ) |
Returns its texture unit manager object.
A new one will be created if one hasn't already been set up.
|
virtual |
|
virtual |
void vtkOpenGLState::SetVBOCache | ( | vtkOpenGLVertexBufferObjectCache * | val | ) |
int vtkOpenGLState::GetDefaultTextureInternalFormat | ( | int | vtktype, |
int | numComponents, | ||
bool | needInteger, | ||
bool | needFloat, | ||
bool | needSRGB | ||
) |
Get a mapping of vtk data types to native texture formats for this window we put this on the RenderWindow so that every texture does not have to build these structures themselves.
void vtkOpenGLState::GetCurrentDrawFramebufferState | ( | unsigned int & | drawBinding, |
unsigned int & | drawBuffer | ||
) |
Get the current stored state of the draw buffer and binding.
void vtkOpenGLState::vtkglBlitFramebuffer | ( | int | , |
int | , | ||
int | , | ||
int | , | ||
int | , | ||
int | , | ||
int | , | ||
int | , | ||
unsigned int | , | ||
unsigned int | |||
) |
Perform a blit but handle some driver bugs safely.
Use this instead of directly calling glBlitFrambuffer.
void vtkOpenGLState::Reset | ( | ) |
Record the OpenGL state into this class.
Lots of get calls so probably a pipeline stall. This method is most useful when integrating VTK with something else that touches OpenGL such as a GUI library or external OpenGL code. As OpenGL has a lot of state it is easy for VTK and external libraries to interfere with each other by changing that state. When extrnal code is calling VTK you would typically call Reset() Push() Pop() Reset will record the current state from OpenGL. Push saves it on the stack. Pop pops it from the stack and reapplies it to OpenGL so that the state is the same as when Pushed. Note that OpenGL has an incredible amount of state. This class only handles the values that VTK is known to touch. If you find other values that need saving please feel free to report an issue or provide an MR.
void vtkOpenGLState::Push | ( | ) |
Push all the recorded state onto the stack.
Typically called after a Reset. Not generally used internally in VTK as it is rarely required to save more than a couple state settings within VTKs render process.
void vtkOpenGLState::Pop | ( | ) |
Pop the state stack to restore a previous state.
At the end of this method OpenGL state will be set to the new popped state.
|
inline |
Return the opengl version for this context.
Definition at line 387 of file vtkOpenGLState.h.
|
inline |
Return the opengl vendor for this context.
Definition at line 392 of file vtkOpenGLState.h.
|
inline |
Return the opengl renderer for this context.
Note this is the renderer opengl property, not a vtk renderer.
Definition at line 398 of file vtkOpenGLState.h.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Check that this OpenGL state has consistent values with the current OpenGL context.
|
protected |
Definition at line 410 of file vtkOpenGLState.h.
|
protected |
Definition at line 413 of file vtkOpenGLState.h.
|
protected |
Definition at line 414 of file vtkOpenGLState.h.
|
protected |
Definition at line 436 of file vtkOpenGLState.h.
|
protected |
Definition at line 437 of file vtkOpenGLState.h.
|
protected |
Definition at line 440 of file vtkOpenGLState.h.
|
protected |
Definition at line 441 of file vtkOpenGLState.h.
|
protected |
Definition at line 442 of file vtkOpenGLState.h.
|
protected |
Definition at line 443 of file vtkOpenGLState.h.
|
protected |
Definition at line 444 of file vtkOpenGLState.h.
|
protected |
Definition at line 445 of file vtkOpenGLState.h.
|
protected |
Definition at line 494 of file vtkOpenGLState.h.
|
protected |
Definition at line 496 of file vtkOpenGLState.h.
|
protected |
Definition at line 497 of file vtkOpenGLState.h.