Public Group

# -1.#INDO?

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

## 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 on other sites
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!)

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632960
• Total Posts
3009478
• ### Who's Online (See full list)

There are no registered users currently online

×