Jump to content
  • Advertisement
Sign in to follow this  
mike74

-1.#INDO?

This topic is 4758 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote some code to look at a matrix: glGetFloatv(GL_MODELVIEW_MATRIX, matrix); float x, y, z; x = matrix[12]/matrix[15]; y = matrix[13]/matrix[15]; z = matrix[14]/matrix[15]; sprintf(str, "%f, %f, %f", x, y, z); MessageBox(NULL, str, str, MB_OK); When I run the previous code after calling gluPerspective it pops up a messagebox that says: "-1.#IND00, -1.#IND00, -1.#INF00" What in the world would cause a float to print like that? Hmmm... actually, I guess the -1.#IND00 is 0/0, and -1.#INF00 is a nonzero number divided by 0.... Okay, this brings up another question. When I look at the GL_MODELVIEW_MATRIX after calling glLoadIdentity, it is like so: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 However, if I look at it after calling gluPerspective(90.0f,1 ,0.1f,100.0f);, I get this: 1 0 0 0 0 1 0 0 0 0 -1.002002 -0.200200 0 0 -1 0 Is this how it should be? Should gluPerspective be putting weird stuff like that in the GL_MODELVIEW_MATRIX? Mike C. http://www.coolgroups.com/zoomer

Share this post


Link to post
Share on other sites
Advertisement
You are correct about the IND/INF values; and gluPerspective is supposed to do something along those lines, yes - it turns the modelview matrix into one that represents the perspective "transformation" specified by the gluPerspective parameters. You would do well to get yourself a good reference on 3D graphics programming and research how the transformation matrices work - there's actually a kinda freaky higher-math idea in there: an N-dimensional matrix is useful just for rotating and shearing N-dimensional spaces (i.e. representing rotational and shear transformations); to do translations, you need to add another dimension, and the translation is basically a shear in that other dimension :) (I *think* I got that right. Don't quote me!)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!