51 #ifndef vtkOpenGLState_h
52 #define vtkOpenGLState_h
55 #include "vtkRenderingOpenGL2Module.h"
63 VTK_ABI_NAMESPACE_BEGIN
85 void vtkglClearColor(
float red,
float green,
float blue,
float alpha);
86 void vtkglClearDepth(
double depth);
87 void vtkglDepthFunc(
unsigned int val);
88 void vtkglDepthMask(
unsigned char flag);
89 void vtkglColorMask(
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a);
90 void vtkglViewport(
int x,
int y,
int width,
int height);
91 void vtkglScissor(
int x,
int y,
int width,
int height);
92 void vtkglEnable(
unsigned int cap);
93 void vtkglDisable(
unsigned int cap);
96 this->vtkglBlendFuncSeparate(sfactor, dfactor, sfactor, dfactor);
98 void vtkglBlendFuncSeparate(
unsigned int sfactorRGB,
unsigned int dfactorRGB,
99 unsigned int sfactorAlpha,
unsigned int dfactorAlpha);
100 void vtkglBlendEquation(
unsigned int val);
101 void vtkglBlendEquationSeparate(
unsigned int col,
unsigned int alpha);
102 void vtkglCullFace(
unsigned int val);
103 void vtkglActiveTexture(
unsigned int);
105 void vtkglBindFramebuffer(
unsigned int target,
unsigned int fb);
106 void vtkglDrawBuffer(
unsigned int);
107 void vtkglDrawBuffers(
unsigned int n,
unsigned int*);
108 void vtkglReadBuffer(
unsigned int);
110 void vtkglPointSize(
float);
111 void vtkglLineWidth(
float);
112 void vtkglStencilMaskSeparate(
unsigned int face,
unsigned int mask);
113 void vtkglStencilMask(
unsigned int mask);
114 void vtkglStencilOpSeparate(
115 unsigned int face,
unsigned int sfail,
unsigned int dpfail,
unsigned int dppass);
116 void vtkglStencilOp(
unsigned int sfail,
unsigned int dpfail,
unsigned int dppass);
117 void vtkglStencilFuncSeparate(
unsigned int face,
unsigned int func,
int ref,
unsigned int mask);
118 void vtkglStencilFunc(
unsigned int func,
int ref,
unsigned int mask);
124 void vtkglPixelStorei(
unsigned int,
int);
132 void ResetGLClearColorState();
133 void ResetGLClearDepthState();
134 void ResetGLDepthFuncState();
135 void ResetGLDepthMaskState();
136 void ResetGLColorMaskState();
137 void ResetGLViewportState();
138 void ResetGLScissorState();
139 void ResetGLBlendFuncState();
140 void ResetGLBlendEquationState();
141 void ResetGLCullFaceState();
142 void ResetGLActiveTexture();
148 void vtkglClear(
unsigned int mask);
154 void vtkglGetBooleanv(
unsigned int pname,
unsigned char* params);
155 void vtkglGetIntegerv(
unsigned int pname,
int* params);
156 void vtkglGetDoublev(
unsigned int pname,
double* params);
157 void vtkglGetFloatv(
unsigned int pname,
float* params);
161 void GetBlendFuncState(
int*);
165 bool GetEnumState(
unsigned int name);
168 void SetEnumState(
unsigned int name,
bool value);
173 void ResetEnumState(
unsigned int name);
176 template <
typename T>
182 ((*this->State).*(this->Method))(this->Value);
209 void VerifyNoActiveTextures();
217 this->PushDrawFramebufferBinding();
218 this->PushReadFramebufferBinding();
220 void PushDrawFramebufferBinding();
221 void PushReadFramebufferBinding();
225 this->PopReadFramebufferBinding();
226 this->PopDrawFramebufferBinding();
228 void PopDrawFramebufferBinding();
229 void PopReadFramebufferBinding();
231 void ResetFramebufferBindings();
286 this->State->vtkglGetBooleanv(name, &val);
287 this->Value = val == 1;
291 this->State->SetEnumState(this->Name, this->Value);
343 int vtktype,
int numComponents,
bool needInteger,
bool needFloat,
bool needSRGB);
423 void ColorMask(std::array<unsigned char, 4> val);
424 void Scissor(std::array<int, 4> val);
425 void Viewport(std::array<int, 4> val);
428 bool SupportsTextureNorm16 =
false;
450 unsigned int DrawBuffers[10];
451 unsigned int GetBinding();
452 unsigned int GetDrawBuffer(
unsigned int);
453 unsigned int GetReadBuffer();
525 VTK_ABI_NAMESPACE_END
void vtkglBlitFramebuffer(int, int, int, int, int, int, int, int, unsigned int, unsigned int)
Perform a blit but handle some driver bugs safely.
std::array< int, 4 > Viewport
abstract base class for most VTK objects
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
BufferBindingState DrawBinding
void ColorMask(std::array< unsigned char, 4 > val)
void Push()
Push all the recorded state onto the stack.
std::array< float, 4 > ClearColor
vtkSmartPointer< vtkOpenGLArrayTextureBufferCache > GetArrayTextureBufferCache()
Set/Get the array texture buffer cache to use for this state.
manage Shader Programs within a context
std::map< const vtkTextureObject *, int > TextureResourceIds
std::array< unsigned int, 3 > StencilOpFront
int BoundElementArrayBuffer
std::array< unsigned int, 3 > StencilFuncBack
void PushFramebufferBindings()
Store/Restore the current framebuffer bindings and buffers.
manage vertex buffer objects shared within a context
bool SupportsTextureNorm16
vtkOpenGLVertexBufferObjectCache * VBOCache
std::array< unsigned int, 3 > StencilOpBack
std::array< unsigned char, 4 > ColorMask
std::array< int, 4 > Scissor
void vtkglBlendFunc(unsigned int sfactor, unsigned int dfactor)
GPU-based texture normalization for GLES 3.0 without GL_EXT_texture_norm16.
unsigned int ActiveTexture
unsigned int CullFaceMode
void Viewport(std::array< int, 4 > val)
~vtkOpenGLState() override
void InitializeTextureInternalFormats()
unsigned int BlendEquationValue2
unsigned int BlendEquationValue1
vtkSmartPointer< vtkOpenGLArrayTextureBufferCache > ArrayTextureBufferCache
void BlendFuncSeparate(std::array< unsigned int, 4 > val)
std::list< BufferBindingState > ReadBindings
BufferBindingState ReadBinding
void PopFramebufferBindings()
Store/Restore the current framebuffer bindings and buffers.
manage texture-buffer-backed data arrays shared within a context
a simple class to control print indentation
unsigned int StencilMaskBack
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void CheckState()
Check that this OpenGL state has consistent values with the current OpenGL context.
std::stack< GLState > Stack
vtkOpenGLTextureNormalizationHelper * GetTextureNormalizationHelper()
Get the texture normalization helper for GLES 3.0 without norm16 extension.
void SetArrayTextureBufferCache(vtkOpenGLArrayTextureBufferCache *cache)
Set/Get the array texture buffer cache to use for this state.
ScopedglEnableDisable(vtkOpenGLState *state, unsigned int name)
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 RenderWi...
vtkTextureUnitManager * GetTextureUnitManager()
Returns its texture unit manager object.
void Pop()
Pop the state stack to restore a previous state.
std::string const & GetVersion()
Return the opengl version for this context.
Internal class which encapsulates OpenGL FramebufferObject.
vtkOpenGLShaderCache * ShaderCache
std::list< BufferBindingState > DrawBindings
allocate/free texture units.
abstracts an OpenGL texture object.
unsigned int StencilMaskFront
std::array< unsigned int, 4 > BlendFunc
std::array< unsigned int, 3 > StencilFuncFront
void SetVBOCache(vtkOpenGLVertexBufferObjectCache *val)
void GetCurrentDrawFramebufferState(unsigned int &drawBinding, unsigned int &drawBuffer)
Get the current stored state of the draw buffer and binding.
void Reset()
Record the OpenGL state into this class.
std::string const & GetRenderer()
Return the opengl renderer for this context.
vtkTextureUnitManager * TextureUnitManager
vtkOpenGLTextureNormalizationHelper * TextureNormalizationHelper
void Scissor(std::array< int, 4 > val)
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
bool GetSupportsTextureNorm16()
Return whether GL_R16 normalized formats are available for VTK_UNSIGNED_SHORT data.
void SetTextureUnitManager(vtkTextureUnitManager *textureUnitManager)
Set the texture unit manager.
void ClearColor(std::array< float, 4 > val)
std::string const & GetVendor()
Return the opengl vendor for this context.
void Initialize(vtkOpenGLRenderWindow *)
Initialize OpenGL context using current state.