将 OpenGL FBO 纹理渲染到 GLXPixmap
我正在编写一些代码,其目的是: 1. 使用 FBO 渲染为 OpenGL 纹理。 2. 从 FBO 纹理绘制到附加到 X Pixmap 的 GLXPixmap。 3. 将 X Pixmap 绘制到屏幕上的窗口。
步骤 3 效果很好,如果我用正常的 OpenGL 绘图替换 FBO 纹理,步骤 2 效果也很好。
但如果我执行上述操作,至少使用我拥有的代码,它就不起作用。如果我给 GLXPixmap 一个彩色背景,并执行 1-3,屏幕上的窗口会变成白色,但我绘制的其他内容不会出现。
所以我希望有人可以提供提示,或者向我指出一些简单的示例代码。我为此获得的代码相当复杂,但如果需要,我可以尝试编写一个简单的示例版本发布在这里以供审查。
I'm writing some code which is intended to:
1. Render into an OpenGL texture using an FBO.
2. Draw from the FBO texture to a GLXPixmap, which is attached to an X Pixmap.
3. Draw the X Pixmap to a window on the screen.
Step 3 works great, and step 2 works fine if I replace the FBO texture with normal OpenGL drawing.
But if I do what's above, at least with the code I have, it doesn't work. If I give the GLXPixmap a colored background, and do 1-3, the window on the screen turns white, but nothing else I've drawn appears.
So I'm hoping someone can provide tips, or point me to some simple sample code. The code I've got for this is fairly convoluted, but if needed, I can try to write a simple sample version to post here for review.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的最后两个步骤有效,但没有使用您在第一步中创建的 FBO,则您可能错误地初始化了 FBO。有些事情需要检查:
glCheckFramebufferStatus( GL_FRAMEBUFFER_COMPLETE )
进行检查。glGetTexImage
)以确定问题是否出在写入 FBO 或读取 FBO 上?glGetError()
是否返回任何错误?如果一切检查正确,然后发布一些骨架设置和渲染代码......当然,虽然越简单越好=)
If your last two steps work, but not using the FBO you create in step one, you're probably initializing the FBO incorrectly. Some things to check:
glCheckFramebufferStatus( GL_FRAMEBUFFER_COMPLETE )
after you attach all your textures and/or renderbuffers to it.glGetTexImage
) to determine whether the problem is with writing to the FBO or reading from it?glGetError()
return any errors?If everything checks out correctly, then post some skeleton setup and rendering code... although the less convoluted the better, of course =)