Determine Coordinations ...

I create a cube (100x100x100) inside a world(1000x900x900). And using glTranslatef() transfer the cube around the world. Apparently there are occasions were my cube is transfered outside my world. Is there some way to determine my cube’s coordinations after or before applying the glTranslatef().

Thank you very much.

Typically your glTranslate is used to append a transform to the MODELVIEW transform.

You can grab the current MODELVIEW and do some transforms with it on the CPU to see where object space points end up in eye space.

What are you trying to accomplish? Or are you puzzled about how the viewing transformations work? The OpenGL Programming Guide has a good description of all this if you’re interested.

Well I am currently reading the red book and try a few examples of my own. What do you mean by “grab the current MODELVIEW” ?

Thanx for your reply.

You usually apply a transformation to your object before you draw them. There is three way to apply transormation:
[ul][li]use old deprecated openGL function like glTranslate, glRotate, glScale… etc…[]Use your math library to compute the transformation matrix and then use glLoadMatrix[] Apply the transformation matrix as an uniform in your shader[/ul][/li]In the last two points you already know the modelview matrix.

In case 1 openGL compute the matrix for you (taking care of multiple transformation, hierarchy, and camera transformation). To get the current modelview matrix you have to call
glGetFloatv(GL_MODELVIEW_MATRIX)
obviously I don’t have/want to repeat again that using glGet slow down the whole program. So if performance is critical use point 2 or 3

Wow… Thanx for the info. I will check them out.