View Full Version : projection..

01-03-2003, 12:44 PM
hi, i have a problem to project a 3D scene in order to make a map editor. For example if i have a cube, i just want to see 4 lines (it's wireframed..). So i don't know how i have to set the frustrum.

please help

01-03-2003, 09:22 PM
I'm a beginner at OpenGL, so take my comment with grain:

I think what you need to do is use an orthogonal projection, and place the camera in such a way that the view vector (vector going STRAIGHT into the screen...or one that is the normal to the computer screen surface) is parallel to the normals of one of the faces of the cube.

Basically set to orthogonal project and point the camera STRAIGHT at one of the sides of the cube.

I hope this is right. Good luck

- Halcyon

01-04-2003, 02:12 AM
hum yes i tried this with gluOrtho2D, but the scene does not seem to render, and i don't know why. There is another problem to, i have to move the result because the grid is not centered everytime, (and with perspective it destroy all :/)

01-04-2003, 04:06 AM

Don't use gluOrtho2d, it will set the near and far clip planes to -1 and 1, which is propably why the scene won't render. Use glOrtho instead, it will let you specify the clipping planes manually.

The fact that the grid isn't always centered makes it sound like you don't load identity matrices for every matrix before you setup them. Remember that glOrtho, like all matrix manipulation commands applies the new transform on top of the current. Opengl remembers it's state from the end of the previous frame, so you have to call loadIdentity every frame.

Hope that helps.


01-04-2003, 11:27 AM
hey thanks, that's the solution (i just found it before reading your answer, but thanks =))