Talk:Mathematics of glTexGen

From OpenGL Wiki
Revision as of 23:04, 14 November 2010 by Derodo (talk | contribs)
Jump to navigation Jump to search

Don't know if this is the right place for writing this, but I was just applying the maths mentioned in the article for a project I was working on, and I found out the GL_SPHERE_MAP calculations are not correct, for where it says:

reflectionVector = myEyeVertex - myEyeNormal * 2.0 * dot3D(myEyeNormal, myEyeNormal);

It should be:

reflectionVector = myEyeVertex - myEyeNormal * 2.0 * dot3D(myEyeVertex, myEyeNormal);

And where it says:

m = 1.0 / 2.0 * sqrt(dot3D(reflectionVector, reflectionVector));

It should be:

m = 1.0 / ( 2.0 * sqrt(dot3D(reflectionVector, reflectionVector)) );

I'm not an expert on the subject, but having checked the OpenGL reference pages and looking carefully at the glTexGen documentation, it seems the original formula posted on this page was not correct.