且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

设置 OpenGL 多渲染目标

更新时间:2023-11-10 23:12:46

听起来和看起来都很合理.这确实是常见的做法.如果您不需要深度数据作为纹理进行进一步处理,您也可以将渲染缓冲区用于附件,但纹理也应该可以正常工作.

Sounds and looks reasonable. This is indeed the common way to do it. If you don't need the depth data as texture for further processing, you can also use a renderbuffer for an attachment, but a texture should also work fine.

您还可以在所有设置完成后使用 glCheckFramebufferStatusEXT 来查看帧缓冲区在其当前配置中是否有效,但您的代码看起来不错.如果您没有问题并且这只是为了保证,那么请放心,您走在正确的轨道上,否则请告诉我们出了什么问题.

You can also use glCheckFramebufferStatusEXT after all the setup is done, to see if the framebuffer is valid in its current configuration, but your code looks fine. If you don't have a problem and this was just for assurance, then rest assured that you're on the right track, otherwise tell us what's wrong.