着色器代码
错误提示
QOpenGLShader::compile(Vertex): 0(2) : error C0204: version directive must be first statement and may not be repeated
0(3) : error C0000: syntax error, unexpected '(', expecting "::" at token "("
0(6) : warning C1503: undefined variable "aPos"
0(6) : warning C1503: undefined variable "aPos"
0(6) : warning C1503: undefined variable "aPos"
0(6) : warning C7502: OpenGL does not allow type suffix 'f' on constant literals in versions below 120
*** Problematic Vertex shader source code ***
#define lowp
#define mediump
#define highp
#line 1
???#version 330 core
layout(location = 0) in vec3 aPos;
void main(){
gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0f);
}
解决方案
在第一行语句#version之前加上一个回车