I'm currently doing something similar in C++ based on a project I worked on a couple of years ago. It is a wrapper around OpenGL for people like me who are tired of figuring out the specifics of the OpenGL calls every time they write something.<p>Goal: Easy access to shaders and its respective buffers with a bare bones visualization.<p>Example:<p><pre><code> Shader shader(fragment_shader, vertex_shader);
verticesVBO.set(vertices);
verticesVBO.map(shader, "inPosition", false);
shader.bind();
shader.setUniform("uViewMatrix", camera.view());
shader.setUniform("uProjMatrix", camera.proj());
shader.setUniform("uModelMatrix", modelMatrix());
facesVBO.bind();
glDrawElements(GL_TRIANGLES, facesVBO.length(), GL_UNSIGNED_INT, (void*) NULL);
</code></pre>
I should clean it up and make it available as a library.
This only seems useful for user-defined glsl types. The builtin glsl types would only have to be written out once as D types.<p>The general idea of "importing" types is a good one and I think this is what F# achieves with type providers. I've seen this applied to database schemas and filesystems, but never OpenGL.