VTK  9.1.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkOpenGLState Class Reference

OpenGL state storage. More...

#include <vtkOpenGLState.h>

Inheritance diagram for vtkOpenGLState:
[legend]
Collaboration diagram for vtkOpenGLState:
[legend]

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. More...
 
vtkOpenGLStateNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
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 ActivateTexture (vtkTextureObject *)
 Activate a texture unit for this texture. More...
 
void DeactivateTexture (vtkTextureObject *)
 Deactivate a previously activated texture. More...
 
int GetTextureUnitForTexture (vtkTextureObject *)
 Get the texture unit for a given texture object. More...
 
void VerifyNoActiveTextures ()
 Check to make sure no textures have been left active. More...
 
void Initialize (vtkOpenGLRenderWindow *)
 Initialize OpenGL context using current state. More...
 
void SetTextureUnitManager (vtkTextureUnitManager *textureUnitManager)
 Set the texture unit manager. More...
 
vtkTextureUnitManagerGetTextureUnitManager ()
 Returns its texture unit manager object. More...
 
virtual vtkOpenGLShaderCacheGetShaderCache ()
 
virtual vtkOpenGLVertexBufferObjectCacheGetVBOCache ()
 
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. More...
 
void GetCurrentDrawFramebufferState (unsigned int &drawBinding, unsigned int &drawBuffer)
 Get the current stored state of the draw buffer and binding. More...
 
void vtkglBlitFramebuffer (int, int, int, int, int, int, int, int, unsigned int, unsigned int)
 Perform a blit but handle some driver bugs safely. More...
 
void Reset ()
 Record the OpenGL state into this class. More...
 
void Push ()
 Push all the recorded state onto the stack. More...
 
void Pop ()
 Pop the state stack to restore a previous state. More...
 
std::string const & GetVersion ()
 Return the opengl version for this context. More...
 
std::string const & GetVendor ()
 Return the opengl vendor for this context. More...
 
std::string const & GetRenderer ()
 Return the opengl renderer for this context. 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 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. More...
 
void PushDrawFramebufferBinding ()
 Store/Restore the current framebuffer bindings and buffers. More...
 
void PushReadFramebufferBinding ()
 Store/Restore the current framebuffer bindings and buffers. More...
 
void PopFramebufferBindings ()
 Store/Restore the current framebuffer bindings and buffers. More...
 
void PopDrawFramebufferBinding ()
 Store/Restore the current framebuffer bindings and buffers. More...
 
void PopReadFramebufferBinding ()
 Store/Restore the current framebuffer bindings and buffers. More...
 
void ResetFramebufferBindings ()
 Store/Restore the current framebuffer bindings and buffers. More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on. More...
 
virtual void DebugOff ()
 Turn debugging output off. More...
 
bool GetDebug ()
 Get the value of the debug flag. More...
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag. More...
 
virtual void Modified ()
 Update the modification time for this object. More...
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time. More...
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
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. More...
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkCommandGetCommand (unsigned long tag)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObserver (vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObservers (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObservers (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
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. More...
 
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. More...
 
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. More...
 
int InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
int InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string. More...
 
virtual vtkTypeBool IsA (const char *name)
 Return 1 if this class is the same type of (or a subclass of) the named class. More...
 
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). More...
 
virtual void Delete ()
 Delete a VTK object. More...
 
virtual void FastDelete ()
 Delete a reference to this object. More...
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream. More...
 
virtual void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object). More...
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object). More...
 
int GetReferenceCount ()
 Return the current reference count of this object. More...
 
void SetReferenceCount (int)
 Sets the reference count. More...
 
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space. More...
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses. More...
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses. More...
 

Static Public Member Functions

static vtkOpenGLStateNew ()
 
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkOpenGLStateSafeDownCast (vtkObjectBase *o)
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes. More...
 
static void SetGlobalWarningDisplay (int val)
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOn ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOff ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static int GetGlobalWarningDisplay ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
- 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. More...
 
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). More...
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within. More...
 
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. More...
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () 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. More...
 
- 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. More...
 
void InternalReleaseFocus ()
 These methods allow a command to exclusively grab all events. More...
 
- 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]
 
vtkTextureUnitManagerTextureUnitManager
 
std::map< const vtkTextureObject *, int > TextureResourceIds
 
std::list< BufferBindingStateDrawBindings
 
std::list< BufferBindingStateReadBindings
 
int MajorVersion
 
int MinorVersion
 
int MaxTextureSize
 
std::string Vendor
 
std::string Renderer
 
std::string Version
 
std::stack< GLStateStack
 
vtkOpenGLVertexBufferObjectCacheVBOCache
 
vtkOpenGLShaderCacheShaderCache
 
- 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 ()
 

Detailed Description

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.

Member Typedef Documentation

◆ Superclass

