Replace temp framebuffer blit with a final draw call in ProjectM class

This avoids two fullscreen draw calls during transitions, and should also be slightly faster than using glBlitFramebuffer().

As with all drawing operations, we currently don't really care about the target framebuffer size or aspect ratio and just draw a quad over the whole viewport.
This commit is contained in:
Kai Blaschke
2023-11-07 23:45:59 +01:00
parent aaf2f7485c
commit 5e54983e6d
5 changed files with 38 additions and 21 deletions

View File

@ -28,6 +28,7 @@
#include "Audio/BeatDetect.hpp"
#include "Audio/PCM.hpp" //Sound data handler (buffering, FFT, etc.)
#include "Renderer/CopyTexture.hpp"
#include "Renderer/PresetTransition.hpp"
#include "Renderer/TextureManager.hpp"
#include "Renderer/TransitionShaderManager.hpp"
@ -217,11 +218,17 @@ void ProjectM::RenderFrame()
// ToDo: Call the to-be-implemented render method in Renderer
m_activePreset->RenderFrame(audioData, renderContext);
// ToDo: Allow external apps to provide a custom target framebuffer.
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
if (m_transition != nullptr && m_transitioningPreset != nullptr)
{
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
m_transition->Draw(*m_activePreset, *m_transitioningPreset, renderContext, audioData);
}
else
{
m_textureCopier->Draw(m_activePreset->OutputTexture(), false, false);
}
m_frameCount++;
}
@ -246,6 +253,8 @@ void ProjectM::Initialize()
m_transitionShaderManager = std::make_unique<TransitionShaderManager>();
m_textureCopier = std::make_unique<CopyTexture>();
m_presetFactoryManager->initialize();
/* Set the seed to the current time in seconds */