1
0
mirror of synced 2025-01-18 09:04:52 +01:00

fix: Disable texture multisampling for now as it causes issues on certain platforms

This commit is contained in:
WerWolv 2024-05-03 14:02:43 +02:00
parent 4eba620bee
commit 57857559f5

View File

@ -68,38 +68,35 @@ namespace ImGuiExt {
if (filter == Texture::Filter::Nearest) if (filter == Texture::Filter::Nearest)
return texture; return texture;
// WebGL doesn't support multisampling #if 0
#if defined(OS_WEB) constexpr static auto SampleCount = 8;
return texture;
// Generate renderbuffer
GLuint renderbuffer;
glGenRenderbuffers(1, &renderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, SampleCount, GL_DEPTH24_STENCIL8, width, height);
// Generate framebuffer
GLuint framebuffer;
glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
// Attach texture to color attachment 0
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
// Attach renderbuffer to depth-stencil attachment
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, renderbuffer);
// Check framebuffer status
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
return 0;
}
// Unbind framebuffer
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#endif #endif
constexpr static auto SampleCount = 8;
// Generate renderbuffer
GLuint renderbuffer;
glGenRenderbuffers(1, &renderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, SampleCount, GL_DEPTH24_STENCIL8, width, height);
// Generate framebuffer
GLuint framebuffer;
glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
// Attach texture to color attachment 0
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
// Attach renderbuffer to depth-stencil attachment
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, renderbuffer);
// Check framebuffer status
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
return 0;
}
// Unbind framebuffer
glBindFramebuffer(GL_FRAMEBUFFER, 0);
return texture; return texture;
} }