Definition at line 85 of file vtkOpenGLState.h.

Constructor & Destructor Documentation

◆ vtkOpenGLState()

vtkOpenGLState::vtkOpenGLState ( )
protected

◆ ~vtkOpenGLState()

vtkOpenGLState::~vtkOpenGLState ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkOpenGLState * vtkOpenGLState::New ( )
static

◆ IsTypeOf()

static vtkTypeBool vtkOpenGLState::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool vtkOpenGLState::IsA ( const char *  name)
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.

◆ SafeDownCast()

static vtkOpenGLState * vtkOpenGLState::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkOpenGLState::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkOpenGLState * vtkOpenGLState::NewInstance ( ) const

◆ PrintSelf()

void vtkOpenGLState::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Methods invoked by print to print information about the object including superclasses.

Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

◆ vtkglClearColor()

void vtkOpenGLState::vtkglClearColor ( float  red,
float  green,
float  blue,
float  alpha 
)

◆ vtkglClearDepth()

void vtkOpenGLState::vtkglClearDepth ( double  depth)

◆ vtkglDepthFunc()

void vtkOpenGLState::vtkglDepthFunc ( unsigned int  val)

◆ vtkglDepthMask()

void vtkOpenGLState::vtkglDepthMask ( unsigned char  flag)

◆ vtkglColorMask()

void vtkOpenGLState::vtkglColorMask ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)

◆ vtkglViewport()

void vtkOpenGLState::vtkglViewport ( int  x,
int  y,
int  width,
int  height 
)

◆ vtkglScissor()

void vtkOpenGLState::vtkglScissor ( int  x,
int  y,
int  width,
int  height 
)

◆ vtkglEnable()

void vtkOpenGLState::vtkglEnable ( unsigned int  cap)

◆ vtkglDisable()

void vtkOpenGLState::vtkglDisable ( unsigned int  cap)

◆ vtkglBlendFunc()

void vtkOpenGLState::vtkglBlendFunc ( unsigned int  sfactor,
unsigned int  dfactor 
)
inline

Definition at line 102 of file vtkOpenGLState.h.

◆ vtkglBlendFuncSeparate()

void vtkOpenGLState::vtkglBlendFuncSeparate ( unsigned int  sfactorRGB,
unsigned int  dfactorRGB,
unsigned int  sfactorAlpha,
unsigned int  dfactorAlpha 
)

◆ vtkglBlendEquation()

void vtkOpenGLState::vtkglBlendEquation ( unsigned int  val)

◆ vtkglBlendEquationSeparate()

void vtkOpenGLState::vtkglBlendEquationSeparate ( unsigned int  col,
unsigned int  alpha 
)

◆ vtkglCullFace()

void vtkOpenGLState::vtkglCullFace ( unsigned int  val)

◆ vtkglActiveTexture()

void vtkOpenGLState::vtkglActiveTexture ( unsigned int  )

◆ vtkglBindFramebuffer()

void vtkOpenGLState::vtkglBindFramebuffer ( unsigned int  target,
unsigned int  fb 
)

◆ vtkglDrawBuffer()

void vtkOpenGLState::vtkglDrawBuffer ( unsigned int  )

◆ vtkglDrawBuffers()

void vtkOpenGLState::vtkglDrawBuffers ( unsigned int  n,
unsigned int *   
)

◆ vtkglReadBuffer()

void vtkOpenGLState::vtkglReadBuffer ( unsigned int  )

◆ vtkglPointSize()

void vtkOpenGLState::vtkglPointSize ( float  )

◆ vtkglLineWidth()

void vtkOpenGLState::vtkglLineWidth ( float  )

◆ vtkglStencilMaskSeparate()

void vtkOpenGLState::vtkglStencilMaskSeparate ( unsigned int  face,
unsigned int  mask 
)

◆ vtkglStencilMask()

void vtkOpenGLState::vtkglStencilMask ( unsigned int  mask)

◆ vtkglStencilOpSeparate()

void vtkOpenGLState::vtkglStencilOpSeparate ( unsigned int  face,
unsigned int  sfail,
unsigned int  dpfail,
unsigned int  dppass 
)

◆ vtkglStencilOp()

void vtkOpenGLState::vtkglStencilOp ( unsigned int  sfail,
unsigned int  dpfail,
unsigned int  dppass 
)

◆ vtkglStencilFuncSeparate()

void vtkOpenGLState::vtkglStencilFuncSeparate ( unsigned int  face,
unsigned int  func,
int  ref,
unsigned int  mask 
)

◆ vtkglStencilFunc()

void vtkOpenGLState::vtkglStencilFunc ( unsigned int  func,
int  ref,
unsigned int  mask 
)

◆ vtkBindFramebuffer()

void vtkOpenGLState::vtkBindFramebuffer ( unsigned int  target,
vtkOpenGLFramebufferObject fo 
)

