projection..

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

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

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 :/)

Hi,

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.

-Ilkka

hey thanks, that’s the solution (i just found it before reading your answer, but thanks =))

++
TiPiaX