TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Type safe OpenGL – Converting strings into types in D

56 点作者 vive-la-liberte超过 9 年前

2 条评论

__mp超过 9 年前
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 未加载
aconz2超过 9 年前
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 未加载