Depth buffer to depth texture

Hi,
I already found a solution to my problem on various places, but it’s always about FBOs, and I would like to use another simplier solution, because it seems that even “relatively recent” graphics cards doesn’t support FBOs.
For copying the color buffer to a texture, I already use glCopyTexImage2D, wich is pretty fast. Is there a similar way to copy the depth buffer to another texture ?
Thanks :slight_smile:

Oh I’m sorry, I just realized it may not be the right section, but actually I want to use this later for GLSL

ARB_depth_texture defines that you can use glCopyTex(Sub)Image2D to copy the depth buffer contents into a depth texture.

Ok, but how should I do to tell OpenGL I want the depth buffer and not the color buffer to be copied by glCopyTexImage2D ?

Ok, but how should I do to tell OpenGL I want the depth buffer and not the color buffer to be copied by glCopyTexImage2D ?

You don’t need to; OpenGL is smart. It will only copy the pixels that are of the appropriate format as the texture you’re copying to. So if you’re copying to a depth texture, it will copy the depth component of the buffer. Similarly for color and/or stencil.

Wow, really ? OpenGL rocks :slight_smile:
Thanks you both for your answers