PDA

View Full Version : OpenInventor: OpenGL calls invisible when far from IV objects



Louis-Charles Dumais
11-10-2004, 06:55 PM
Hi,

I have another small problem-question(I think its the last one) about including OpenGL calls with OpenInventor technology. I noticed this a long ago that when drawing OpenGL call in an SoPerspectiveCamera scene, the vertex which are far from the OpenInventor camera aren't shown on the screen. This problem does not exist for the Ortho view. The problem seems to be with a Near and Far value limits.

A video with the problem is available here at: http://www.netchilds.com/Louis/glCall_soPerpetiveCamera.mpeg

In the video you can see that when you add the grid(which is all OpenInventor objects), the lines(in OpenGL) are shown correctly in the 3d view. When you dont, the camera cut the lines. There is no problem for the Ortho X,Y,Z views. I include the code below for the OpenGL white lines in the video.

Do you know why OpenInventor with SoPerspectiveCamera doesn't render all the OpenGL scene all the time without needing OpenInventor objects at each limits?

Thank you for your help,
Louis-Charles Dumais

Here is the code:
glDrawAxes(){

glLineWidth(5.0f);
glColor3f(1.0f,1.0f,1.0f);
float tempLength= 5.0f;
glBegin(GL_LINES);
glVertex3f( -tempLength,0.0f, 0.0f);glVertex3f(tempLength,0.0f, 0.0f);
glVertex3f( 0.0f,-tempLength, 0.0f);glVertex3f(0.0f,tempLength, 0.0f);
glVertex3f( 0.0f,0.0f, -tempLength);glVertex3f(0.0f,0.0f, tempLength);
glEnd();

}

Tom Nuydens
11-10-2004, 10:40 PM
Please post questions like these in the "high-level toolkits" forum.

-- Tom

Dirk
12-22-2004, 01:10 PM
Do you know why OpenInventor with SoPerspectiveCamera doesn't render all the OpenGL scene all the time without needing OpenInventor objects at each limits?
Sounds like your version of OI tries to optimize the use of the Z-Buffer by closely fitting the viewing frustum around the scene. There might be an option to turn that off, or you could just turn your grid into an OI object.

Hope it helps

Dirk

mikeheck
01-07-2005, 10:30 AM
Originally posted by dirk:

Do you know why OpenInventor with SoPerspectiveCamera doesn't render all the OpenGL scene all the time without needing OpenInventor objects at each limits?
Sounds like your version of OI tries to optimize the use of the Z-Buffer by closely fitting the viewing frustum around the scene. There might be an option to turn that off, or you could just turn your grid into an OI object.
As far as I know, all versions of OI try to optimize the Z-buffer depth range by automatically re-computing the near and far clip planes on each render traversal. There is an option to turn that off (see SoXtViewer setAutoClipping) but generally it's a useful feature.

The clip plane computation depends on what OI thinks is the bounding box of the scene graph. So a better solution is to correctly report the bounding box of your OpenGL geometry. You can do this in a custom node by implementing the computeBBox method or in a SoCallback's callback function by checking if the action is SoGetBoundingBoxAction and extending the bbox in the current state.

-Mike