Hacker News new | ask | show | jobs
by Aeolos 3813 days ago
Not parent, but I wrote a shader introspector to reduce the pain of uniform mismatches as a (small) part of my master thesis.

My advice would be: don't do this.

If you can afford to support OpenGL 3.1+, use uniform buffer objects with the std140 layout instead. That way, you can create a strongly-typed struct in your code and access it normally on the CPU side. Uploading to the shader then is done with a single *BufferData call.

See [1] for more information.

[1] https://www.opengl.org/wiki/Uniform_Buffer_Object