How to use glFrustumf?

Hello all,

I would like to make my scene always “fit to screen”, I mean my scene is as big as possible but the user always can see my entire scene.

I don’t know how to use glFrustumf to do this.

Thanks all,

it’s in the wiki, which is referenced at the top of every single forum.
http://www.opengl.org/wiki/index.php/Vie…d_up_vector…29

please see this thread: http://www.opengl.org/discussion_boards/…0949#Post240949

I have tried this, but i cannot see anything on the screen. My current code is:

glClearColor        (0.f,0.f,0.f,1.f);
glMatrixMode        (GL_PROJECTION);
glFrustumf (-100.f,1000.f,-1000.f,500.f,3.f,300.f);
glMatrixMode        (GL_MODELVIEW);
glShadeModel        (GL_SMOOTH);
glTranslatef            (-1400.f, 1000.f, -3.f);
glScalef(2.0, 2.0, 2.0);
glColor4f(0,1,0,1);

DrawScene();

The code that i CANNOT see anything on the screen:

glClearColor        (0.f,0.f,0.f,1.f);

	float diam = 1000;
	float zNear = 3.f;
	float zFar = zNear + diam;
	
	int cx = 0, cy = 0;
	
	float left = cx - diam;
	float right = cx + diam;
	float bottom = cy - diam;
	float top = cy + diam;
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	float aspect = (float) iScreenWidth / iScreenHeight;

	if ( aspect < 1.0 ) { // window taller than wide
		bottom /= aspect;
		top /= aspect;
	} else {
		left *= aspect;
		right *= aspect;
	}	
	
	//glOrtho(left, right, bottom, top, zNear, zFar);
	glOrthof(left, right, bottom, top, zNear, zFar);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	
	glColor4f(0,1,0,1);