calculating the range of view

Started by middy, October 21, 2003, 08:43:54

Previous topic - Next topic

middy

Here is the situation

I am drawring up a solar system. They are all been drawed along the xaxis(its a simple selection screen).

My camera is positioned at (0,0,-70).

That means I can see a range of -45 to 45 on the xaxis in world coords. I found that out by trying.

So
How do I measure my range?

and how do I change my frustrum so I can view more/less
um

cfmdobbie

Depends on your viewing transformation - if you're using an orthographic projection you provide min/max values in the glOrtho call, with perspective you provide a field of view argument yourself, but you're using a frustum, yes?

You should be able to work out the field of view using trigonometry - draw a picture of your viewing volume from above and work out the angle of separation between the two sides using the size of the virtual screen and your distance to it.
ellomynameis Charlie Dobbie.

middy

public void viewFrom(){
	
		
		GLU.gluLookAt(_position._x,_position._y,_position._z,_view._x,_view._y,_view._z,_top.getX(),_top.getY(),_top.getZ());
		
		//GL.glViewport(0,0,800,600);
		GL.glMatrixMode(GL.GL_PROJECTION);
		GL.glLoadIdentity();
		GLU.gluPerspective(90,this._aspect,this._minDepth,this._maxDepth);
		GL.glMatrixMode(GL.GL_MODELVIEW);
	
	}
um