openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

[idea / wip] - ofShader::setUniformBufferObject to easily pass a struct to a shader

Open dimitre opened this issue 1 year ago • 1 comments

relevant discussion: https://forum.openframeworks.cc/t/multiple-lights-limit-with-opengl-3-2-how-to-increase/43777/26

usage example:

shader.setUniformBufferObject("vars", &customVars, sizeof(customVars));

PS: not static yet

What do you think @NickHardeman ?

dimitre avatar Aug 29 '24 04:08 dimitre

Should probably be wrapped in the defines next to getUniformBlockIndex, getUniformBlockBinding, etc. I don't have much experience with Uniform Blocks, so would be good to test with openGL ES. Testing with Emscripten would be helpful. Could be wrapped in

#if !defined(TARGET_OPENGLES) || defined(TARGET_EMSCRIPTEN)
#ifdef GLEW_ARB_uniform_buffer_object

NickHardeman avatar Aug 30 '24 18:08 NickHardeman