glReadPixels

New Message Reply Date view Thread view Subject view Author view

WILLIAM_MARINELLI++at++ntsc.navy.mil
Mon, 13 Jan 97 12:35:29 EST


     I'm posting this to both groups because it's a vega app but seems
     applicable to both in the context of a post draw callback.
      
     Opinions about using glReadPixels to approximte the distance an object
     is away from the eyepoint (simulate a laser range finder)?
      
     I use
      
     glReadPixels(640,512,1,1,GL_DEPTH_COMPONENT,GL_FLOAT,f);
      
                  ^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^^
                  middle 1 z buffer value
                  of pixel
                  screen
      
      
     then try to scale it appropriately with the near and far clip planes.
      
     f returns with a float value between 0 and one. I suppose that the
     Ifinite Reality Floating point z buffer has been accounted for when
     this float is spit out.
      
     At this point the returned depth buffer value is scaled quite large;
     ie, you pitch down to the ground and the returned value is still quite
     high (.4).

=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:54:19 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.