Results 1 to 5 of 5

Thread: reading the depth buffer.

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2006
    Location
    Italy
    Posts
    8

    reading the depth buffer.

    hi,
    how can i read the depth buffer?

    thanks.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Berlin, Germany
    Posts
    188

    Re: reading the depth buffer.

    glReadPixels is what you need.
    355/113 -- Not the famous irrational number PI, but an incredible simulation!

  3. #3
    Senior Member Regular Contributor
    Join Date
    May 2001
    Posts
    200

    Re: reading the depth buffer.

    Depends on what you want to do but if your hardware supports it:
    Code :
    				glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);//GL_LINEAR);
    				glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_NEAREST);// GL_LINEAR);
     
    				glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8_EXT, _iWidth, _iHeight, 0, 
    				             GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, NULL);
    and then bind to an fbo...

    After rending you can read this as a texture.

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2006
    Location
    Italy
    Posts
    8

    Re: reading the depth buffer.

    what kind of texturization is it?

  5. #5
    Junior Member Newbie
    Join Date
    Jan 2006
    Location
    Italy
    Posts
    8

    Re: reading the depth buffer.

    I want to read the depth buffer to know the distance on a line. at the moment i use

    glreadpixel(0,height/2,width,1,GL_DEPTH..,GL_FLOAT,pointer);

    but the array is not so good i try to change the SCALE and BIAS, but i have no idea...
    maybe i have to use GL_BYTE?
    thanks

Similar Threads

  1. Reading depth buffer with glReadPixels
    By imported_tksuoran in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 11-11-2010, 02:28 AM
  2. Reading and testing a depth buffer
    By Jose Goruka in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 06-08-2009, 05:09 PM
  3. Depth buffer reading and depth buffer test
    By BurningLegion in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 03-15-2007, 04:09 AM
  4. Depth Buffer Reading
    By Lloyd in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 11-08-2000, 07:24 AM
  5. Help reading from depth buffer
    By Dupre in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-21-2000, 03:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean