'gl_Position' : undeclared identifier

I have a Problem with the vertex shader : the compile infoLog is ‘’

ERROR: 0:6: 'gl_Position' : undeclared identifier
ERROR: 0:6: 'assign' :  cannot convert from '4-component vector of highp float' to 'highp float' "

the shader Code:

#version 330 core
layout (location = 0) in vec3 aPos;

void main()
    gl_Position = vec4(aPos, 1.0f);

Whats the mistake ?

1 Like

Compiles fine here as a vertex shader. Shader Playground suggests that it’s valid as well.

Make sure you’re compiling this as a vertex shader, not as a shader for some other shader stage.

1 Like

Thanks. The Problem was that I compiled the vertex shader as Fragment shader and the Fragment shader as vertex shader.


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.