Skip to main content
GameDev.net gamedev.net
🔒 Locked

Depthbuffer and FBO

Started by Promag Oct 19, 2005 at 1:13 PM 0 replies 1.1k views
Original Post
Promag
Promag
I have set one FBO: 2 color texture attachments 1 depth texture attachment I can display those textures and its all ok. Now I want to read the depthbuffer with glReadPixels but it fails. Also Im using PBO for async copying. Here is some code: GLuint attachments[4] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_DEPTH_ATTACHMENT_EXT }; glBindBuffer(GL_PIXEL_PACK_BUFFER_EXT, pbo[3]); glReadBuffer(attachments[3]); glReadPixels(0,0,width,height,GL_DEPTH_COMPONENT, GL_FLOAT, BUFFER_OFFSET(0)); glBindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, pbo[3]); return (float*) glMapBuffer(GL_PIXEL_PACK_BUFFER_EXT, GL_READ_ONLY); Do I need to bind the FBO? This code works for mapping a colorbuffer (with some minor changes). Thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.