Imagination PowerVR SDK Blog

Depth texture attachment


#1

I’m trying to use a texture as frame buffer depth attachment.
glTexImage2D gives me an invalid parameter error when using GL_DEPTH_COMPONENT as pixel format. Using GL_UNSIGNED_BYTE as pixel type. Then the frame buffer check fails. My frame buffer works fine when I’m not trying to use that depth texture as depth attachment.

I’m on WinXP with NVidia GeForce GTS 250. OpenGL ES 2.0 ( SDK build: 2.06.26.0641 )
Extensions string contains GL_OES_depth_texture

What’s the trick to use texture as depth attachment?


#2

As I was writing the above question I suddenly remembered that I totally forgot to search the SDK for some examples. Silly me! Turns out the shadow mapping training course does use a depth textures and it uses GL_UNSIGNED_INT as pixel types. So my mistake was to use GL_UNSIGNED_BYTE as pixel type.


#3

I’m glad you managed to resolve the issue. It’s an easy mistake to make :slight_smile: