polymode(PYM_HOLLOW)

Bernhard Hofmann hofmann at mira.tat.physik.uni-tuebingen.de
Tue Apr 30 01:55:01 AEST 1991


I'm having trouble with polymode(PYM_HOLLOW) on our VGX with alpha bitplanes.
The following program doesn't quite do what I think it should do.
I think it should draw, when in polymode(PYM_HOLLOW), only the red corner
and the outlines of the cube. What happens on our machine is that after
switching to PYM_HOLLOW the red and the green corners appear with all
three lines leading to them as well as all other lines of the outline,
except the righthand one. All lines that are drawn appear either thicker
or thinner when switching from polymode(OYM_LINE) to polymode(PYM_HOLLOW).
When you run the below program, press l or L to see the Cube drawn with
polymode(PYM_LINE) or h or H to see it drawn with polymode(PYM_HOLLOW).
This is only a sample program demonstrating the effect and therefore not
very carefully written.

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


short *s3(short x, short y, short z);


float corners[8][3] = {
  {-0.5,-0.5,-0.5},
  {-0.5,-0.5,0.5},
  {-0.5,0.5,0.5},
  {-0.5,0.5,-0.5},
  {0.5,-0.5,-0.5},
  {0.5,-0.5,0.5},
  {0.5,0.5,0.5},
  {0.5,0.5,-0.5}
};

short *s3(short x, short y, short z) {
  static short w[3];
  w[0]=x; w[1]=y; w[2]=z;
  return w;
}


main() {
  short value;

  foreground();
  keepaspect(1,1);
  winopen("Cube");
  zbuffer(TRUE);
  zclear();
  doublebuffer();
  mmode(MVIEWING);
  ortho(-1.1,1.1,-1.1,1.1,-1.1,1.1);
  RGBmode();
  stensize(8);  /*  for polymode(PYM_HOLLOW) */
  lookat(0,0,0,1,1.1,1.2,0);
  gconfig();
  sclear(0);

  qdevice(KEYBD);
  qdevice(ESCKEY);



  makeobj(1);

  zclear();
  c3s(s3(0,0,0));
  clear();
  c3s(s3(255,80,0));

  bgnpolygon();
  c3s(s3(255,0,0));
    v3f(corners[0]);
  c3s(s3(255,80,0));
    v3f(corners[1]);
    v3f(corners[2]);
    v3f(corners[3]);
  endpolygon();
  bgnpolygon();
    v3f(corners[4]);
    v3f(corners[5]);
  c3s(s3(0,255,0));
    v3f(corners[6]);
  c3s(s3(255,80,0));
    v3f(corners[7]);
  endpolygon();
  bgnpolygon();
  c3s(s3(255,0,0));
    v3f(corners[0]);
  c3s(s3(255,80,0));
    v3f(corners[1]);
    v3f(corners[5]);
    v3f(corners[4]);
  endpolygon();
  bgnpolygon();
  c3s(s3(255,0,0));
    v3f(corners[0]);
  c3s(s3(255,80,0));
    v3f(corners[3]);
    v3f(corners[7]);
    v3f(corners[4]);
  endpolygon();
  bgnpolygon();
    v3f(corners[2]);
    v3f(corners[1]);
    v3f(corners[5]);
  c3s(s3(0,255,0));
    v3f(corners[6]);
  c3s(s3(255,80,0));
  endpolygon();
  bgnpolygon();
    v3f(corners[2]);
    v3f(corners[3]);
    v3f(corners[7]);
  c3s(s3(0,255,0));
    v3f(corners[6]);
  endpolygon();
  closeobj();

  while(qread(&value) != ESCKEY) {
    switch (value) {
    case 'h':
    case 'H':
      polymode(PYM_HOLLOW);
      stencil(TRUE,1,SF_EQUAL,1,ST_KEEP,ST_KEEP,ST_KEEP);
      sclear(0);
      gconfig();
      callobj(1);
      swapbuffers();
      break;
    case 'l':
    case 'L':
      polymode(PYM_LINE);
      stencil(FALSE,1,SF_EQUAL,1,ST_KEEP,ST_KEEP,ST_KEEP);
      gconfig();
      callobj(1);
      swapbuffers();
      break;
    }
  }

  gexit();
}
******************************************************************************

Thank you very much for any hints.

Bernhard Hofmann

hofmann at mira.tat.physik.uni-tuebingen.de



More information about the Comp.sys.sgi mailing list