PDA

View Full Version : weird problem with gl_Position variable



heinz85
01-13-2012, 09:40 AM
Hello everybody.
Trying to compile the following simple vertex shader:

#version 150

in vec4 vPosition;
//in vec4 vColor;
uniform vec4 vColor;

uniform mat4 model_view;
uniform mat4 projection;

out vec4 color;

void main()
{
gl_Position = projection*model_view*vPosition;
color = vColor;
}

I've got the next error:

vshader.glsl failed to compile:
ERROR: 0:13: 'gl_Position' : undeclared identifier
ERROR: 0:13: 'assign' : cannot convert from 'varying 4-component vector of floa
t' to 'float'

The funny thing is that the very same code works in anothet simple testing application I have...

Anybody knows what might be the problem?

Thanks you very much.

Heinrich

arekkusu
01-13-2012, 10:57 AM
That might happen if you mistakenly try to compile vertex shader text as GL_FRAGMENT_SHADER.

heinz85
01-13-2012, 11:59 AM
Well, I don't know why it happened for me, but when I moved the code out from some inner lass to an initalizing function it actually disappeared...
I dont't know why but... let it be.
If anyone still has some explanation for me, I will thank hime very much...