我很困惑。若要在Windows1.x中使用OpenGL 1.x中的Framebuffer对象扩展(FBO),应使用其中的哪些?:
wglGetProcAddress("glGenFramebuffers");
// or
wglGetProcAddress("glGenFramebuffersEXT");据我从使用不同硬件的用户的报告中可以看出,一些驱动程序支持两种或两种的任何一种组合,或者两者兼而有之。
哪一种是合适的?有些司机真的支持其中一种而不是另一种?如果找不到,试着从一个回到另一个是正确的吗?
编辑:,我的around和代码仍然有严重的问题。我们刚刚启动了一个使用此代码(www.scirra.com)的商业编辑器。似乎无论我使用什么代码组合来使用FBO,一些不同的用户组合报告他们根本看不见任何东西(即没有呈现)。
下面是我检测到是使用ARB函数(没有后缀)还是使用EXT后缀函数的代码。这在启动时运行:
gl_extensions = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
gl_vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
gl_renderer = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
gl_version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
gl_shading_language = reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
// If OpenGL version >= 3, framebuffer objects are core - enable regardless of extension
// (the flags are initialised to false)
if (atof(gl_version) >= 3.0)
{
support_framebuffer_object = true;
support_framebuffer_via_ext = false;
}
else
{
// Detect framebuffer object support via ARB (for OpenGL version < 3) - also uses non-EXT names
if (strstr(gl_extensions, "ARB_framebuffer_object") != 0)
{
support_framebuffer_object = true;
support_framebuffer_via_ext = false;
}
// Detect framebuffer object support via EXT (for OpenGL version < 3) - uses the EXT names
else if (strstr(gl_extensions, "EXT_framebuffer_object") != 0)
{
support_framebuffer_object = true;
support_framebuffer_via_ext = true;
}
}随后,在启动过程中,它会创建一个FBO,以便将其呈现为纹理:
// Render-to-texture support: create a frame buffer object (FBO)
if (support_framebuffer_object)
{
// If support is via EXT (OpenGL version < 3), add the EXT suffix; otherwise functions are core (OpenGL version >= 3)
// or ARB without the EXT suffix, so just get the functions on their own.
std::string suffix = (support_framebuffer_via_ext ? "EXT" : "");
glGenFramebuffers = (glGenFramebuffers_t)wglGetProcAddress((std::string("glGenFramebuffers") + suffix).c_str());
glDeleteFramebuffers = (glDeleteFramebuffers_t)wglGetProcAddress((std::string("glDeleteFramebuffers") + suffix).c_str());
glBindFramebuffer = (glBindFramebuffer_t)wglGetProcAddress((std::string("glBindFramebuffer") + suffix).c_str());
glFramebufferTexture2D = (glFramebufferTexture2D_t)wglGetProcAddress((std::string("glFramebufferTexture2D") + suffix).c_str());
glCheckFramebufferStatus = (glCheckFramebufferStatus_t)wglGetProcAddress((std::string("glCheckFramebufferStatus") + suffix).c_str());
glGenerateMipmap = (glGenerateMipmap_t)wglGetProcAddress((std::string("glGenerateMipmap") + suffix).c_str());
// Create a FBO in anticipation of render-to-texture
glGenFramebuffers(1, &fbo);
}我已经经历过许多这种代码的变体,我根本无法让它对每个人都起作用。总是有一组用户报告什么都没有呈现。ATI Radeon HD卡似乎特别有问题。我不确定是否涉及到驱动程序错误,但我想更有可能的是,我上面的代码做出了错误的假设。
500代表赏金,我会发送一个免费的营业执照,谁知道谁是错的!(价值99 99)
编辑2:更多细节。以下是已知失败的卡片列表:
ATI移动性Radeon HD 5650
X1600 Pro
ATI移动性Radeon HD 4200
没有渲染纹理实际上是做的。似乎glGenFramebuffers调用本身就停止了在这些卡上的完全呈现。我可以将FBO的创建推迟到第一次渲染到纹理的时候,但可能会再次停止渲染。
我可以使用GLEW,但它做什么,我的代码没有?我查看了源代码,它似乎使用了类似的wglGetProcAddress列表。方法在我的示例中被返回,否则glGenFramebuffers将为NULL和崩溃。有什么主意.?
发布于 2011-08-02 13:45:54
如果存在扩展GL_EXT_framebuffer_object,则可以使用wglGetProcAddress("glGenFramebuffersEXT");。
如果OpenGL版本是>= 3.0 (在这个版本中,FBO扩展被添加到内核中),那么您可以使用wglGetProcAddress("glGenFramebuffers");。
发布于 2011-08-26 09:15:37
您所包含的代码不是问题所在。当然,绑定点将像您已经做的那样获得。
在支持对象的情况下,使用没有EXT后缀的入口点。在支持对象的情况下,使用带有EXT后缀的入口点。如果两者都受支持,则可以通过获得正确的绑定点来选择实现。
我对这个问题非常感兴趣(因为我有类似的疑问,因为你)。
如果您将ARB规范与EXT规范进行比较,您会注意到许多不同之处。
在这里,我将引用有关这个主题的最有趣的ARB规范段落。
规范很长,但是ARB变体包含了很多关于EXT兼容性问题的讨论。由于您正在运行应用程序,入口点可能是正确的,并且错误(如Nicolas所建议的)可能是框架缓冲区的完整性。
介绍所有可能的检查,并对实现进行两次检查(一次考虑ARB规范,另一次考虑EXT规范)。
这个扩展在EXT_framebuffer_object上还包括哪些其他功能?
Currently we incorporate the following layered extensions:
* EXT_framebuffer_multisample
* EXT_framebuffer_blit
* EXT_packed_depth_stencil以及下列特性:
* Permit attachments with different width and height (mixed
dimensions)
* Permit color attachments with different formats (mixed
formats).
* Render to 1 and 2 component R/RG formats that are provided
via the ARB_texture_rg extension. L/A/LA/I will be
left for a separate (trivial) extension.
* Gen'ed names must be used for framebuffer objects and
renderbuffers.
* Added FramebufferTextureLayer.
...与EXT_framebuffer_object的其他区别是什么?
* Framebuffer completeness only considers the attachments named
by DRAW_BUFFERi and READ_BUFFER. Any other attachments do
not affect framebuffer completeness. (In
EXT_framebuffer_object, all attachments affected framebuffer
completeness, independent of the DRAW_BUFFERi and READ_BUFFER
state.)
* Added new queries for the sizes of the bit planes for color,
depth and stencil attachments at a framebuffer attachment point.
* Added new queries for framebuffer attachment component type and
color encoding.
* Many other minor tweaks to synchronize with the GL3 framebuffer
objects.
* ARB FBOs are not shareable.这个扩展和EXT_framebuffer_object都有“绑定框架缓冲区”函数(BindFramebuffer和BindFramebufferEXT)。这两个功能在功能上有什么不同吗?
RESOLVED: Yes. Both extensions will create a new framebuffer object
if called with an unused name. However, BindFramebuffer defined in
this extension will generate an INVALID_OPERATION error if the name
provided has not been generated by GenFramebuffer. That error did
not exist in EXT_framebuffer_object, and this extension does not
modify the behavior of BindFramebufferEXT. This difference also
applies to BindRenderbuffer from this extension vs.
BindRenderbufferEXT from EXT_framebuffer_object.https://stackoverflow.com/questions/6912988
复制相似问题