viewing from perspective

BlitzMax Forums/BlitzMax OpenGL Programming/viewing from perspective

hi all, when i setup my ogl scene i call :

	glViewport(0.0,0.0,width,height);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0.0,width,height,0.0,-1.0,1.0);
	glMatrixMode(GL_MODELVIEW);				
	glLoadIdentity();

which is fine for a std. top down or side scroll view, but whats best way to create a perspective type view of the scene?

cheers

Instead of glOrtho you want glFrustum.
It uses slightly different parameters however. You might need to adapt your game.

Also you can't have negative or zero for your Z coordinate range so yu have to know to position your objects at at least >0 coordinate in Z.

is it easier to just create a camera and position that at the right viewing angel or is this not poss with ogl?

The projection matrix is the camera so you can move/rotate it to where you want. But it will only be 3d if you use a perspective projection with glFrustum or gluPerspective

Thanking you very much :)