Little ogl prob!

i copied the opengl init commands from testgl.c:
glViewport( 0, 0, w, h );
glMatrixMode( GL_PROJECTION );
glLoadIdentity( );

glOrtho( -2.0, 2.0, -2.0, 2.0, -20.0, 20.0 );

glMatrixMode( GL_MODELVIEW );
glLoadIdentity( );

glEnable(GL_DEPTH_TEST);

glDepthFunc(GL_LESS);

glShadeModel(GL_SMOOTH);

i dont seem to get any depth, my little triangle is always of the same size!
so, could the parameters of glOrtho be responible of that problem?

You are using a view that doesn’t change the size of a polygon with the
depth it is from the eye.

glEnable(GL_DEPTH_TEST);
doesn’t change the size of objects due to depth. It makes sure that if A is
in front of B that A is drawn and not B.

glOrtho(…)
is creating an orthographic view (depth does not change as it gets further
away). Think of this like on a blueprint.

You want to use
glFrustrum(…)
or
gluPerspective(…)
or
make your own matrix to do this (you should be able to find info on how to
do this somewhere on the web… or in a graphics class)> ----- Original Message -----

From: moos@pt.lu (Dan)
To:
Sent: Thursday, December 27, 2001 4:10 AM
Subject: [SDL] little ogl prob!

i copied the opengl init commands from testgl.c:
glViewport( 0, 0, w, h );
glMatrixMode( GL_PROJECTION );
glLoadIdentity( );

glOrtho( -2.0, 2.0, -2.0, 2.0, -20.0, 20.0 );

glMatrixMode( GL_MODELVIEW );
glLoadIdentity( );

glEnable(GL_DEPTH_TEST);

glDepthFunc(GL_LESS);

glShadeModel(GL_SMOOTH);

i dont seem to get any depth, my little triangle is always of the same
size!
so, could the parameters of glOrtho be responible of that problem?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl