英文:
Tesselation in Go-GL
问题
我正在尝试使用Golang OpenGL绑定来细分一个简单的三角形。
该库并不支持细分着色器,但我查看了源代码,添加正确的绑定似乎并不困难。因此,我分支了它,并尝试在gl_defs.go中添加正确的常量。
绑定仍然可以成功编译,我的程序也可以编译通过,但当我尝试使用新的绑定时,问题就出现了。当我尝试包含细分着色器时,程序从显示一个漂亮的旋转三角形变成了一个黑屏。
我正在按照《OpenGL超级宝典》(第6版)的教程进行操作,并在这个项目中使用他们的着色器,所以我不认为我使用的是有问题的着色器(它们没有输出错误日志)。但如果着色器本身有问题的话,可以在这里的setupProgram()
函数中找到它们。
我相当确定我的显卡支持细分,因为打印OpenGL版本返回的是4.4.0 NVIDIA 331.38
。
所以我的问题是:
有没有任何原因导致添加细分的Go绑定不起作用?这些绑定看起来非常简单。
我是否错误地添加了新的绑定?
如果应该可以工作,为什么对我来说不起作用?
我在这里做错了什么?
英文:
I'm trying to tesselate a simple triangle using the Golang OpenGL bindings
The library doesn't claim support for the tesselation shaders, but I looked through the source code, and adding the correct bindings didn't seem terribly tricky. So I branched it and tried adding the correct constants in gl_defs.go.
The bindings still compile just fine and so does my program, it's when I actually try to use the new bindings that things go strange. The program goes from displaying a nicely circling triangle to a black screen whenever I actually try to include the tesselation shaders.
I'm following along with the OpenGL Superbible (6th edition) and using their shaders for this project, so I don't image I'm using broken shaders (they don't spit out an error log, anyway). But in case the shaders themselves could be at fault, they can be found in the setupProgram()
function here.
I'm pretty sure my graphics card supports tesselation because printing the openGL version returns 4.4.0 NVIDIA 331.38
.
So my questions:
Is there any reason adding go bindings for tesselation wouldn't work? The bindings seem quite straightforward.
Am I adding the new bindings incorrectly?
If it should work, why is it not working for me?
What am I doing wrong here?
答案1
得分: 1
可能值得采取的步骤:
- 您的驱动程序和显卡可能支持镶嵌着色器,但是您绑定的GL上下文可能是早期版本的OpenGL。尝试使用
glGetString(GL_VERSION)
并查看返回结果。 - 您是否在几乎每个地方都调用了
glGetError
并实际检查其值?这个绑定是否提供错误返回值?如果是,您是否在检查这些值?
英文:
Steps that might be worth taking:
- Your driver and video card may support tessellation shaders, but the GL context that your binding is returning for you might be for an earlier version of OpenGL. Try
glGetString(GL_VERSION)
and see what you get. - Are you calling
glGetError
basically everywhere and actually checking its values? Does this binding provide error return values? If so, are you checking those?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论