◆ vtkDrawBuffers()

void vtkOpenGLState::vtkDrawBuffers ( unsigned int  n,
unsigned int *  ,
vtkOpenGLFramebufferObject  
)

◆ vtkReadBuffer()

void vtkOpenGLState::vtkReadBuffer ( unsigned int  ,
vtkOpenGLFramebufferObject  
)

◆ vtkglPixelStorei()

void vtkOpenGLState::vtkglPixelStorei ( unsigned int  ,
int   
)

◆ ResetGLClearColorState()

void vtkOpenGLState::ResetGLClearColorState ( )

◆ ResetGLClearDepthState()

void vtkOpenGLState::ResetGLClearDepthState ( )

◆ ResetGLDepthFuncState()

void vtkOpenGLState::ResetGLDepthFuncState ( )

◆ ResetGLDepthMaskState()

void vtkOpenGLState::ResetGLDepthMaskState ( )

◆ ResetGLColorMaskState()

void vtkOpenGLState::ResetGLColorMaskState ( )

◆ ResetGLViewportState()

void vtkOpenGLState::ResetGLViewportState ( )

◆ ResetGLScissorState()

void vtkOpenGLState::ResetGLScissorState ( )

◆ ResetGLBlendFuncState()

void vtkOpenGLState::ResetGLBlendFuncState ( )

◆ ResetGLBlendEquationState()

void vtkOpenGLState::ResetGLBlendEquationState ( )

◆ ResetGLCullFaceState()

void vtkOpenGLState::ResetGLCullFaceState ( )

◆ ResetGLActiveTexture()

void vtkOpenGLState::ResetGLActiveTexture ( )

◆ vtkglClear()

void vtkOpenGLState::vtkglClear ( unsigned int  mask)

◆ vtkglGetBooleanv()

void vtkOpenGLState::vtkglGetBooleanv ( unsigned int  pname,
unsigned char *  params 
)

◆ vtkglGetIntegerv()

void vtkOpenGLState::vtkglGetIntegerv ( unsigned int  pname,
int *  params 
)

◆ vtkglGetDoublev()

void vtkOpenGLState::vtkglGetDoublev ( unsigned int  pname,
double *  params 
)

◆ vtkglGetFloatv()

void vtkOpenGLState::vtkglGetFloatv ( unsigned int  pname,
float *  params 
)

◆ GetBlendFuncState()

void vtkOpenGLState::GetBlendFuncState ( int *  )

◆ GetEnumState()

bool vtkOpenGLState::GetEnumState ( unsigned int  name)

◆ SetEnumState()

void vtkOpenGLState::SetEnumState ( unsigned int  name,
bool  value 
)

◆ ResetEnumState()

void vtkOpenGLState::ResetEnumState ( unsigned int  name)

convenience method to reset an enum state from current openGL context

◆ ActivateTexture()

void vtkOpenGLState::ActivateTexture ( vtkTextureObject )

Activate a texture unit for this texture.

◆ DeactivateTexture()

void vtkOpenGLState::DeactivateTexture ( vtkTextureObject )

Deactivate a previously activated texture.

◆ GetTextureUnitForTexture()

int vtkOpenGLState::GetTextureUnitForTexture ( vtkTextureObject )

Get the texture unit for a given texture object.

◆ VerifyNoActiveTextures()

void vtkOpenGLState::VerifyNoActiveTextures ( )

Check to make sure no textures have been left active.

◆ PushFramebufferBindings()

void vtkOpenGLState::PushFramebufferBindings ( )
inline

Store/Restore the current framebuffer bindings and buffers.

Definition at line 223 of file vtkOpenGLState.h.

◆ PushDrawFramebufferBinding()

void vtkOpenGLState::PushDrawFramebufferBinding ( )

Store/Restore the current framebuffer bindings and buffers.

◆ PushReadFramebufferBinding()

void vtkOpenGLState::PushReadFramebufferBinding ( )

Store/Restore the current framebuffer bindings and buffers.

◆ PopFramebufferBindings()

void vtkOpenGLState::PopFramebufferBindings ( )
inline

Store/Restore the current framebuffer bindings and buffers.

Definition at line 231 of file vtkOpenGLState.h.

◆ PopDrawFramebufferBinding()

void vtkOpenGLState::PopDrawFramebufferBinding ( )

Store/Restore the current framebuffer bindings and buffers.

◆ PopReadFramebufferBinding()

void vtkOpenGLState::PopReadFramebufferBinding ( )

Store/Restore the current framebuffer bindings and buffers.

◆ ResetFramebufferBindings()

void vtkOpenGLState::ResetFramebufferBindings ( )

Store/Restore the current framebuffer bindings and buffers.

◆ Initialize()

void vtkOpenGLState::Initialize ( vtkOpenGLRenderWindow )

Initialize OpenGL context using current state.

