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.…d_up_vector…29

please see this thread:…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);


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;

	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);