Jump to content
  • Advertisement
Sign in to follow this  
DimaSi

OpenGL FBO: render to texture using screen depth buffer

This topic is 4101 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys! I need to render to texure with updating real screen depth buffer. I know, it's possible in DirectX, but i can't find, how can i implement this using FBO in OpenGL. Is it possible at all ? What is the best way to do this. Can you help me ? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Yes, this is possible using an OpenGL Extension called GL_EXT_framebuffer_object. I've used it myself and it works great. The only problem is that not all video cards support it. Here are a few websites for you to look at:

A good tutorial about the FBO extension with source code:
http://www.gamedev.net/reference/programming/features/fbo1/default.asp

The official documentation of the FBO extension:
http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt

The OpenGL hardware registry where you can see which video cards support which extensions:
http://www.delphi3d.net/hardware/index.php

You may also want to research Pbuffers (and WGL_ARB_render_texture, a Windows-specific extension built on top of Pbuffers), a method you can use as a fallback in case the user's graphics card doesn't support the FBO extension. Pbuffers are older, harder to use, and not as efficient as FBOs.

[Edited by - pkfx on September 26, 2007 4:52:59 PM]

Share this post


Link to post
Share on other sites
Try GL_EXT_framebuffer_blit with GL_DRAW_FRAMEBUFFER_EXT equal to 0 and GL_READ_FRAMEBUFFER_EXT equal to your FBO. I haven't tested it so i don't know if this works.

EDIT : If you are looking for a way to directly use the window depth buffer for your FBO, i don't think it's possible. That's why i suggested blitting the results from your FBO to the window depth buffer, after rendering.

HellRaiZer

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!