[Mesa-users] Problem with glFrustum and near clipping plane

Martin Hegedus martin.hegedus at gmail.com
Tue Sep 7 18:09:25 PDT 2010


Hi,

I'm hoping someone can help me with my problem using glFrustum.
Drawing my object seems to behave erratically when the values of left,
right, bottom, top, and near to the glFrustum routine becomes
smallish.

For example, the following call behaves OK,
glFrustum(-1.0,1.0,-1.0,1.0,1.0,50.0) but when I use
glFrustum(-0.001,0.001,-0.001,0.001,0.001,50.0) the clipping is
erratic in the sense that the middle of the geometry is clipped but
portions of the geometry behind and ahead of the clipped region are
visible and OK.

Also, as a test, I modified the engine.c routine in the
/usr/local/Mesa-7.8.2/progs/demos directory and also get erratic
behavior, though not identical to mine.

To get the behavior I modified the glFrustum call in the Reshape() routine from

glFrustum(-ar * s, ar * s, -s, s, 2.0, 50.0);

to

   double sc = 1.0;
   glFrustum(-ar * s * sc, ar * s * sc, -s * sc, s * sc, 2.0 * sc, 50.0);

Then played around with the sc value.  When the sc value is 0.01 the
engine gets clipped strangely when the engine is moved back with the
middle mouse button.  And clipping occurs even though the engine is
located between 2.0*sc and 50.0.  Or, the sc value can be set to 0.001
and the issue will be evident without moving the image forward or
back.

I configured and compiled Mesa (7.8.2) with the following './configure
--with-driver=xlib'  and I'm running openSUSE 10.2 (i586) with Linux
2.6.18.8-0.3-default i686.

Any thoughts on why this is occurring?

Thanks

Martin Hegedus


More information about the mesa-users mailing list