VTK 7.0 (python) - vtkGlyph3DMapper.AddClippingPlane() causing shader error
Issue Overview
When attaching a clipping plane to a vtkGlyph3DMapper object an error is thrown due to what I believe to be inconsistent variable naming once the shader is constructed.
Suspected Cause
A variable in the // clipping plane vars
section of the shader is initialized as clipDistancesVSOutput[6]
, but used under the name clipDistances
.
I believe the piece of code that contributes this portion of the shader is found in vtkOpenGLGlyph3DHelper.cxx
The error that's produced:
ERROR: In C:\miniconda\1\x64\conda-bld\work\VTK-7.0.0\Rendering\OpenGL2\vtkShaderProgram.cxx, line 354
vtkShaderProgram (000000E1C19B7220): 1: #version 150
2: #define attribute in
3: #define varying out
4: #define highp
5: #define mediump
6: #define lowp
7:
8: /*=========================================================================
9:
10: Program: Visualization Toolkit
11: Module: vtkGlyph3DVS.glsl
12:
13: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
14: All rights reserved.
15: See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
16:
17: This software is distributed WITHOUT ANY WARRANTY; without even
18: the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19: PURPOSE. See the above copyright notice for more information.
20:
21: =========================================================================*/
22: // this shader is used to implement lighting in the fragment shader
23: // it handles setting up the basic varying variables for the fragment shader
24:
25: // all variables that represent positions or directions have a suffix
26: // indicating the coordinate system they are in. The possible values are
27: // MC - Model Coordinates
28: // WC - WC world coordinates
29: // VC - View Coordinates
30: // DC - Display Coordinates
31:
32: attribute vec4 vertexMC;
33:
34: // frag position in VC
35: varying vec4 vertexVCVSOutput;
36:
37: // optional normal declaration
38: uniform mat3 normalMatrix;
39: attribute vec3 normalMC;
40: attribute mat3 glyphNormalMatrix;
41: varying vec3 normalVCVSOutput;
42:
43: // Texture coordinates
44: //VTK::TCoord::Dec
45:
46: // material property values
47: attribute vec4 glyphColor;
48: varying vec4 vertexColorVSOutput;
49:
50: // camera and actor matrix values
51: uniform mat4 MCDCMatrix;
52: uniform mat4 MCVCMatrix;
53:
54: attribute mat4 GCMCMatrix;
55:
56: // clipping plane vars
57: uniform int numClipPlanes;
58: uniform vec4 clipPlanes[6];
59: varying float clipDistancesVSOutput[6];
60:
61: void main()
62: {
63: vec4 vertex = GCMCMatrix * vertexMC;
64:
65:
66: for (int planeNum = 0; planeNum < numClipPlanes; planeNum++)
67: {
68: clipDistances[planeNum] = dot(clipPlanes[planeNum], vertex);
69: }
70:
71:
72: vertexColorVSOutput = glyphColor;
73:
74: normalVCVSOutput = normalMatrix * glyphNormalMatrix * normalMC;
75:
76: //VTK::TCoord::Impl
77:
78: // frag position in VC
79: vertexVCVSOutput = MCVCMatrix * vertex;
80: gl_Position = MCDCMatrix * vertex;
81:
82: }
83:
ERROR: In C:\miniconda\1\x64\conda-bld\work\VTK-7.0.0\Rendering\OpenGL2\vtkShaderProgram.cxx, line 355
vtkShaderProgram (000000E1C19B7220): Vertex shader failed to compile with the following errors:
ERROR: 0:68: error(#143) Undeclared identifier: clipDistances
ERROR: 0:68: error(#145) Left of "[" is not of type array, matrix, or vector: clipDistances
ERROR: error(#273) 2 compilation errors. No code generated