Remove depth texture from RenderTexture struct
This commit is contained in:
parent
3e336e4470
commit
cfd233468a
|
|
@ -287,7 +287,6 @@ typedef Texture TextureCubemap;
|
||||||
typedef struct RenderTexture {
|
typedef struct RenderTexture {
|
||||||
unsigned int id; // OpenGL framebuffer object id
|
unsigned int id; // OpenGL framebuffer object id
|
||||||
Texture texture; // Color buffer attachment texture
|
Texture texture; // Color buffer attachment texture
|
||||||
Texture depth; // Depth buffer attachment texture
|
|
||||||
} RenderTexture;
|
} RenderTexture;
|
||||||
|
|
||||||
// RenderTexture2D, same as RenderTexture
|
// RenderTexture2D, same as RenderTexture
|
||||||
|
|
|
||||||
|
|
@ -4260,16 +4260,8 @@ RenderTexture2D LoadRenderTexture(int width, int height)
|
||||||
target.texture.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
|
target.texture.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
|
||||||
target.texture.mipmaps = 1;
|
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
|
// 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.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)
|
// Check if fbo is complete with attachments (valid)
|
||||||
if (rlFramebufferComplete(target.id)) TRACELOG(LOG_INFO, "FBO: [ID %i] Framebuffer object created successfully", target.id);
|
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;
|
bool result = false;
|
||||||
|
|
||||||
if ((target.id > 0) && // Validate OpenGL id (loaded on GPU)
|
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
|
IsTextureValid(target.texture)) result = true; // Validate FBO texture attachment
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user