GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT错误
时间:2020-03-05 18:40:16 来源:igfitidea点击:
我在OpenGL代码中使用了FBO,并且在GL \ _FRAMEBUFFER \ _INCOMPLETE \ _DUPLICATE \ _ATTACHMENT \ _EXT上看到编译错误。这是什么原因造成的,我该如何解决?
解决方案
回答
导致此错误的原因是NVIDIA glext.h的旧版本,该版本仍然具有此定义。而最新版本的GLEW则没有。这会导致我们先前编写或者从网络获取的代码中的编译错误。
FBO的GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT定义曾经存在于规范中(因此存在于头文件中)。但是,后来将其删除。可以在FBO扩展规范中找到其原因(查找问题87):
(87) What happens if a single image is attached more than once to a framebuffer object? RESOLVED: The value written to the pixel is undefined. There used to be a rule in section 4.4.4.2 that resulted in FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT if a single image was attached more than once to a framebuffer object. FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 * A single image is not attached more than once to the framebuffer object. { FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT } This rule was removed in version #117 of the EXT_framebuffer_object specification after discussion at the September 2005 ARB meeting. The rule essentially required an O(n*lg(n)) search. Some implementations would not need to do that search if the completeness rules did not require it. Instead, language was added to section 4.10 which says the values written to the framebuffer are undefined when this rule is violated.
要解决此错误,请从代码中删除所有GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT的用法。
如果在设置中无法做到这一点,请向glext.h或者glew.h文件中添加一个虚拟定义,如下所示:
#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8