Skip to content

Conversation

@revmischa
Copy link
Member

Adds a callback that allows applications to provide textures from non-filesystem sources like archives, network, or procedurally generated content. The callback receives the texture name and can return either raw pixel data or an existing OpenGL texture ID.

Fixes #870

Adds a callback that allows applications to provide textures from
non-filesystem sources like archives, network, or procedurally generated
content. The callback receives the texture name and can return either
raw pixel data or an existing OpenGL texture ID.

Fixes #870
Move TextureLoadData and TextureLoadCallback from TextureManager.hpp
to a separate TextureTypes.hpp header. This allows ProjectM.hpp to
include only the necessary types without pulling in internal
dependencies that aren't installed.
@revmischa revmischa force-pushed the feature/texture-callback-870 branch from 450d192 to a3812ea Compare January 25, 2026 06:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for loading textures from non-filesystem sources through a callback mechanism. Applications can now provide textures from archives, network sources, or generate them procedurally. The callback can return either raw pixel data or an existing OpenGL texture ID, with automatic fallback to filesystem loading if the callback doesn't provide the requested texture.

Changes:

  • Added TextureLoadCallback type and TextureLoadData structure to define the callback interface
  • Extended TextureManager to try callback-based loading before filesystem loading
  • Exposed the callback through both C++ (ProjectM::SetTextureLoadCallback) and C (projectm_set_texture_load_event_callback) APIs
  • Updated CMakeLists.txt to install new public headers (TextureTypes.hpp, WaveformAligner.hpp, Logging.hpp)

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/libprojectM/Renderer/TextureTypes.hpp Defines TextureLoadData structure and TextureLoadCallback type for the callback interface
src/libprojectM/Renderer/TextureManager.hpp Adds SetTextureLoadCallback method and member variable to store callback
src/libprojectM/Renderer/TextureManager.cpp Implements callback invocation in TryLoadingTexture, checking callback before filesystem loading
src/libprojectM/ProjectM.hpp Exposes SetTextureLoadCallback method in C++ API
src/libprojectM/ProjectM.cpp Stores callback and ensures it's re-applied when TextureManager is recreated
src/libprojectM/ProjectMCWrapper.hpp Adds member variables to store C callback and user data
src/libprojectM/ProjectMCWrapper.cpp Implements C-to-C++ callback bridge with lambda wrapper
src/api/include/projectM-4/callbacks.h Defines C API types and functions for texture loading callback
src/libprojectM/CMakeLists.txt Adds TextureTypes.hpp, WaveformAligner.hpp, and Logging.hpp to installation list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add callback to API to support loading textures from non-filesystem sources

1 participant