quad strips bugs ?

M. J. Cole dprmjc at prism.ARCO.COM
Thu May 2 04:18:06 AEST 1991


> >In article <1991Apr29.141450.4737 at Arco.COM> I wrote:
> >>  2) If you are using lighting on a Personal Iris DO NOT USE triangle meshes
                    ^^^^^^^^^^^^^^
> >>     or quadrilateral strips (weird things will happen).  This has been
> >>     a "known bug" for so long, I wonder why they don't put a notice in
> >>     the manuals. :-)

> In article <80495 at bu.edu.bu.edu> tjh at ouzo.bu.edu (Tim Hall) wrote:
> >	Huh?  Whats the problem?  I use t-meshes on P.I.'s quite often
> >and never noticed a problem.  (running 3.3.2)
 
In article <1991Apr30.012309.22200 at ux1.cso.uiuc.edu>, andreess at mrlaxs.mrl.uiuc.edu (Marc Andreessen) wrote:
> Indeed... what is the problem?  (I know a number of people who are going
> to be very surprised if there really is one...)

Perhaps I should have said "SOMETIMES weird things will happen".   The 
example at the end of the Lighting Chapter in the Graphics Library 
Programming Guide works.  I'm not sure what invokes this behavior.

A code example follows.  Try compiling it with and without LIGHT #defined.
To compile-n-link:

     cc $(CFLAGS) tmesh_test.c -lgl_s -lm -o tmesh_test

If I'm doing something hopelessly stupid, please tell me.  Note that this 
is ONLY a problem on the Personal Iris.  This code works fine (with and 
without lighting) on GTX's and VGX's.  I have personally experienced this 
problem on 3.2, 3.3.1 and 3.3.2.  

I asked the cool (and extremely helpful) guys in the Dallas SGI office about
this behavior some time ago and they said, "That's a known bug on the PI. 
Use polygons with lighting".  So, no... I didn't report it to the hotline.

Oh, I'm using a 4D/25TG running 3.3.2.

...............................................................................  
Mary J. Cole        ARCO Oil & Gas Company 
mjcole at arco.com     2300 W. Plano Parkway; PRC-D3239; 
(214)754-6857       Plano, TX 75075 
...............................................................................  
I'm continually AMAZED at th'breathtaking effects of WIND EROSION!! -ZIPPY
............................................................................... 

BEGIN Test code.
............................................................................... 

#include <stdio.h>
#include <math.h>
#include <gl/gl.h>
#include <gl/device.h>

#define LIGHT 

Matrix Identity = 
{1, 0, 0, 0,
 0, 1, 0, 0,
 0, 0, 1, 0,
 0, 0, 0, 1};

float plane_normal[3] = {0.0, 0.0, 1.0};
float plane_polydata[4][3] = {
  {450, 450, 500},
  {450, 550, 500},
  {550, 450, 500},
  {550, 550, 500}
};
float plane_tmeshdata[4][3] = {
  {350, 350, 500},
  {350, 450, 500},
  {450, 350, 500},
  {450, 450, 500}
};
float plane_quaddata[4][3] = {
  {550, 550, 500},
  {550, 650, 500},
  {650, 550, 500},
  {650, 650, 500}
};

float Material[] = {
  AMBIENT, .0, .7, 1.1,
  DIFFUSE, .05, .18, .26,
  SPECULAR, .54, .60, .73,
  EMISSION, 0.0, 0.0, 0.0, 
  ALPHA, 1.0,
  SHININESS, 44.6,
  LMNULL 
  };

static float lm[] = {
  AMBIENT, .1, .1, .1,
  LOCALVIEWER, 1,
  LMNULL
  };

static float lt[] = {
  LCOLOR, 1, 1, 1,
  POSITION, 0, 0, 2500.0, 1,
  LMNULL
  };

main()
{
  long xorig, yorig, xsize, ysize;
  float rx, ry;
  short val;

  winopen("Test tmesh/qstrip");
  getorigin(&xorig, &yorig);
  getsize(&xsize, &ysize);

  doublebuffer(); 
  RGBmode();
  gconfig();
  lsetdepth(0, 0x7fffff);
  mmode(MVIEWING); 
  perspective(300, xsize/(float)ysize, 1.0, 1001.0);
  loadmatrix(Identity); 
  translate(0.0, 0.0, -750.0); 

#ifdef LIGHT
  lmdef(DEFMATERIAL, 1, 0, Material);
  lmdef(DEFLIGHT, 1, 0, lt);
  lmdef(DEFLMODEL, 1, 0, lm);
  lmbind(MATERIAL, 1);
  lmbind(LMODEL, 1);
  lmbind(LIGHT0, 1);
  lmcolor(LMC_DIFFUSE);
#endif LIGHT

  while (!getbutton(ESCKEY))
    {
      ry=300*(2.0*(getvaluator(MOUSEX)-xorig)/xsize-1.0);
      rx= -300*(2.0*(getvaluator(MOUSEY)-yorig)/ysize-1.0); 
      zbuffer(1);
      czclear(0x404040, 0x7fffff);
      pushmatrix();
      rot(ry, 'y');             /* Simulate rotations about (500, 500, 500) */
      rot(rx, 'x');             /* rather than (0, 0, 0) */
      translate(-500.0, -500.0, -500.0); 
      drawplane();
      popmatrix();
      swapbuffers(); 
    }
}

drawplane()
{
  bgnqstrip();
  cpack(0x00ffff00);
  n3f(plane_normal);
  v3f(plane_quaddata[0]);
  v3f(plane_quaddata[1]);
  v3f(plane_quaddata[2]);
  v3f(plane_quaddata[3]);
  endqstrip();

  bgntmesh();
  cpack(0x00ff00ff);
  n3f(plane_normal);
  v3f(plane_tmeshdata[0]);
  v3f(plane_tmeshdata[1]);
  v3f(plane_tmeshdata[2]);
  v3f(plane_tmeshdata[3]);
  endtmesh();

  bgnpolygon();
  cpack(0x0000ffff);
  n3f(plane_normal);
  v3f(plane_polydata[0]);
  v3f(plane_polydata[1]);
  v3f(plane_polydata[3]);
  v3f(plane_polydata[2]);
  endpolygon();
}


...............................................................................  

End Test code.
...............................................................................  



More information about the Comp.sys.sgi mailing list