in OpenGL vertex shaders, what is w, and why do I divide by it?
        Posted  
        
            by anon
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by anon
        
        
        
        Published on 2010-03-11T05:29:23Z
        Indexed on 
            2010/03/11
            5:33 UTC
        
        
        Read the original article
        Hit count: 319
        
opengl
|vertex-shader
void main(void)
{
  vec4 clipCoord = glModelViewProjectionmatrix * gl_Vertex;
  gl_Position = clipCoord;
  gl_FrontColor = gl_Color;
    vec3 ndc = clipCoord.xyz / clipCoord.w;
So the clipCoord is just doing standard fixed pipeline ransforms. Now, the ndc ... why do I divide by w, and what do I get from this?
© Stack Overflow or respective owner