Skip to content

Accessing depth component of RenderTexture2D #1579

Answered by raysan5
benbeshara asked this question in Q&A
Discussion options

You must be logged in to vote

By default raylib loads RenderTexture depth as a RenderBuffer instead of a Texture2D for optimization, that's the reason it can not be drawn.

To be able to draw it, you should load it as a Texture2D instead... at this point there is no mechanism in raylib that allows that, you should modify source code:

// textures.c -> LoadRenderTexture()
target.depth.id = rlLoadTextureDepth(width, height, false);

raylib is intended for basic usage, for advance 3d usage you should use rlgl functionality directly... but as you are using a binding that's not exposed...

In any case, I take note for a future update to allow changing that behaviour from the main API.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@benbeshara
Comment options

Answer selected by raysan5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants