SetOpacity is not working

I am trying to set the opacity of the cube in pclviewer with surface but the cube become invisible when opacity value is less than 1.0.

I got the following error when opacity value is <1.0.

ERROR: In /home/VTK-8.2.0/Rendering/OpenGL2/vtkShaderProgram.cxx, line 446
vtkShaderProgram (0x55d9fb9540): 1:#version 300 es
2: #ifndef GL_ES
3: #define highp
4: #define mediump
5: #define lowp
6: #endif // GL_ES
7: #define attribute in
8: #define varying out
9:
10:
11: /=========================================================================
12:
13: Program: Visualization Toolkit
14: Module: vtkPolyDataVS.glsl
15:
16: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
17: All rights reserved.
18: See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
19:
20: This software is distributed WITHOUT ANY WARRANTY; without even
21: the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
22: PURPOSE. See the above copyright notice for more information.
23:
24: =========================================================================
/
25:
26: in vec4 vertexMC;
27:
28: // frag position in VC
29: out vec4 vertexVCVSOutput;
30:
31: // optional normal declaration
32: //VTK::Normal::Dec
33:
34: // extra lighting parameters
35: //VTK::Light::Dec
36:
37: // Texture coordinates
38: //VTK::TCoord::Dec
39:
40: // material property values
41: //VTK::Color::Dec
42:
43: // clipping plane vars
44: //VTK::Clip::Dec
45:
46: // camera and actor matrix values
47: uniform mat4 MCDCMatrix;
48: uniform mat4 MCVCMatrix;
49:
50: // Apple Bug
51: //VTK::PrimID::Dec
52:
53: // Value raster
54: //VTK::ValuePass::Dec
55:
56: // picking support
57: //VTK::Picking::Dec
58:
59: void main()
60: {
61: //VTK::Color::Impl
62:
63: //VTK::Normal::Impl
64:
65: //VTK::TCoord::Impl
66:
67: //VTK::Clip::Impl
68:
69: //VTK::PrimID::Impl
70:
71: vertexVCVSOutput = MCVCMatrix * vertexMC;
72: gl_Position = MCDCMatrix * vertexMC;
73:
74:
75: //VTK::ValuePass::Impl
76:
77: //VTK::Light::Impl
78:
79: //VTK::Picking::Impl
80: }
ERROR: In /home/VTK-8.2.0/Rendering/OpenGL2/vtkShaderProgram.cxx, line 447
vtkShaderProgram (0x55d9fb9540):

My environment is ;

  • Ubuntu 18.04
  • VTK 8.2.0
  • Qt Creator 5.9.5
  • PCL 1.12.1

Why opacity value cannot set less than 1.0?

Hello,

Are you still getting that error? There is another post where you seem to have got past that: Opacity value<1.0 become invisible.

regards,

Paulo

Hello @Paulo_Carvalho

Yes, I am still getting this error.

It seems to me that your graphics driver is not up-to-date and/or that your graphics card is old. Lines 446 and 447 in vtkShaderProgram.cxx are in a part of the VTK code where it calls the graphics back-end to compile a vertex shader program (the source code you see in the error message) and fails.

I recommend trying your program in hardware known to run modern 3D programs (e.g. ParaView) and see whether it works there.