diff --git a/src/main.cpp b/src/main.cpp index 439129f..437e849 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1233,8 +1233,9 @@ int main(int argc, char* argv[]) // Create window with graphics context SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); - SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); + // Nothing in the app uses depth/stencil (ImGui + acrylic are color-only): request none. + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0); + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0); SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY | SDL_WINDOW_TRANSPARENT); @@ -1268,6 +1269,11 @@ int main(int argc, char* argv[]) } SDL_GL_MakeCurrent(window, gl_context); + { int d = -1, s = -1; + const bool okd = SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &d); + const bool oks = SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &s); + DEBUG_LOGF("GL default framebuffer: depth=%d%s stencil=%d%s\n", + d, okd ? "" : " (no attachment)", s, oks ? "" : " (no attachment)"); } SDL_GL_SetSwapInterval(1); // Enable vsync bool backdrop_active = false; diff --git a/src/ui/effects/framebuffer.cpp b/src/ui/effects/framebuffer.cpp index 0a0a65c..7eb5201 100644 --- a/src/ui/effects/framebuffer.cpp +++ b/src/ui/effects/framebuffer.cpp @@ -35,14 +35,12 @@ Framebuffer::~Framebuffer() Framebuffer::Framebuffer(Framebuffer&& other) noexcept : fbo_(other.fbo_) , colorTexture_(other.colorTexture_) - , depthRbo_(other.depthRbo_) , width_(other.width_) , height_(other.height_) , isComplete_(other.isComplete_) { other.fbo_ = 0; other.colorTexture_ = 0; - other.depthRbo_ = 0; other.width_ = 0; other.height_ = 0; other.isComplete_ = false; @@ -55,14 +53,12 @@ Framebuffer& Framebuffer::operator=(Framebuffer&& other) noexcept fbo_ = other.fbo_; colorTexture_ = other.colorTexture_; - depthRbo_ = other.depthRbo_; width_ = other.width_; height_ = other.height_; isComplete_ = other.isComplete_; other.fbo_ = 0; other.colorTexture_ = 0; - other.depthRbo_ = 0; other.width_ = 0; other.height_ = 0; other.isComplete_ = false; @@ -104,19 +100,12 @@ bool Framebuffer::init(int width, int height, bool useFloat16) // Attach color texture to framebuffer glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorTexture_, 0); - // Create depth renderbuffer (optional, but good for completeness) - glGenRenderbuffers(1, &depthRbo_); - glBindRenderbuffer(GL_RENDERBUFFER, depthRbo_); - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depthRbo_); - // Check completeness isComplete_ = checkComplete(); // Unbind glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindTexture(GL_TEXTURE_2D, 0); - glBindRenderbuffer(GL_RENDERBUFFER, 0); if (!isComplete_) { DEBUG_LOGF("Framebuffer::init - Framebuffer is not complete!\n"); @@ -146,10 +135,6 @@ void Framebuffer::cleanup() glDeleteTextures(1, &colorTexture_); colorTexture_ = 0; } - if (depthRbo_) { - glDeleteRenderbuffers(1, &depthRbo_); - depthRbo_ = 0; - } if (fbo_) { glDeleteFramebuffers(1, &fbo_); fbo_ = 0; @@ -194,7 +179,7 @@ void Framebuffer::unbind() void Framebuffer::clear(float r, float g, float b, float a) { glClearColor(r, g, b, a); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT); } void Framebuffer::blitFrom(GLuint srcFbo, int srcX, int srcY, int srcWidth, int srcHeight, diff --git a/src/ui/effects/framebuffer.h b/src/ui/effects/framebuffer.h index 3522064..c8610d9 100644 --- a/src/ui/effects/framebuffer.h +++ b/src/ui/effects/framebuffer.h @@ -125,7 +125,6 @@ private: GLuint fbo_ = 0; GLuint colorTexture_ = 0; - GLuint depthRbo_ = 0; // Renderbuffer for depth (optional) int width_ = 0; int height_ = 0;