MCPcopy Create free account
hub / github.com/Kitware/VTK / ReadyVBOProgram

Method ReadyVBOProgram

Rendering/ContextOpenGL2/vtkOpenGLContextDevice3D.cxx:169–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void vtkOpenGLContextDevice3D::ReadyVBOProgram()
170{
171 if (!this->VBO->Program)
172 {
173 this->VBO->Program = this->RenderWindow->GetShaderCache()->ReadyShaderProgram(
174 // vertex shader
175 "//VTK::System::Dec\n"
176 "in vec3 vertexMC;\n"
177 "uniform mat4 WCDCMatrix;\n"
178 "uniform mat4 MCWCMatrix;\n"
179 "uniform int numClipPlanes;\n"
180 "uniform vec4 clipPlanes[6];\n"
181 "out float clipDistances[6];\n"
182 "void main() {\n"
183 "vec4 vertex = vec4(vertexMC.xyz, 1.0);\n"
184 "for (int planeNum = 0; planeNum < numClipPlanes; planeNum++)\n"
185 " {\n"
186 " clipDistances[planeNum] = dot(clipPlanes[planeNum], vertex*MCWCMatrix);\n"
187 " }\n"
188 "gl_Position = vertex*MCWCMatrix*WCDCMatrix; }\n",
189 // fragment shader
190 "//VTK::System::Dec\n"
191 "//VTK::Output::Dec\n"
192 "uniform vec4 vertexColor;\n"
193 "uniform int numClipPlanes;\n"
194 "in float clipDistances[6];\n"
195 "void main() { \n"
196 " for (int planeNum = 0; planeNum < numClipPlanes; planeNum++)\n"
197 " {\n"
198 " if (clipDistances[planeNum] < 0.0) discard;\n"
199 " }\n"
200 " gl_FragData[0] = vertexColor; }",
201 // geometry shader
202 "");
203 }
204 else
205 {
206 this->RenderWindow->GetShaderCache()->ReadyShaderProgram(this->VBO->Program);
207 }
208}
209
210void vtkOpenGLContextDevice3D::ReadyVCBOProgram()
211{

Callers 4

DrawPolyMethod · 0.95
DrawLinesMethod · 0.95
DrawPointsMethod · 0.95
DrawTriangleMeshMethod · 0.95

Calls 2

GetShaderCacheMethod · 0.80
ReadyShaderProgramMethod · 0.45

Tested by

no test coverage detected