Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for rendering to custom textures and FBOs #659

Open
kblaschke opened this issue Oct 27, 2022 · 1 comment
Open

Add support for rendering to custom textures and FBOs #659

kblaschke opened this issue Oct 27, 2022 · 1 comment
Milestone

Comments

@kblaschke
Copy link
Member

kblaschke commented Oct 27, 2022

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.

@kblaschke kblaschke added this to the 4.0 milestone Oct 27, 2022
@kblaschke kblaschke modified the milestones: 4.0, 4.1 Feb 16, 2023
@kblaschke kblaschke modified the milestones: 4.1, 4.2 Sep 20, 2023
@kblaschke kblaschke linked a pull request Nov 7, 2023 that will close this issue
@kblaschke kblaschke changed the title Implement framebuffer object (FBO) rendering support Add support for rendering to custom textures and FBOs Jan 31, 2024
@kblaschke
Copy link
Member Author

Settling with just using a framebuffer object for now, as this will contain any offscreen texture. This keeps the API function count lower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant