CGAL 5.3:绘制三角剖分的示例程序不起作用
CGAL 5.3: Example program to draw a triangulation doesn't work
我已经安装了 CGAL 5.3 并尝试构建和 运行 来自 this page 的示例程序。我就是这么做的:
cd $HOME/CGAL-5.3/release/examples/Triangulation_2
cmake -DCMAKE_BUILD_TYPE=Release -DCGAL_DIR=../../lib/cmake/CGAL .
make draw_triangulation_2
./draw_triangulation_2
但是,我在控制台中收到了很多错误消息 window - 主要是关于 OpenGL 着色器的投诉,请参见下文:
QOpenGLShader::compile(Vertex): 0:3(1): error: `in' qualifier in declaration of `vertex' only valid for function parameters in GLSL 1.10
0:4(1): error: `in' qualifier in declaration of `color' only valid for function parameters in GLSL 1.10
0:9(1): error: `out' qualifier in declaration of `fColor' only valid for function parameters in GLSL 1.10
*** Problematic Vertex shader source code ***
#define lowp
#define mediump
#define highp
#line 1
in highp vec4 vertex;
in highp vec3 color;
uniform highp mat4 mvp_matrix;
uniform highp float point_size;
out highp vec4 fColor;
void main(void)
{
gl_PointSize = point_size;
fColor = vec4(color, 1.0);
gl_Position = mvp_matrix * vertex;
}
***
Compiling vertex source FAILED
QOpenGLShader::link: error: linking with uncompiled/unspecialized shader
linking Program FAILED
QOpenGLShader::compile(Vertex): 0:3(1): error: `in' qualifier in declaration of `vertex' only valid for function parameters in GLSL 1.10
0:4(1): error: `in' qualifier in declaration of `normal' only valid for function parameters in GLSL 1.10
0:5(1): error: `in' qualifier in declaration of `color' only valid for function parameters in GLSL 1.10
0:11(1): error: `out' qualifier in declaration of `fP' only valid for function parameters in GLSL 1.10
0:12(1): error: `out' qualifier in declaration of `fN' only valid for function parameters in GLSL 1.10
0:13(1): error: `out' qualifier in declaration of `fColor' only valid for function parameters in GLSL 1.10
*** Problematic Vertex shader source code ***
#define lowp
#define mediump
#define highp
#line 1
in highp vec4 vertex;
in highp vec3 normal;
in highp vec3 color;
uniform highp mat4 mvp_matrix;
uniform highp mat4 mv_matrix;
uniform highp float point_size;
out highp vec4 fP;
out highp vec3 fN;
out highp vec4 fColor;
void main(void)
{
fP = mv_matrix * vertex;
highp mat3 mv_matrix_3;
mv_matrix_3[0] = mv_matrix[0].xyz;
mv_matrix_3[1] = mv_matrix[1].xyz;
mv_matrix_3[2] = mv_matrix[2].xyz;
fN = mv_matrix_3* normal;
fColor = vec4(color, 1.0);
gl_PointSize = point_size;
gl_Position = mvp_matrix * vertex;
}
***
Compiling vertex source FAILED
QOpenGLShader::link: error: linking with uncompiled/unspecialized shader
linking Program FAILED
QOpenGLShader::link: error: linking with uncompiled/unspecialized shader
QOpenGLShaderProgram::attributeLocation(vertex): shader program is not linked
等等...查看器window,然而,出现却为空:
与 CGAL 5.2.3 完全相同的操作顺序为我提供了正确的 window 三角测量并且没有错误消息 - 所以我盒子上的 OpenGL 和 Qt5 安装看起来是正确的。 从 CGAL 5.2.3 到 CGAL 5.3 的过渡可能是罪魁祸首 (???)。
如何克服这个问题?
(我使用 Ubuntu 20.04.3 LTS,标准内核 5.11.0-27,以及所有标准版本的 OpenGL 和 Qt5)
更新。我在 CGAL 错误跟踪器上打开了一个 issue。
我正在回答我自己的问题。根据 CGAL 开发人员的说法,这是基于 Qt5 的可视化代码中的一个错误,没有办法直接克服它。该错误已在代码存储库中修复,因此修复将包含在下一个 CGAL 版本中。
我已经安装了 CGAL 5.3 并尝试构建和 运行 来自 this page 的示例程序。我就是这么做的:
cd $HOME/CGAL-5.3/release/examples/Triangulation_2
cmake -DCMAKE_BUILD_TYPE=Release -DCGAL_DIR=../../lib/cmake/CGAL .
make draw_triangulation_2
./draw_triangulation_2
但是,我在控制台中收到了很多错误消息 window - 主要是关于 OpenGL 着色器的投诉,请参见下文:
QOpenGLShader::compile(Vertex): 0:3(1): error: `in' qualifier in declaration of `vertex' only valid for function parameters in GLSL 1.10
0:4(1): error: `in' qualifier in declaration of `color' only valid for function parameters in GLSL 1.10
0:9(1): error: `out' qualifier in declaration of `fColor' only valid for function parameters in GLSL 1.10
*** Problematic Vertex shader source code ***
#define lowp
#define mediump
#define highp
#line 1
in highp vec4 vertex;
in highp vec3 color;
uniform highp mat4 mvp_matrix;
uniform highp float point_size;
out highp vec4 fColor;
void main(void)
{
gl_PointSize = point_size;
fColor = vec4(color, 1.0);
gl_Position = mvp_matrix * vertex;
}
***
Compiling vertex source FAILED
QOpenGLShader::link: error: linking with uncompiled/unspecialized shader
linking Program FAILED
QOpenGLShader::compile(Vertex): 0:3(1): error: `in' qualifier in declaration of `vertex' only valid for function parameters in GLSL 1.10
0:4(1): error: `in' qualifier in declaration of `normal' only valid for function parameters in GLSL 1.10
0:5(1): error: `in' qualifier in declaration of `color' only valid for function parameters in GLSL 1.10
0:11(1): error: `out' qualifier in declaration of `fP' only valid for function parameters in GLSL 1.10
0:12(1): error: `out' qualifier in declaration of `fN' only valid for function parameters in GLSL 1.10
0:13(1): error: `out' qualifier in declaration of `fColor' only valid for function parameters in GLSL 1.10
*** Problematic Vertex shader source code ***
#define lowp
#define mediump
#define highp
#line 1
in highp vec4 vertex;
in highp vec3 normal;
in highp vec3 color;
uniform highp mat4 mvp_matrix;
uniform highp mat4 mv_matrix;
uniform highp float point_size;
out highp vec4 fP;
out highp vec3 fN;
out highp vec4 fColor;
void main(void)
{
fP = mv_matrix * vertex;
highp mat3 mv_matrix_3;
mv_matrix_3[0] = mv_matrix[0].xyz;
mv_matrix_3[1] = mv_matrix[1].xyz;
mv_matrix_3[2] = mv_matrix[2].xyz;
fN = mv_matrix_3* normal;
fColor = vec4(color, 1.0);
gl_PointSize = point_size;
gl_Position = mvp_matrix * vertex;
}
***
Compiling vertex source FAILED
QOpenGLShader::link: error: linking with uncompiled/unspecialized shader
linking Program FAILED
QOpenGLShader::link: error: linking with uncompiled/unspecialized shader
QOpenGLShaderProgram::attributeLocation(vertex): shader program is not linked
等等...查看器window,然而,出现却为空:
与 CGAL 5.2.3 完全相同的操作顺序为我提供了正确的 window 三角测量并且没有错误消息 - 所以我盒子上的 OpenGL 和 Qt5 安装看起来是正确的。 从 CGAL 5.2.3 到 CGAL 5.3 的过渡可能是罪魁祸首 (???)。
如何克服这个问题?
(我使用 Ubuntu 20.04.3 LTS,标准内核 5.11.0-27,以及所有标准版本的 OpenGL 和 Qt5)
更新。我在 CGAL 错误跟踪器上打开了一个 issue。
我正在回答我自己的问题。根据 CGAL 开发人员的说法,这是基于 Qt5 的可视化代码中的一个错误,没有办法直接克服它。该错误已在代码存储库中修复,因此修复将包含在下一个 CGAL 版本中。