LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: middy on October 21, 2003, 08:43:54

Title: calculating the range of view
Post by: middy on October 21, 2003, 08:43:54
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
Title: calculating the range of view
Post by: cfmdobbie on October 21, 2003, 11:50:25
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.
Title: yep U were right
Post by: middy on October 21, 2003, 18:46:38
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);

}