15 #ifndef vtkVolumeStateRAII_h 16 #define vtkVolumeStateRAII_h 17 #include "vtkOpenGLRenderWindow.h" 33 this->DepthTestEnabled = (glIsEnabled(GL_DEPTH_TEST) != GL_FALSE);
35 this->BlendEnabled = (glIsEnabled(GL_BLEND) != GL_FALSE);
37 this->CullFaceEnabled = (glIsEnabled(GL_CULL_FACE) != GL_FALSE);
38 glGetIntegerv(GL_CULL_FACE_MODE, &this->CullFaceMode);
40 GLboolean depthMaskWrite = GL_TRUE;
41 glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMaskWrite);
42 this->DepthMaskEnabled = (depthMaskWrite == GL_TRUE);
45 if (!this->DepthTestEnabled)
47 glEnable(GL_DEPTH_TEST);
53 glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
55 if (!this->BlendEnabled)
61 if (this->CullFaceMode != GL_BACK)
66 if (!this->CullFaceEnabled)
68 glEnable(GL_CULL_FACE);
72 if (this->DepthMaskEnabled)
74 glDepthMask(GL_FALSE);
86 glBindBuffer(GL_ARRAY_BUFFER, 0);
87 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
94 glCullFace(this->CullFaceMode);
95 if (!this->CullFaceEnabled)
97 glDisable(GL_CULL_FACE);
100 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
102 if (!this->BlendEnabled)
107 if (!this->DepthTestEnabled)
109 glDisable(GL_DEPTH_TEST);
112 if (this->DepthMaskEnabled)
114 glDepthMask(GL_TRUE);
120 bool DepthTestEnabled;
122 bool CullFaceEnabled;
124 bool DepthMaskEnabled;
127 #endif // vtkVolumeStateRAII_h
vtkVolumeStateRAII(bool noOp=false)
static bool GetContextSupportsOpenGL32()
Get if the context includes opengl core profile 3.2 support.