Opacity issue in QVTKOpenGLWidget and PCL Visualizer

I am trying to set the opacity for Cube in pclviewer with surface. It is successed but I can not set the opacity value.

It is OK when the opacity value is 1.0 but any values less than 1.0 make it invisible.

The program is as following:

viewer->addCube(Eigen::Vector3f(c_x,c_y,c_z),Eigen::Quaternionf(rotation),w,d,h,“cube”);
viewer->setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_COLOR, 0.0, 1.0, 0.0, “cube”);
viewer->setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_REPRESENTATION
,pcl::visualization::PCL_VISUALIZER_REPRESENTATION_SURFACE,“cube”);
viewer->setShapeRenderingProperties(PCL_VISUALIZER_OPACITY,0.5,“cube”);

When I run the program, I got the following error:

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):

I am using PCL-1.12.1, VTK-8.2 and Qt5.

I also get the same error while using either “#version 320 es” or “#version 150”.
Is there any way to find compatible version for glsl?
It works fine with vtk6.3 but not in vtk8.2.0.
Here is my opengl version.
Screenshot from 2022-10-21 11-49-50