danijar
danijar

Reputation: 34175

How to use texture as depth attachment?

I have a framebuffer with multiple render targets. All of them are textures and not renderbuffers. How can I use the A component of a RGBA texture as depth attachment? I want to use the default depth test.

Upvotes: 1

Views: 788

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473262

The alpha is not a depth component. And only images who's formats have a depth component can be bound to GL_DEPTH_ATTACHMENT.

And before you ask, there is no RGB_DEPTH_COMPONENT format.

There's no reason you can't create a texture with GL_DEPTH_COMPONENT24.

Upvotes: 1

Related Questions