[vtk-developers] OpenGL2: Picking problems on Linux

Bill Lorensen bill.lorensen at gmail.com
Mon Feb 2 16:11:23 EST 2015


Folks,

I built VTK with the OpenGL2 backend. This example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/BalloonWidget
crashes when I hover over an actor. It is failing during the pick operation.

My system is Fedoro 20. OPenGL version:
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.4, 128 bits)
OpenGL version string: 2.1 Mesa 10.3.3
OpenGL shading language version string: 1.30

This is the reported error before the segfault:
ERROR: In /home/lorensen/ProjectsGIT/VTKGerrit/Rendering/OpenGL2/vtkShaderProgram.cxx,
line 291
vtkShaderProgram (0x1340be0): 1:
/*=========================================================================
2:
3:   Program:   Visualization Toolkit
4:   Module:    vtkglPolyDataFSHeadight.glsl
5:
6:   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7:   All rights reserved.
8:   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9:
10:      This software is distributed WITHOUT ANY WARRANTY; without even
11:      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12:      PURPOSE.  See the above copyright notice for more information.
13:
14: =========================================================================*/
15: // the lighting model for this shader is a Headlight
16:
17: // The following line handle system declarations such a
18: // default precisions, or defining precisions to null
19: #extension GL_EXT_gpu_shader4 : enable
20: #define highp
21: #define mediump
22: #define lowp
23:
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: // VC positon of this fragment
33: varying vec4 vertexVC;
34:
35: // optional color passed in from the vertex shader, vertexColor
36: uniform float opacityUniform; // the fragment opacity
37: uniform vec3 ambientColorUniform; // intensity weighted color
38: uniform vec3 diffuseColorUniform; // intensity weighted color
39: uniform vec3 specularColorUniform; // intensity weighted color
40: uniform float specularPowerUniform;
41:
42:
43: // optional normal declaration
44: varying vec3 normalVCVarying;
45:
46: // Texture coordinates
47: //VTK::TCoord::Dec
48:
49: // picking support
50: uniform vec3 mapperIndex;
51: uniform int pickingAttributeIDOffset;
52:
53: // Depth Peeling Support
54: //VTK::DepthPeeling::Dec
55:
56: // clipping plane vars
57: //VTK::Clip::Dec
58:
59: void main()
60: {
61:   //VTK::Clip::Impl
62:
63:   vec3 ambientColor;
64:   vec3 diffuseColor;
65:   float opacity;
66:   vec3 specularColor;
67:   float specularPower;
68:   ambientColor = ambientColorUniform;
69:   diffuseColor = diffuseColorUniform;
70:   opacity = opacityUniform;
71:   specularColor = specularColorUniform;
72:   specularPower = specularPowerUniform;
73:
74:
75:   // Generate the normal if we are not passed in one
76:   vec3 normalVC = normalize(normalVCVarying);
77:   if (gl_FrontFacing == false) { normalVC = -normalVC; }
78:
79:
80:   // diffuse and specular lighting
81:   float df = max(0.0, normalVC.z);
82:   float sf = pow(df, specularPower);
83:
84:   vec3 diffuse = df * diffuseColor;
85:   vec3 specular = sf * specularColor;
86:
87:   gl_FragColor = vec4(ambientColor + diffuse + specular, opacity);
88:   //VTK::TCoord::Impl
89:
90:   if (gl_FragColor.a <= 0.0)
91:     {
92:     discard;
93:     }
94:
95:   //VTK::DepthPeeling::Impl
96:
97:   if (mapperIndex == vec3(0.0,0.0,0.0))
98:     {
99:     int idx = gl_PrimitiveID + 1 + pickingAttributeIDOffset;
100:     gl_FragColor = vec4(float(idx%256)/255.0,
float((idx/256)%256)/255.0, float(idx/65536)/255.0, 1.0);
101:     }
102:   else
103:     {
104:     gl_FragColor = vec4(mapperIndex,1.0);
105:     }
106:
107: }
108:
109:
110:
111:


ERROR: In /home/lorensen/ProjectsGIT/VTKGerrit/Rendering/OpenGL2/vtkShaderProgram.cxx,
line 292
vtkShaderProgram (0x1340be0): 0:19(12): warning: extension
`GL_EXT_gpu_shader4' unsupported in fragment shader
0:99(12): error: `gl_PrimitiveID' undeclared
0:99(12): error: operands to arithmetic operators must be numeric
0:99(12): error: operands to arithmetic operators must be numeric
0:100(28): error: operator '%' is reserved in GLSL 1.10 (GLSL 1.30 or
GLSL ES 3.00 required)
0:100(22): error: cannot construct `float' from a non-numeric data type
0:100(22): error: operands to arithmetic operators must be numeric
0:100(17): error: cannot construct `vec4' from a non-numeric data type


More information about the vtk-developers mailing list