Rotating a Cube randomly - which side is on top?

I just modeled a cube and after rotating it randomly I wish to know which side is on top. I am kind of new to opengl and dont know which is the best way to do it. I thought it would be nice to get the height value of each side of the cube and look for the biggest value. But i dont know how to get this information. Any Suggestions?

Uhm, make the sides different color? Anyway, OpenGL can’t do it for you… it is for drawing objects, not finding out how they interact with the environment. You could take the normal vector for each side and transform it with the current modelview matrix, thus finding out which normal “looks up”.

:slight_smile: thx, maybe i dont expressed myself clearly. The sides have diffent colors and I only want to get on the position information of the differnt sides. Your suggestions sounds good, but it does not solve my problem, I dont know how to get the normal or current position for a side. Maybe something like getNormal(rightSide) would be nice.

If you have made a cube, you ought to know it’s normals and positions (because you have made it)! There is no way to get this information from OpenGL (aside from using the feedback mode, but I won’t talk about it).