[comp.sys.sgi] update: RECTRE problems

trohling@uceng.UC.EDU (tom rohling) (12/04/89)

A few days back, I posted an article about RECTRE not appearing to be 
functioning right.  Well, here's an update.

Consider this piece of code:

      CALL READSO(1)
      TEST=RECTRE(1,1,640,484,SGIS)
      CALL COLOR(0)
      CALL CLEAR
      CALL MAPCOL(3,255,0,255)
      CALL RECTWR(1,1,640,484,SGIS)
      DO 10 II=1,309760
        IF(SGIS(II).EQ.3)THEN
          WRITE(6,*)II,SGIS(II)
        ENDIF
  10  CONTINUE

Here's the expanation:

      The window is only 640x484 in size.
      The window is cleared black and a few lines of large yellow(3) text
         are written across the window.
      I put the READSO there just to be safe and supress any 
         possibilities from this.
      Next, it loads the array SGIS, then I cleared the screen (just to 
         be sure), then redefine color 3 to see if it will show a change
         in color when I redraw the image. 
      Then call RECTWR to redraw the same image.
      That works just fine, with the text appearing as magenta, so its 
         in the array somehow.
    * This shows that RECTRE in functioning correctly.
      Now comes the strange part.
      I try to scan through the array and write all color 3 entries to
         the screen.  I know there are quite a few because the text changed 
         color when I redefined it.
      But nothing gets written to the screen which means (??) that there were
         no 3 entries in the comparison.
      This doesn't make any sense.

The array SGIS is declared as INTEGER*2, but are the elements of that array
written in some goofy fashion like hex or something?  When I tried to write
out the entire array, it was mostly large negative numbers (like -24000 
something) but I know SGIS is correct else RECTWR wouldn't have given the
correct results.

What !exactly! is the format of the result of RECTRE (details!)???

Any clues??

Tom Rohling
CFD dude
Aerospace Eng.
University of Cincinnati

trohling@uceng.uc.edu

==========================================================================
 If your standing on the North Pole, what time is it?
==========================================================================

tarolli@riva.esd.sgi.com (Gary Tarolli) (12/05/89)

In article <3022@uceng.UC.EDU>, trohling@uceng.UC.EDU (tom rohling) writes:
> 
> A few days back, I posted an article about RECTRE not appearing to be 
> functioning right.  Well, here's an update.
> 
	.
	.
	.

> 
> What !exactly! is the format of the result of RECTRE (details!)???
> 


If you say "man rectread" on 3.2, you get the following NOTES section in
the man page

NOTES
     These routines are available only in immediate mode.

     On IRIS-4D GT and GTX models, the upper 4 bits of the 16-bit values
     returned by rectread are undefined, and its performance will suffer if
     x2 - x1 + 1 is odd.

If you are running on a GT or GTX model (you didn't say, but from your
problem it sounds like you are), then
I think your problem is that the upper 4 bits of the 16 bit values are
indeed undefined, and are probably not 0!  This would make your comparison
to "3" fail even though the pixel is indeed color 3.  Hope this helps.


--
						Gary Tarolli