glOrtho

Started by
2 comments, last by Kwizatz 16 years, 10 months ago
Hi My program uses glFrustum to set prespective projection and I want instead a simple parallel projection. my code is:

void reshape( int w, int h )
{
	glViewport( 0, 0, (GLsizei)w, (GLsizei)h );
	
	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
	glFrustum( -.4, .4, -.3, .3, 1., 1300. );					

	glMatrixMode( GL_MODELVIEW );
	
	glutPostRedisplay();
}

void draw( )
{
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

	glColor3f( 1., 0., 0. );
	glLoadIdentity();
 
	gluLookAt( 350., 250., 250., 0., 0., 0., 0., 1., 0. );		
	
	glDisable( GL_LIGHTING );
	drawAxis();
	glEnable( GL_LIGHTING );
	glColor3f( 1., 1., 0. );
// some more code here for drawing meshes

// vertices lie somewhere between -250 and 250


when I try to use

glOrtho( -.4, .4, -.3, .3, 1., 1300. )

// OR

glOrtho( -1., 1., -1., 1., 1., 1300. )


instead of the glFrustum statement, I see no output what so ever any hints on the issue thanks in advance.
Advertisement
Try using higher (way higher) values for left,right,bottom and top, the dimensions of your screen resolution for example.

Hint: glFrustum describes a Pyramid, glOrtho a Cube, you need a bigger cube.
thanks,

it works :)
No Problem.

This topic is closed to new replies.

Advertisement