views:

1860

answers:

3

Hello,

I am a newbie in OpenGL programming with C++ and not very good at mathematics. Is there a simple way to have isometric projection?

I mean the true isometric projection, not the general orthogonal projection.

(Isometric projection happens only when projections of unit X, Y and Z vectors are equally long and angles between them are exactly 120 degrees.)

Code snippets are highly appreciated..

Thanks in advance..

+9  A: 
cobbal
This won't give you an isometric projection, because parallel lines, say along the x and y axes, won't appear parallel, when they actually should.
Jesse Beder
look at the picture on the wikipedia article that was linked too in the question, this looks exactly like that projection. Any parallel lines will appear parallel because this is a Orthographic projection (http://en.wikipedia.org/wiki/Orthographic_projection). The x and y axes are not parallel.
cobbal
I don't mean the x and y axes are parallel, but that lines parallel to the x axis should appear parallel in an isometric projection (and I don't think they will in yours), and similarly in the y direction.
Jesse Beder
Whoops, my bad. I missed that you were *only* calling gluLookAt. +1 now.
Jesse Beder
+1  A: 

Maybe I'm not quite grokking the math correctly, but couldn't you just position your camera as it explains in that Wikipedia link and use a standard orthogonal projection?

Even if it's not the same, the projection stack is entirely up to you.

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// your isometric matrix here (see math on Wikipedia)
glMatrixMode(GL_MODELVIEW);
Bob Somers
+2  A: 

An isometric projection is just a matter of using an orthographic projection with a specific rotation angle.

You should be able to choose any of the 8 potential orientations, with a orthographic projection, and get a perfect isometric view of your model. Just follow the math in your referenced Wiki article for setting up the view matrix, and do an orthographic projection for your projection matrix, and you're all set.

Reed Copsey