problem with erasing rectsngle boundaries

Mark Overmars markov at cs.ruu.nl
Mon Apr 22 18:13:57 AEST 1991


When running the following program the black frame is not completely
overwritten by the red rectangle. Why is this? Is this an error? Or should
I draw the rectangle frame differently (e.g. in a different order). 
(I need this because sometimes I want to draw a frame around a rectangle and
sometimes not. When drawing the rectangle without the fram it should of course
erase the previous rectangle and the frame.)

Mark Overmars

#include <gl/gl.h>

vv(float x,float y)
  { float v[2] ; v[0] = x; v[1] = y; v2f(v);}

draw_rect(float x, float y, float w, float h)
{
  color(BLACK);
  bgnclosedline(); vv(x,y); vv(x,y+h); vv(x+w,y+h); vv(x+w,y); endclosedline();
  color(RED);
  bgnpolygon();    vv(x,y); vv(x,y+h); vv(x+w,y+h); vv(x+w,y); endpolygon();
}

main()
{
  winopen("TEST");
  color(WHITE); clear();
  draw_rect(50.0,50.0,100.0,100.0);
  sleep(20);
}



More information about the Comp.sys.sgi mailing list