Re:Type safe OpenGL – Converting strings into types in D
by pcwalton on Saturday January 16, 2016 @02:49PM
(#10916533)
glium in Rust does all of this and more (managing your state for you so you don't have to remember what is bound).
Re:Type safe OpenGL – Converting strings into types in D
by heavenlyhash on Saturday January 16, 2016 @01:55PM
(#10916307)
I've been fooling around with Go bindings to GL and also want to do something similar.
I still find it kind of uncomfortable that I'm copy-pasting variable names as strings between (the middle of!) the shader code string and the use sites (e.g. `setUniform` calls) -- I'd like it if I got some sort of quick compile time sanity check that those references match up. Had you considered going that far, and if so, what were your thoughts?
Re:Type safe OpenGL – Converting strings into types in D
by Aeolos on Saturday January 16, 2016 @02:05PM
(#10916352)
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.
Goal: Easy access to shaders and its respective buffers with a bare bones visualization.
Example:
I should clean it up and make it available as a library.