Skip to content

Conversation

kblaschke
Copy link
Member

In preparation for future changes and to make the rendering process less verbose, I've refactored all code related to drawing geometry (points, lines, triangles, quads, ...) into a small number of wrapper classes which store and manage the vertex data. Since I've reworked all rendering code in projectM in this changeset, here's an overview of what has changed:

  • The shaders used by TextureCopier are now cached.
  • Geometry/vertex attribute data is now stored in individual buffers instead of one single, interleaved block.
  • A new Mesh class manages the most frequently used buffers: position, color and texture coordinates.
  • The Mesh class always uses indexed rendering, e.g. using glDrawElements().
  • A few effects (Warp/Composite) use aditional vertex attributes. The indices of these attributes have been adapted to not interfere with the predefined three indices in the Mesh class.
  • The Warp effect now directly stores the grid vertex data in the Mesh class and draws the whole warp mesh in one draw call. This will require some testing on less capable hardware to see if this still exceeds some hardware limits!
  • The Motion Vector Grid no longer uses an attribute array for vertex IDs, as OpenGL provides this value in the predefined gl_VertexID uniform.
  • The Point data type in the default waveform implementations has been changed from the RenderItem type to the new Point class in the libprojectM::Renderer namespace.
  • A small wrapper around blend-mode-related functionality has been added to further reduce direct GL calls within effects.

Besides reviewing the code, helping with regression testing with presets would be really nice! I've already tested each effect thoroughly while implementing the changes, but some small mistakes may still be present.

@kblaschke kblaschke added this to the 4.2 milestone Sep 30, 2025
@kblaschke kblaschke self-assigned this Sep 30, 2025
@kblaschke kblaschke force-pushed the refactor-geometry-rendering branch 2 times, most recently from 6ec8ece to bfad7d1 Compare September 30, 2025 22:21
@kblaschke kblaschke force-pushed the refactor-geometry-rendering branch from bfad7d1 to 92c94c8 Compare September 30, 2025 22:35
@kblaschke
Copy link
Member Author

kblaschke commented Oct 1, 2025

Cherry-picked a commit from @kholbrook1303 from PR #907 on top of my changes.

Fixes issue #903

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

Successfully merging this pull request may close these issues.

[DEV BUG] Sprite feature (4.2 release) has an issue causing the sprites to be vertically flipped
2 participants