I'm confused. To use the Framebuffer Object (FBO) extension in OpenGL 1.x on Windows, which one am I using ?:
wglGetProcAddress("glGenFramebuffers"); // or wglGetProcAddress("glGenFramebuffersEXT");
As far as I can tell from the reports of users with different equipment, some drivers support all combinations of neither one, not one of them, or both.
What is the right option to use? Do some drivers really support one but not the other? Is it right to try to retreat from one to another, if not found?
Edit: I'm still having serious problems with ATI Radeon cards and the code around this. We just launched a commercial editor using this code (www.scirra.com). It seems that no matter what combination of code I use to use FBOs, some different combinations of user reports, they see nothing (i.e. nothing displays).
Here is the code in which I determine whether to use ARB functions (without suffix) or EXT-suffix functions. This starts at startup:
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));
Then later during startup, it creates an FBO in anticipation of rendering the texture:
// 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); }
I went through many variations of this code, and I just can't get it to work for everyone. There is always a group of users who do not report anything at all. ATI Radeon HD cards look especially problematic. I'm not sure if there is a driver error, but I think it is more likely that my code above makes the wrong assumption.
500 rep bounty and I will send a free business license to anyone who knows what's wrong! (Worth Β£ 99)
Edit 2: some details. Here is a list of cards that are known to fail:
ATI Mobility Radeon HD 5650
ATI Radeon X1600 Pro
ATI Mobility Radeon HD 4200
No texture rendering is actually performed. It seems that calling glGenFramebuffers on its own stops completely rendering on these cards. I could postpone the creation of FBO for the first time the rendering texture is actually being executed, but presumably this will just stop rendering again.
I could use GLEW, but what does it do that my code does not? I looked at the source and seemed to use a similar wglGetProcAddress list. Methods are returned in my case, otherwise glGenFramebuffers will be NULL and fail. Any ideas ...?