Skip to content

Commit b0cdf4d

Browse files
committed
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.
1 parent 91f3291 commit b0cdf4d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/libprojectM/ProjectM.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void ProjectM::ResetTextures()
9090
m_textureManager = std::make_unique<Renderer::TextureManager>(m_textureSearchPaths);
9191
}
9292

93-
void ProjectM::RenderFrame()
93+
void ProjectM::RenderFrame(uint32_t targetFramebufferObject /*= 0*/)
9494
{
9595
// Don't render if window area is zero.
9696
if (m_windowWidth == 0 || m_windowHeight == 0)
@@ -166,8 +166,7 @@ void ProjectM::RenderFrame()
166166
// ToDo: Call the to-be-implemented render method in Renderer
167167
m_activePreset->RenderFrame(audioData, renderContext);
168168

169-
// ToDo: Allow external apps to provide a custom target framebuffer.
170-
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
169+
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, static_cast<GLuint>(targetFramebufferObject));
171170

172171
if (m_transition != nullptr && m_transitioningPreset != nullptr)
173172
{

src/libprojectM/ProjectM.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class PROJECTM_EXPORT ProjectM
101101

102102
void ResetTextures();
103103

104-
void RenderFrame();
104+
void RenderFrame(uint32_t targetFramebufferObject = 0);
105105

106106
void SetBeatSensitivity(float sensitivity);
107107

0 commit comments

Comments
 (0)