View Full Version : Transform between two different viewport

08-27-2003, 04:40 PM
I need to draw some specific 3d object, which don't zoom with camera(such as coordinate system).

For now, I would like to implement this by adopting two different project matrix, which meant that I draw these 3d object in specific project matrx(which don't zoom at all).

here is problem, while drawing coordinates system, a 3d location and vector direction are provided, I transform 3d point onto screen coordinates by gluProject(spt, using project matrix1), then I translate screen spt onto another 3d coordinates(using project matrix2), then I setup the second camera to draw the coordinates system.

It seems work, but location is not right. anybody can give me suggestion?

08-28-2003, 06:58 AM
I suggest you set up the projection matrices to get the effect you want. However, it's very seldom a good idea to do any kind of transform except perspective and screen scale in the projection matrix. Usually, you should do what you need in the modelview matrix.

Note that if you want to draw a coordinate system which matches your object, then you want to use the same world space and projection space, only the "model" part of the "modelview" matrix should be different. See the red book for lots of examples.