In OpenGL vertex shader, gl_Position doesn't get homogenized..
- by KJ
Hi everyone,
I was expecting gl_Position to automatically get homogenized (divided by w), but it seems not working.. Why do the followings make different results?
1)
void main() {
vec4 p;
... omitted ...
gl_Position = projectionMatrix * p;
}
2)
... same as above ...
p = projectionMatrix * p;
gl_Position = p / p.w;
I think the two are supposed to generate the same results, but it seems it's not the case. 1 doesn't work while 2 is working as expected.. Could it possibly be a precision problem? Am I missing something? This is driving me almost crazy.. helps needed. Many thanks in advance!