◆ SetTextureUnitManager()

void vtkOpenGLState::SetTextureUnitManager ( vtkTextureUnitManager textureUnitManager)

Set the texture unit manager.

◆ GetTextureUnitManager()

vtkTextureUnitManager * vtkOpenGLState::GetTextureUnitManager ( )

Returns its texture unit manager object.

A new one will be created if one hasn't already been set up.

◆ GetShaderCache()

virtual vtkOpenGLShaderCache * vtkOpenGLState::GetShaderCache ( )
virtual

◆ GetVBOCache()

virtual vtkOpenGLVertexBufferObjectCache * vtkOpenGLState::GetVBOCache ( )
virtual

◆ SetVBOCache()

void vtkOpenGLState::SetVBOCache ( vtkOpenGLVertexBufferObjectCache val)

◆ GetDefaultTextureInternalFormat()

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.

◆ GetCurrentDrawFramebufferState()

void vtkOpenGLState::GetCurrentDrawFramebufferState ( unsigned int &  drawBinding,
unsigned int &  drawBuffer 
)

Get the current stored state of the draw buffer and binding.

◆ vtkglBlitFramebuffer()

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.

◆ Reset()

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.

◆ Push()

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.

◆ Pop()

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.

◆ GetVersion()

std::string const & vtkOpenGLState::GetVersion ( )
inline

Return the opengl version for this context.

Definition at line 387 of file vtkOpenGLState.h.

◆ GetVendor()

std::string const & vtkOpenGLState::GetVendor ( )
inline

Return the opengl vendor for this context.

Definition at line 392 of file vtkOpenGLState.h.

◆ GetRenderer()

std::string const & vtkOpenGLState::GetRenderer ( )
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.

◆ BlendFuncSeparate()

void vtkOpenGLState::BlendFuncSeparate ( std::array< unsigned int, 4 >  val)
protected

◆ ClearColor()

void vtkOpenGLState::ClearColor ( std::array< float, 4 >  val)
protected

◆ ColorMask()

void vtkOpenGLState::ColorMask ( std::array< unsigned char, 4 >  val)
protected

◆ Scissor()

void vtkOpenGLState::Scissor ( std::array< int, 4 >  val)
protected

◆ Viewport()

void vtkOpenGLState::Viewport ( std::array< int, 4 >  val)
protected

◆ InitializeTextureInternalFormats()

void vtkOpenGLState::InitializeTextureInternalFormats ( )
protected

◆ CheckState()

void vtkOpenGLState::CheckState ( )
protected

Check that this OpenGL state has consistent values with the current OpenGL context.

Member Data Documentation

◆ TextureInternalFormats

int vtkOpenGLState::TextureInternalFormats[VTK_UNICODE_STRING][3][5]
protected

Definition at line 410 of file vtkOpenGLState.h.

◆ TextureUnitManager

vtkTextureUnitManager* vtkOpenGLState::TextureUnitManager
protected

Definition at line 413 of file vtkOpenGLState.h.

◆ TextureResourceIds

std::map<const vtkTextureObject*, int> vtkOpenGLState::TextureResourceIds
protected

Definition at line 414 of file vtkOpenGLState.h.

◆ DrawBindings

std::list<BufferBindingState> vtkOpenGLState::DrawBindings
protected

Definition at line 436 of file vtkOpenGLState.h.

◆ ReadBindings

std::list<BufferBindingState> vtkOpenGLState::ReadBindings
protected

Definition at line 437 of file vtkOpenGLState.h.

◆ MajorVersion

int vtkOpenGLState::MajorVersion
protected

Definition at line 440 of file vtkOpenGLState.h.

◆ MinorVersion

int vtkOpenGLState::MinorVersion
protected

Definition at line 441 of file vtkOpenGLState.h.

◆ MaxTextureSize

int vtkOpenGLState::MaxTextureSize
protected

Definition at line 442 of file vtkOpenGLState.h.

◆ Vendor

std::string vtkOpenGLState::Vendor
protected

Definition at line 443 of file vtkOpenGLState.h.

◆ Renderer

std::string vtkOpenGLState::Renderer
protected

Definition at line 444 of file vtkOpenGLState.h.

◆ Version

std::string vtkOpenGLState::Version
protected

Definition at line 445 of file vtkOpenGLState.h.

◆ Stack

std::stack<GLState> vtkOpenGLState::Stack
protected

Definition at line 494 of file vtkOpenGLState.h.

◆ VBOCache

vtkOpenGLVertexBufferObjectCache* vtkOpenGLState::VBOCache
protected

Definition at line 496 of file vtkOpenGLState.h.

◆ ShaderCache

vtkOpenGLShaderCache* vtkOpenGLState::ShaderCache
protected

Definition at line 497 of file vtkOpenGLState.h.


The documentation for this class was generated from the following file: