[comp.sys.sgi] viewport

avinash@contex.UUCP (Avinash Chopde) (02/25/90)

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@uunet.uu.net            office : 617 245 9004 x5582

avinash@contex.UUCP (Avinash Chopde) (02/25/90)

With reference to my previous posting (lrectwrite() not clipping
correctly to the viewport()), seems like the graphics boards are the
key to the problem.
Given program fails on machines with this (hinv)
"Graphics board: GR1.1 ..."
while it works correctly on  machines with
"Graphics board: GR1.2 ..."

So, does anybody know of a workaround for the problem for GR1.1 machines ?
Any pointers will be greatly appreciated.
-- 
---------------------------
Avinash Chopde                         home :   508 470 1190
contex!avinash@uunet.uu.net            office : 617 245 9004 x5582