Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!munnari.oz.au!bruce!monu0.cc.monash.edu.au!monu6!minyos.xx.rmit.oz.au!godzilla!acas From: mpapp@ (Mike Papper) Newsgroups: comp.sys.sgi Subject: zbuffer lrectread Summary: I can't seem to read the contents of the zbuffer. Keywords: lrectread readsource SRC_ZBUFFER zbuffer Message-ID: Date: 11 Jun 91 15:32:29 GMT Sender: usenet@minyos.xx.rmit.oz.au (Njuiz noveles nova newes) Organization: RMIT Computer Centre, Melbourne Australia. Lines: 52 I have been trying to read the contents (of a small area) of the zbuffer using lrectread. All I seem to get is a smattering of 16777216s (i.e. almost 2 * 8388607 i.e. 2 * 0x7FFFFF), sometimes mixed in with other values. For instance after a zclear() i do the following: /* l,r,b,t are the left,right,bottom,and top points of a rectangle, in window coords. */ static long get_z_data( long l, long r, long b, long t) { long oldmode; unsigned long *ztemp; ztemp = (unsigned long *)ALLOC (sizeof(unsigned long) * (r-l+1)*(t-b+1)); oldmode = getdrawmode(); drawmode(NORMALDRAW); readsource(SRC_ZBUFFER); lrectread((Screencoord)l,(Screencoord)b,(Screencoord)r,(Screencoord)t,ztemp); readsource(SRC_AUTO); drawmode(oldmode); } On this particular machine (a GTX) getgdesc(GD_ZMAX) returns 8388607 i.e. 0x7FFFFF. Why does a zclear seem to fill the zbuffer with values twice this size (plus other values???)? I believe that since I'm using unsigned longs the "top" (or is it bottom) 8 bits of the word are zeros (since the zbuffer contains 24 bit values and I assume that unsigned longs are 32 bits), thus I should not need to use pixmode. Note: I have also tried writing to the zbuffer then reading it. I use zbuffer(1) followed by a lrectwrite, I bel;ieve zdraw() and the use of pixmode is uness. as zbuffer(1) will allow a subsequent write to go directly into the zbuffer -- in this case I write zbuffer values, not color indices. However, I still get the wrong results (I write different values and after a subsequent read, the values are the same). Does anyone have some strightforward code that reads the numeric zbuffer values from the current zbuffer? (These values shouyld always be in the range used in lsetdepth(near, far)). Email responses would be preffered. Mike Papper mpapp@godzilla.cgl.rmit.oz.au