Depthmaps in textures

Hey there!

Can textures have depth-maps in OpenGL?

Im trying to create a little texture with a view of an object, and I dont wanna mess-up the framebuffer.

Thanks
/Fredrik Olsson

I think you can store the depth values for each pixel in the alpha component in the texture. Of course this makes the texture need to be in 32bit color. I have never done anything like this yet so maybe some one else can give more info.

-SirKnight

Thank you for your input

That would work if I could get opengl to threat the textures alpha channel as a depth-buffer.

i.e make opengl compare/write z-values to it.

But I dont know if there is any way to do this…

nVIDIA cards GF3 and GF4Ti (but not MX) support this through the SGI shadow buffer extension (and possibly through other extensions as well; haven’t checked).

I’m not sure what other cards do this, though I wouldn’t be surprised if all the majors did it.

So i guess the GeForce 256/GeForce 2 GTS cant do it. If so i would like to know how! But ill be getting the GF4 Ti next weekend (28th) so its ok.

-SirKnight

Thank you for your input.

I have a GF2MX, so I can’t use the shadow buffer extension.
If there was a way to use a function similar to glDepthFunc() on textures you could render geometry to it as usual.

I don’t know if there is though, I’ll look into it, and post here if I find anything.