glTexImage2d 不执行任何操作
这个问题让我很困惑。我正在测试一些 Haskell 与 OpenGL 的绑定,我创建了一个顶点着色器、一个片段着色器、编译程序,并在变换顶点后在屏幕上绘制一个纹理矩形...除了屏幕是空白的。
当我将矩形渲染为纯白色而不是在片段着色器中使用采样器时,它工作得很好。当我进入 gdebugger 并使用选项将所有纹理替换为存根纹理时,它也可以正常工作。
当我查看 gdebugger 中分配的纹理时,没有纹理对象,只有默认的 2d 纹理。当我在 glTexImage2d 上设置断点时,我看到它正在被调用,但是当我用 gdebugger 查看它时,内存中没有出现纹理对象。
这是怎么回事?我是否忘记设置一些环境变量?我很沮丧。更糟糕的是,我以前也遇到过这个问题,然后我设法解决了它,但我忘记了问题是什么。我讨厌自己>>_>>
This problem baffles me. I am testing some Haskell bindings to OpenGL, I create a vertex shader, a fragment shader, compile the program, and draw a textured rectangle to the screen after transforming the vertices... except the screen is blank.
When I render the rectangle flat white instead of using a sampler in the fragment shader, it works fine. When I go into gdebugger and use the option to replace all textures with a stub texture, it also works fine.
When I look at the allocated textures in gdebugger, there are no texture objects, only the default 2d texture. When I set a breakpoint on glTexImage2d, I see that it is being called, but no texture object appears in memory when I peek at it with gdebugger.
What's going on? Am I forgetting to set some environment variables? I'm quite frustrated. The kicker is that I had this problem before, and I managed to fix it then, but I forgot what the problem was. I hate myself >_>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不久前将关于 OpenGL 的教程移植到 Haskell 上。它包含一个非常小的库的链接,除其他外,该库有助于 加载纹理。
也许您可以将该代码与您必须的代码进行比较以发现差异。
I ported a tutorial on OpenGL to Haskell some time ago. It includes a link to a very tiny library that, among other things, helps with loading textures.
Perhaps you could compare that code with what you have to spot the differences.
无论如何,我不是一个 Haskell 人,但尝试做最简单的可能可行的事情,并检查你偏离它的地方:
I'm not a Haskell guy by any means, but try doing the simplest thing that could possibly work and check to see where you deviate from it: