Make sure model rendering works with an odd number of atmospheres

This commit is contained in:
Malin E
2023-02-21 11:46:16 +01:00
parent 7484502db9
commit a877324c95
2 changed files with 20 additions and 1 deletions

View File

@@ -624,7 +624,7 @@ void RenderableModel::initializeGL() {
// Check status
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
LERROR("Framebuffer is not complete!");
LERROR("Framebuffer is not complete");
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -787,6 +787,21 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
// Prepare framebuffer
GLint defaultFBO = ghoul::opengl::FramebufferObject::getActiveObject();
glBindFramebuffer(GL_FRAMEBUFFER, _framebuffer);
// Re-bind first texture to use the currently not used Ping-Pong texture in the
// FramebufferRenderer
glFramebufferTexture(
GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
global::renderEngine->renderer()->additionalColorTexture1(),
0
);
// Check status
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
LERROR("Framebuffer is not complete");
}
glDrawBuffers(3, ColorAttachmentArray);
glClearBufferfv(GL_COLOR, 1, glm::value_ptr(glm::vec4(0.f, 0.f, 0.f, 0.f)));
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);