RenderTexture: commented out unused code

This commit is contained in:
korenkonder
2024-06-14 20:30:58 +03:00
parent fb3f2801d3
commit 6ae99f64ff
2 changed files with 41 additions and 19 deletions
+37 -17
View File
@@ -16,8 +16,8 @@ static int32_t render_texture_init_framebuffer(RenderTexture* rt, int32_t max_le
static int32_t render_texture_set_framebuffer_texture(RenderTexture* rrt,
GLuint color_texture, int32_t level, GLuint depth_texture, bool stencil);
RenderTexture::RenderTexture() : color_texture(),
depth_texture(), binding(), max_level(), fbos(), rbo(), field_2C() {
RenderTexture::RenderTexture() : color_texture(), depth_texture(),
binding(), max_level(), fbos(), depth_rbo(), stencil_rbo() {
}
@@ -48,15 +48,15 @@ void RenderTexture::Free() {
color_texture = 0;
}
if (rbo) {
glDeleteRenderbuffers(1, &rbo);
rbo = 0;
/*if (depth_rbo) {
glDeleteRenderbuffers(1, &depth_rbo);
depth_rbo = 0;
}
if (field_2C) {
glDeleteRenderbuffers(1, &field_2C);
field_2C = 0;
}
if (stencil_rbo) {
glDeleteRenderbuffers(1, &stencil_rbo);
stencil_rbo = 0;
}*/
if (fbos) {
glDeleteFramebuffers(max_level + 1, fbos);
@@ -123,6 +123,26 @@ int32_t RenderTexture::Init(int32_t width, int32_t height,
return 0;
}
/*int32_t RenderTexture::InitDepthRenderbuffer(GLenum internal_format, int32_t width, int32_t height) {
gl_state_bind_framebuffer(fbos[0]);
glGenRenderbuffers(1, &depth_rbo);
glBindRenderbuffer(GL_RENDERBUFFER, depth_rbo);
glRenderbufferStorage(GL_RENDERBUFFER, internal_format, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth_rbo);
gl_state_bind_framebuffer(0);
return -(glGetError() != GL_ZERO);
}
int32_t RenderTexture::InitStencilRenderbuffer(GLenum internal_format, int32_t width, int32_t height) {
gl_state_bind_framebuffer(fbos[0]);
glGenRenderbuffers(1, &stencil_rbo);
glBindRenderbuffer(GL_RENDERBUFFER, stencil_rbo);
glRenderbufferStorage(GL_RENDERBUFFER, internal_format, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, stencil_rbo);
gl_state_bind_framebuffer(0);
return -(glGetError() != GL_ZERO);
}*/
int32_t RenderTexture::SetColorDepthTextures(GLuint color_texture,
int32_t max_level, GLuint depth_texture, bool stencil) {
int32_t error = 0;
@@ -170,11 +190,11 @@ static int32_t render_texture_set_framebuffer_texture(RenderTexture* rt,
if (depth_texture)
glFramebufferTexture(GL_FRAMEBUFFER,
GL_DEPTH_STENCIL_ATTACHMENT, depth_texture, 0);
else if (rt->rbo) {
glBindRenderbuffer(GL_RENDERBUFFER, rt->rbo);
/*else if (rt->depth_rbo) {
glBindRenderbuffer(GL_RENDERBUFFER, rt->depth_rbo);
glFramebufferRenderbuffer(GL_FRAMEBUFFER,
GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rt->rbo);
}
GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rt->depth_rbo);
}*/
else
glFramebufferTexture(GL_FRAMEBUFFER,
GL_DEPTH_STENCIL_ATTACHMENT, 0, 0);
@@ -183,11 +203,11 @@ static int32_t render_texture_set_framebuffer_texture(RenderTexture* rt,
if (depth_texture)
glFramebufferTexture(GL_FRAMEBUFFER,
GL_DEPTH_ATTACHMENT, depth_texture, 0);
else if (rt->rbo) {
glBindRenderbuffer(GL_RENDERBUFFER, rt->rbo);
/*else if (rt->depth_rbo) {
glBindRenderbuffer(GL_RENDERBUFFER, rt->depth_rbo);
glFramebufferRenderbuffer(GL_FRAMEBUFFER,
GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->rbo);
}
GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth_rbo);
}*/
else
glFramebufferTexture(GL_FRAMEBUFFER,
GL_DEPTH_ATTACHMENT, 0, 0);