I'am building an OpenGL-application using Qt 5.11.2. When adding a tessellation shader the following error occurs:
QOpenGLShader::compile(Tessellation Control): 0(2) : error C0204: version directive must be first statement and may not be repeated
*** Problematic Tessellation Control shader source code ***
#define lowp
#define mediump
#define highp
#line 1
´╗┐#version 400
#line 1
layout (vertices = 4) out;
I'm working on Windows 10 with Geforce GTX 1050/PCIe/SSE2 GPU.
I've found similar reports, but none of the answers worked for me: unable to compile GLSL shaders on Qt 5.3 after Nvidia driver update
Serious rendering issues with OpenGL 4.1 and Qt 5
The shader looks like this:
#version 400
layout (vertices = 4) out;
uniform float animationFrame;
in vec3 v_vertex[];
out vec3 tc_vertex[];
void main()
{...}
To add the shader I use the following code:
addShader(QOpenGLShader::Vertex, "data/cube.vert", *m_program);
addShader(QOpenGLShader::Fragment, "data/cube.frag", *m_program);
addShader(QOpenGLShader::TessellationControl, "data/cube.tcs", *m_program);
addShader(QOpenGLShader::TessellationEvaluation, "data/cube.tes", *m_program);
addShader(QOpenGLShader::Geometry, "data/cube.geom", *m_program);
Obviously the first lines inserted by Qt produce the error. Any ideas how to fix this problem?