Re: seeing the depth buffer

New Message Reply Date view Thread view Subject view Author view

Don Burns (don_burns++at++peru.engr.sgi.com)
Fri, 10 Dec 1999 10:28:06 -0800 (PST)


On Dec 10, 5:17am, William Sherman -Visualization wrote:
> Subject: seeing the depth buffer
> Hi all,
>
> In days gone by, I recall a Performer demo that mapped the contents of
> the depth buffer to a visual representation. This was basically done
> for the purpose of showing how the depth buffer works, which is what
> I would like to use it for.
>
> I checked "perfly" and Angus' web page, but I didn't find anything
> the appeared to be what I was looking for -- I thought perhaps it
> had beenn an option to perfly.
>
> Doesn't anyone know if this demo is still around anywhere?
>

I don't know about a demo, but this is easy enough to do if you want to try it.
 Take any of your friendly performer examples that has a draw callback (like
complex.C). Right after pfDraw() add this code:

    float buff[1000000];
    glReadPixels( 0, 0, Shared->winSizeX, Shared->winSizeY,
                                GL_DEPTH_COMPONENT, GL_FLOAT, buff );
    glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
    glMatrixMode( GL_PROJECTION );
    glLoadIdentity();
    glOrtho( 0, 1, 0, 1, -1, 1 );
    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity();
    glRasterPos2f( 0, 0 );
    glDrawPixels( Shared->winSizeX, Shared->winSizeY,
                GL_LUMINANCE, GL_FLOAT, buff );

-don


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Fri Dec 10 1999 - 10:28:11 PST

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