In OpenGL vertex shader, gl_Position doesn't get homogenized..
Posted
by KJ
on Stack Overflow
See other posts from Stack Overflow
or by KJ
Published on 2010-04-17T00:55:24Z
Indexed on
2010/04/17
1:03 UTC
Read the original article
Hit count: 402
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!
© Stack Overflow or respective owner