I'm learning OpenGL, and currently I'm writing a shader, but I'm confused as to why the gl_Position
variable is a vec4
instead of a vec3
, as I'd expect. I'd expect this of course because it uses 3D space, not 4D.
I hope I'm at least right in assuming that the first three fields of gl_Position
are indeed the x, y, and z ordinates of the position.
In case my question isn't clear enough: what's the fourth field of gl_Position
.
By the way, I'm using OpenGL 3.2 and GLSL 1.5.