Add optional FBO ID parameter to render function.

This will allow external apps to pass in any custom FBO to render to. Defaults to 0, keeping previous behavior if not given.
This commit is contained in:
Kai Blaschke
2024-06-08 17:20:00 +02:00
parent 91f329111f
commit b0cdf4de7b
2 changed files with 3 additions and 4 deletions

View File

@ -90,7 +90,7 @@ void ProjectM::ResetTextures()
m_textureManager = std::make_unique<Renderer::TextureManager>(m_textureSearchPaths);
}
void ProjectM::RenderFrame()
void ProjectM::RenderFrame(uint32_t targetFramebufferObject /*= 0*/)
{
// Don't render if window area is zero.
if (m_windowWidth == 0 || m_windowHeight == 0)
@ -166,8 +166,7 @@ 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);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, static_cast<GLuint>(targetFramebufferObject));
if (m_transition != nullptr && m_transitioningPreset != nullptr)
{