• Advertisement
Sign in to follow this  

glOrtho

This topic is 3965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement