viewport (scrmask also) clipping problems with lrectwrite()

Avinash Chopde avinash at contex.UUCP
Sun Feb 25 07:13:35 AEST 1990


Help!
I have this program segment which uses rectzoom(), sets a viewport(),
and then uses lrectwrite().
It works correctly most of the time, but fails for the program given
below -- it draws the clipped part correctly, but also draws the same
stuff on 100 pixels on the left part of the screen (some sort of
"folding" around).
What makes matters worse, can't seem to figure out the condition
under which it fails -- have exprimented a bit with it.

Any help with regards to pointing out errors in the program, or
description of known bugs in the case of lrectwrite() clipping would be
greatly appreciated.

(Program fails on IRIX 3.2.1 as well as 3.2)
----------------- cut here ---------------------------------
#include <gl.h>
main()
{
      long lrect_buffer[XMAXSCREEN+1];
      unsigned char uc[4];
      int i;

      ginit(); RGBmode(); gconfig();
      RGBcolor(0,0,0); clear();

      uc[0] = 0;
      uc[1] = uc[2] = uc[3] = 128;

      for (i = 0; i <= XMAXSCREEN; i ++) {
	 lrect_buffer[i] = *(long *)uc;
      }

      rectzoom(2.0, 2.0);
      viewport((Screencoord)(700), (Screencoord)(1100), /* x limits */
	       (Screencoord)(200), (Screencoord)(800)); /* y limits */

      for (i = 799; i >= 200; i -= 2) {

         lrectwrite((Screencoord)(0), (Screencoord)(i), /* lower left */
		    (Screencoord)(599), (Screencoord)(i), /* upper right */
		    lrect_buffer);
      }
      gflush();

      sleep(5);
}
----------------- end of cut ---------------------------------
-- 
---------------------------
Avinash Chopde                         home :   508 470 1190
contex!avinash at uunet.uu.net            office : 617 245 9004 x5582



More information about the Comp.sys.sgi mailing list