Discussion:
GLSL simple question
(too old to reply)
Cathy L.
2014-02-17 09:58:24 UTC
Permalink
Raw Message
Hello

If I understand well, in the vertex shader, the gl_Position built-in
variable should get a clip-space value, that means a value between
[-1,-1,-1,1] and [1,1,1,1].

So if my vertex shader is

"
#version 330 core
main()
{
gl_Position=vec4(0,0,0,1);
}
"

and my fragment shader is

"
#version 330 core

out vec4 color;

main()
{
color=vec4(1,0,0,1);
}
"

for anything drawn with "glDrawArrays(...);" juste before swapping the
buffers,I should see a red point in the middle of the screen.
But it doesn't work, someone could explain me where is the mistake?

Thanks for the help
Cathy L.
Cathy L.
2014-02-19 16:46:38 UTC
Permalink
Raw Message
Ok I have my answer, it was because I drew arrays of triangles, but with
points, it was appearing on the screen.
Post by Cathy L.
Hello
If I understand well, in the vertex shader, the gl_Position built-in
variable should get a clip-space value, that means a value between
[-1,-1,-1,1] and [1,1,1,1].
So if my vertex shader is
"
#version 330 core
main()
{
gl_Position=vec4(0,0,0,1);
}
"
and my fragment shader is
"
#version 330 core
out vec4 color;
main()
{
color=vec4(1,0,0,1);
}
"
for anything drawn with "glDrawArrays(...);" juste before swapping the
buffers,I should see a red point in the middle of the screen.
But it doesn't work, someone could explain me where is the mistake?
Thanks for the help
Cathy L.
Loading...