Skip to content

Add support for rendering to custom textures and FBOs #659

@kblaschke

Description

@kblaschke

Currently, projectM is only able to render to any native/current surface and render-to-texture support was broken/unimplemented in 3.x and was removed in the 4.1 release renderer rewrite.

To enable proper integration into other applications, projectM should internally render to a framebuffer object, either a self-created one or an existing FBO provided by the external application. projectM should also make sure that the proper render states (e.g. disabling and reenabling the depth buffer) are set before rendering to prevent render errors.

Steps to implement:

  • Add FBO initialization/creation methods to the renderer.
  • Add API functions to set and get the FBO ID.
  • Initialize an internal FBO if render_frame() is called without specifying an external FBO (or the get function is called) or use the currently bound buffer.
  • Make sure all rendering states are set properly before each frame.
  • Reset global render states to previous values if possible.

As an alternative to passing in a custom FBO, it should also be possible to either retrieve a texture Id from projectM or pass in a texture ID from the outside. In this case, projectM will manage the FBO required to render to this texture internally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe feature is considered an enhancement.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions