16 #ifndef vtkVolumeStateRAII_h
17 #define vtkVolumeStateRAII_h
27 this->DepthTestEnabled = (glIsEnabled(GL_DEPTH_TEST) != GL_FALSE);
29 this->BlendEnabled = (glIsEnabled(GL_BLEND) != GL_FALSE);
31 this->CullFaceEnabled = (glIsEnabled(GL_CULL_FACE) != GL_FALSE);
32 glGetIntegerv(GL_CULL_FACE_MODE, &this->CullFaceMode);
34 GLboolean depthMaskWrite = GL_TRUE;
35 glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMaskWrite);
36 this->DepthMaskEnabled = (depthMaskWrite == GL_TRUE);
39 if (!this->DepthTestEnabled)
41 glEnable(GL_DEPTH_TEST);
47 glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
49 if (!this->BlendEnabled)
55 if (this->CullFaceMode != GL_BACK)
60 if (!this->CullFaceEnabled)
62 glEnable(GL_CULL_FACE);
66 if (this->DepthMaskEnabled)
68 glDepthMask(GL_FALSE);
80 glBindBuffer(GL_ARRAY_BUFFER, 0);
81 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
83 glCullFace(this->CullFaceMode);
84 if (!this->CullFaceEnabled)
86 glDisable(GL_CULL_FACE);
89 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
91 if (!this->BlendEnabled)
96 if (!this->DepthTestEnabled)
98 glDisable(GL_DEPTH_TEST);
101 if (this->DepthMaskEnabled)
103 glDepthMask(GL_TRUE);
108 bool DepthTestEnabled;
110 bool CullFaceEnabled;
112 bool DepthMaskEnabled;
115 #endif // vtkVolumeStateRAII_h
static bool GetContextSupportsOpenGL32()
Get if the context includes opengl core profile 3.2 support.