GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 错误

Posted

技术标签:

【中文标题】GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 错误【英文标题】:GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT errors 【发布时间】:2008-08-18 07:59:07 【问题描述】:

我在我的 OpenGL 代码中使用了FBOs,我在GL\_FRAMEBUFFER\_INCOMPLETE\_DUPLICATE\_ATTACHMENT\_EXT 上看到了编译错误。这是什么原因,我该如何解决?

【问题讨论】:

【参考方案1】:

这个错误的原因是旧版本的 NVIDIA 的 gext.h,它仍然有这个定义。而GLEW 的最新版本没有。这会导致您之前编写或从网络获取的代码出现编译错误。

FBO 的 GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 定义曾经出现在规范中(因此也出现在头文件中)。但是,它后来被删除了。原因可以在FBO extension specification(查找Issue 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 的使用。

如果这在您的设置中不可行,则将虚拟定义添加到您的 gext.hglew.h 文件中,如下所示:

#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8

【讨论】:

以上是关于GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 错误的主要内容,如果未能解决你的问题,请参考以下文章