PDA

View Full Version : Another problem with views



anton1212
03-12-2012, 02:47 AM
Yesterday I posted a doubt about how to do an isometric view of a cube on openGL using only glRotatef and glOrtho. The problem is that I found it but I dont understand it. I had a reply of Zbuffer and he told me to do 2 glRotatef of 45 one in the vertical axis and the other one on the horizontal. I did it but I wanted to make coincide the wiredcube edges with the axis so the axis are hidden by them.

Finally I used the code attached. It seems to work perfectly but I want to understand it because I also have to do a dimetric and a trimetric view of the cube using only glOrtho and glRotatef.

Any ideas?
Thanks



glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glRotatef( 35.264, 1.0, 0.0, 0.0);
glRotatef( -45.0, 0.0, 1.0, 0.0);
glOrtho(-10.0,10.0,-10.0,10.0,10.0,-10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
DibujaEjes(); //It draws the axis (size 10)
DibujaModelo(); //It draws the wiredCube (size 8)

menzel
03-12-2012, 01:53 PM
You shouldn't put your rotations in the projection matrix, they belong in the modelview.