GLSL"出局"4.2至1.2

The*_*mer 0 opengl macos glsl

我正在尝试将GLSL 4.2移植到1.2(因为我使用的是mac),但是,我不确定如何将out参数转换为1.2(因为它会生成错误).

out vec3 vNormal;
out vec2 texcoord; 
out vec3 vPosition;

编译器错误如下.


Invalid qualifiers 'out' in global variable context
ERROR: 0:13: Invalid qualifiers 'out' in global variable context
ERROR: 0:14: Invalid qualifiers 'out' in global variable context
ERROR: 0:19: Use of undeclared identifier 'texcoord'
ERROR: 0:20: Use of undeclared identifier 'vNormal'
ERROR: 0:21: Use of undeclared identifier 'vPosition'
Run Code Online (Sandbox Code Playgroud)

Nic*_*las 5

GLSL 1.30及以上out限定符表示着色器阶段输出.这也就意味着为1.20及以下取决于着色器阶段,你是在谈论.

因为你正在使用像texcoord和这样的标识符vNormal,所以我猜你正在编写一个顶点着色器.然后你应该使用的关键字是varying.与这些对应的片段着色器输入也应该也是varying如此.