[Radiance-general] Re: Trees in the holodeck

Thomas Bleicher [email protected]
Sun, 25 May 2003 11:32:47 +0200


On Sat, May 24, 2003 at 09:28:36AM -0700, Greg Ward wrote:
> Hi Randolph,
> 
> I believe there's a bug either in the code that determines rotation 
> angles for cylinders in src/common/rglsurf.c or many OpenGL 
> implementations.  I suspect the former, but need to do some further 
> investigation to figure it out for sure.

Sorry if this is old news (I have only the 3r1p20 source installed at
the moment). I had a quick look at src/common/rglsurf.c and I think there
are some missing "glPopMatrix()" calls:

In o_cone (and o_ring) is this sequence (line 266 in my file):

   glPushMatrix();
                                   /* do base translation */
   glTranslated((GLdouble)o->oargs.farg[0], (GLdouble)o->oargs.farg[1],
                    (GLdouble)o->oargs.farg[2]);
                                   /* compute height & rotation angle */
   h = sqrt(dist2(o->oargs.farg,o->oargs.farg+3));
   if (h <= FTINY)
       return;


If this test returns 1 (ie. a "flat" cylinder) glPopMatrix() is 
never called but the system is already translated. This will at least 
misplace all of the following objects (up to the next "glLoadIdentity")
and it should raise an error when buffers are swaped. IIRC "Pushes" 
and "Pops" have to match up.

I only used OpenGL via Python bindings (one year ago) and I'm not at all 
C literate so I didn't dare looking at the rotation calculation ;) 

I think sometimes this _could_ cause this sort of display problems.

Thomas