I am get a lot of frustration trying to disable frustum culling with OSG camera.
I am setting the perspective matrix to a near plane of 0.1 and a far plane of 1000.0
here is my code.
I explicitly disable frustum culling, however no matter how many time I do it, each time
viewer.frame() is called, the camera rest the near plane to 0.112 and the far plane to 228.56
can someone tells me how to prevent OSG from doing that?
here is my setup code that initialize the camera after the viewer is instantiated.
SetCameraProjectionMatrix (viewer, 90.0f, dFloat (width) / height, 0.1, 1000.0f);
int cullingMode = cam->getCullingMode();
cullingMode &= ~osg::CullSettings::VIEW_FRUSTUM_CULLING;
cam->setCullingMode(cullingMode);
}
void SetCameraProjectionMatrix (osgViewer::Viewer& viewer, dFloat viewAngleInDegress, dFloat aspectRatio, dFloat nearPlane, dFloat farPlane)
{
osg::Camera* const camera = viewer.getCamera();
camera->setProjectionMatrixAsPerspective (viewAngleInDegress, aspectRatio, nearPlane, farPlane);
// camera->setViewMatrixAsLookAt (osg::Vec3 (3.0f, -5.0f, 2.0f), osg::Vec3 (0.0f, 0.0f, 0.0f), osg::Vec3 (0.0f, 0.0f, 1.0f));
camera->setViewMatrixAsLookAt (osg::Vec3 (-3.0f, -5.0f, 2.0f), osg::Vec3 (0.0f, 0.0f, 2.0f), osg::Vec3 (0.0f, 0.0f, 1.0f));
}
_______________________________________________ osg-users mailing list osg-...@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Oh I do no wnat to change the culling, all I want to know is why OSG change the projection matrix to and arbitrary near plain of 0.2 and far plane of 228
I set the camera to be projection to
SetCameraProjectionMatrix (0.5 * 3.1416f, 1.33f, 0.01, 1000.0f);
but when I ge the Plojection matrix on a visitor callback the projection matrix correspond to one of
SetCameraProjectionMatrix (0.5 * 3.1416f, 1.33f, 0.2, 225.0f);
and that seen to be changed by the cullling system of osg,
all I want is to have camera that I am specifying.
Thanks