PDA

View Full Version : Transformation and glOrtho



holyburak
11-05-2003, 12:54 AM
hi all,

assume a program that just displays a cube.
Now, when i convert the code ;
gluPerspective(fov, a_ratio, znear, zfar);
to;
glOrtho(-1.0f,1.0f,-1.0f,1.0f,znear,zfar);

i cant make the cube get smaller as it goes far from me.(z axis)

i mean whatever you make the -3.0 in glTranslatef, the cube stays there!

i would like to ask the reason and how to.

Code is below;

void COpenGLDlg: http://www.opengl.org/discussion_boards/ubb/biggrin.gifisplayGL()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glClearColor(0.0,0.0,0.0,0.0);
glPushMatrix();
glTranslatef(-0.2,-0.2,-3.0);
glColor3f(1.0,0.0,0.0);
glutSolidCube(1);
glPopMatrix();
SwapBuffers(map_window_dc);
}

Thanks For Your Kind Interests.

Burak

Andrea Rossini
11-05-2003, 02:44 AM
glOrtho = Orthographic projection
gluPerspective = Perspective projection

glOrtho ALWAYS generates a flat 2D Isomethric view.

http://www.opengl.org/discussion_boards/ubb/biggrin.gif http://www.opengl.org/discussion_boards/ubb/biggrin.gif http://www.opengl.org/discussion_boards/ubb/biggrin.gif