View Full Version : Depthmaps in textures

02-21-2002, 09:42 AM
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.

/Fredrik Olsson

02-21-2002, 03:33 PM
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.


02-21-2002, 05:46 PM
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...

02-21-2002, 06:34 PM
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.

02-21-2002, 06:47 PM
So i guess the GeForce 256/GeForce 2 GTS cant do it. If so i would like to know how! http://www.opengl.org/discussion_boards/ubb/smile.gif But ill be getting the GF4 Ti next weekend (28th) so its ok. http://www.opengl.org/discussion_boards/ubb/smile.gif


02-22-2002, 06:57 PM
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.