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

Method ReadyVCBOProgram

Rendering/ContextOpenGL2/vtkOpenGLContextDevice3D.cxx:210–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210void vtkOpenGLContextDevice3D::ReadyVCBOProgram()
211{
212 if (!this->VCBO->Program)
213 {
214 this->VCBO->Program = this->RenderWindow->GetShaderCache()->ReadyShaderProgram(
215 // vertex shader
216 "//VTK::System::Dec\n"
217 "in vec3 vertexMC;\n"
218 "in vec4 vertexScalar;\n"
219 "uniform mat4 WCDCMatrix;\n"
220 "uniform mat4 MCWCMatrix;\n"
221 "out vec4 vertexColor;\n"
222 "uniform int hasOpacity;\n"
223 "uniform int numClipPlanes;\n"
224 "uniform vec4 clipPlanes[6];\n"
225 "out float clipDistances[6];\n"
226 "void main() {\n"
227 "vec4 vertex = vec4(vertexMC.xyz, 1.0);\n"
228 "vertexColor = vertexScalar;\n"
229 "for (int planeNum = 0; planeNum < numClipPlanes; planeNum++)\n"
230 " {\n"
231 " clipDistances[planeNum] = dot(clipPlanes[planeNum], vertex*MCWCMatrix);\n"
232 " }\n"
233 "gl_Position = vertex*MCWCMatrix*WCDCMatrix; \n"
234 "if (hasOpacity == 0) { vertexColor.a = 1.0f; }\n"
235 "}\n",
236 // fragment shader
237 "//VTK::System::Dec\n"
238 "//VTK::Output::Dec\n"
239 "in vec4 vertexColor;\n"
240 "uniform int numClipPlanes;\n"
241 "in float clipDistances[6];\n"
242 "void main() { \n"
243 " for (int planeNum = 0; planeNum < numClipPlanes; planeNum++)\n"
244 " {\n"
245 " if (clipDistances[planeNum] < 0.0) discard;\n"
246 " }\n"
247 " gl_FragData[0] = vertexColor; }",
248 // geometry shader
249 "");
250 }
251 else
252 {
253 this->RenderWindow->GetShaderCache()->ReadyShaderProgram(this->VCBO->Program);
254 }
255}
256
257bool vtkOpenGLContextDevice3D::HaveWideLines()
258{

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