p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

Add support for Texture Buffer Objects (TBOs)

Open RandomGamingDev opened this issue 1 year ago • 2 comments

Increasing access

This would allow for more complex shaders which require more data while still making it possible to run them in realistic amounts of time. It would also help to introduce p5.js users to GPU based computing, which would be a great step forward for helping to develop the WebGL knowledge of beginners. For instance, high resolution voxel terrain which could use the increased amount of data transferring that TBOs allow for.

Most appropriate sub-area of p5.js?

  • [ ] Accessibility
  • [ ] Color
  • [ ] Core/Environment/Rendering
  • [ ] Data
  • [ ] DOM
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [X] WebGL
  • [ ] Build process
  • [ ] Unit testing
  • [ ] Internationalization
  • [ ] Friendly errors
  • [ ] Other (specify if possible)

Feature request details

Create an official function that acts similarly to setUniform(), but offers more control over TBO specifics (e.g. texture type).

Similar to https://github.com/processing/p5.js/issues/7309

RandomGamingDev avatar Oct 31 '24 16:10 RandomGamingDev

Hey I'm interested in working on this. The idea of adding more control over texture buffer objects seems really useful, especially for projects that need to handle larger datasets in shaders. I've been looking at how we could extend the current setUniform() functionality to give users more control over texture types and formats. Would love to help implement this - has anyone already started working on it? @davepagurek can you please guide on this I was thinking about an implementation with

gl.texBuffer(gl.TEXTURE_BUFFER, options.format, buffer);
const location = gl.getUniformLocation(program, name);
gl.uniform1i(location, options.textureUnit);  
    


Vaivaswat2244 avatar Jan 07 '25 14:01 Vaivaswat2244

Hello @RandomGamingDev and maintainers,

I am interested in contributing to the Texture Buffer Objects (TBOs) support feature. I understand this is an advanced task requiring low-level WebGL and potentially large architectural decisions.

Before starting any implementation, I would like to get guidance on the API design. Specifically:

  1. Level of Abstraction: Should the function primarily wrap gl.texBuffer directly (as suggested by @RandomGamingDev) to cater to power users, or should it integrate with p5.js's existing texture object model?
  2. Implementation Branch: Given the magnitude of this WebGL feature, should the PR target the stable main branch or the ongoing dev-2.0 branch?

I am prepared to research the existing WebGL context and draft a design proposal for review. Could you assign this to me for initial investigation and design planning?

koushikcs562 avatar Nov 14 '25 15:11 koushikcs562