TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Type safe OpenGL – Converting strings into types in D

56 pointsby vive-la-liberteover 9 years ago

2 comments

__mpover 9 years ago
I&#x27;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, &quot;inPosition&quot;, false); shader.bind(); shader.setUniform(&quot;uViewMatrix&quot;, camera.view()); shader.setUniform(&quot;uProjMatrix&quot;, camera.proj()); shader.setUniform(&quot;uModelMatrix&quot;, 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.
评论 #10916533 未加载
评论 #10916307 未加载
aconz2over 9 years ago
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 &quot;importing&quot; types is a good one and I think this is what F# achieves with type providers. I&#x27;ve seen this applied to database schemas and filesystems, but never OpenGL.
评论 #10915937 未加载