Skip to content

Commit

Permalink
Add API function to enable rendering to custom FBO IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
kblaschke committed Jun 8, 2024
1 parent b0cdf4d commit bd2b1ba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/api/include/projectM-4/render_opengl.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ extern "C" {
/**
* @brief Renders a single frame.
*
* @note Separate two-pass frame rendering is currently not supported by the C API as it is rarely used
* and also depends on the loaded preset.
*
* @param instance The projectM instance handle.
*/
PROJECTM_EXPORT void projectm_opengl_render_frame(projectm_handle instance);

/**
* @brief Renders a single frame into a user-defined framebuffer object.
*
* @param instance The projectM instance handle.
* @param framebuffer_object_id The OpenGL FBO ID to render to.
*/
PROJECTM_EXPORT void projectm_opengl_render_frame_fbo(projectm_handle instance, uint32_t framebuffer_object_id);

#ifdef __cplusplus
} // extern "C"
#endif
8 changes: 8 additions & 0 deletions src/libprojectM/ProjectMCWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <cstring>
#include <sstream>
#include <projectM-4/render_opengl.h>


namespace libprojectM {

Expand Down Expand Up @@ -171,6 +173,12 @@ void projectm_opengl_render_frame(projectm_handle instance)
projectMInstance->RenderFrame();
}

void projectm_opengl_render_frame_fbo(projectm_handle instance, uint32_t framebuffer_object_id)
{
auto projectMInstance = handle_to_instance(instance);
projectMInstance->RenderFrame(framebuffer_object_id);
}

void projectm_set_beat_sensitivity(projectm_handle instance, float sensitivity)
{
auto projectMInstance = handle_to_instance(instance);
Expand Down

0 comments on commit bd2b1ba

Please sign in to comment.