Remove depth texture from RenderTexture struct

This commit is contained in:
M374LX 2025-06-12 18:28:40 -03:00
parent 3e336e4470
commit cfd233468a
2 changed files with 0 additions and 10 deletions

View File

@ -287,7 +287,6 @@ typedef Texture TextureCubemap;
typedef struct RenderTexture {
unsigned int id; // OpenGL framebuffer object id
Texture texture; // Color buffer attachment texture
Texture depth; // Depth buffer attachment texture
} RenderTexture;
// RenderTexture2D, same as RenderTexture

View File

@ -4260,16 +4260,8 @@ RenderTexture2D LoadRenderTexture(int width, int height)
target.texture.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
target.texture.mipmaps = 1;
// Create depth renderbuffer/texture
target.depth.id = rlLoadTextureDepth(width, height, true);
target.depth.width = width;
target.depth.height = height;
target.depth.format = 19; //DEPTH_COMPONENT_24BIT?
target.depth.mipmaps = 1;
// Attach color texture and depth renderbuffer/texture to FBO
rlFramebufferAttach(target.id, target.texture.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_TEXTURE2D, 0);
rlFramebufferAttach(target.id, target.depth.id, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
// Check if fbo is complete with attachments (valid)
if (rlFramebufferComplete(target.id)) TRACELOG(LOG_INFO, "FBO: [ID %i] Framebuffer object created successfully", target.id);
@ -4314,7 +4306,6 @@ bool IsRenderTextureValid(RenderTexture2D target)
bool result = false;
if ((target.id > 0) && // Validate OpenGL id (loaded on GPU)
IsTextureValid(target.depth) && // Validate FBO depth texture/renderbuffer attachment
IsTextureValid(target.texture)) result = true; // Validate FBO texture attachment
return result;