[Plib-users] sgFrustum setting to the same as opengl
Brought to you by:
sjbaker
|
From: Oliver B. <sh...@ih...> - 2000-05-10 02:34:39
|
I have a function for setting up a view frustum I want to know if
its getting the right values to be setup the same as the opengl one
...
I am getting some wierd results in my landscape renderer -
If I roll around etc everything dissapears but I cant see whats
going wrong ...
here is the setup code ...
void View::Set(float angle, float near, float far) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity(); // Reset The Projection Matrix
gluPerspective(angle, 640.0/480.0, near, far); // Calculate The Aspect Ratio Of The Window
glMatrixMode(GL_MODELVIEW);
frustum.setFOV(angle, angle) ;
frustum.setNearFar(near, far) ;
GetGLError("View::Set()");
}
the code which acts wierd looks like :
center=bounds.getCenter();
sgFullXformPnt3(tform, center, land->camera->rotation);
tform[0]-=land->camera->position[0];
tform[1]-=land->camera->position[1];
tform[2]-=land->camera->position[2];
temp->setCenter(tform);
temp->setRadius(bounds.getRadius());
if(!land->view->frustum.contains(temp)) return;
and the code for setting up the bouds sphere is :
for(a=0; a<4; a++)
bounds.extend(&land->Vertices[Vertex[a]*3]);
Thanks a heap
Oliver Batchelor
|