REVIEWED: rlFramebufferAttach() to support texture layers

Required to attach multiple color textures and multiple cubemap faces
This commit is contained in:
raysan5
2020-09-18 11:37:57 +02:00
parent 6038c8fdd5
commit ccda320be4
2 changed files with 60 additions and 27 deletions

View File

@@ -2819,8 +2819,8 @@ RenderTexture2D LoadRenderTexture(int width, int height)
target.depth.mipmaps = 1;
// Attach color texture and depth renderbuffer/texture to FBO
rlFramebufferAttach(target.id, target.texture.id, RL_ATTACHMENT_COLOR_TEXTURE); // COLOR attachment
rlFramebufferAttach(target.id, target.depth.id, RL_ATTACHMENT_DEPTH_RENDERBUFFER); // DEPTH attachment
rlFramebufferAttach(target.id, target.texture.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_TEXTURE2D);
rlFramebufferAttach(target.id, target.depth.id, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER);
// Check if fbo is complete with attachments (valid)
if (rlFramebufferComplete(target.id)) TRACELOG(LOG_INFO, "FBO: [ID %i] Framebuffer object created successfully", target.id);