summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-10-03 14:21:37 +0200
committerGitHub <noreply@github.com>2016-10-03 14:21:37 +0200
commit78d97b060a6873a454e710380cb9ef1bde5e4c65 (patch)
tree58329b9b46548903879bcaf6d2f070a0efb1c73c
parent917f5e9bbc688214755f723e4c03cd471fb795d5 (diff)
parenta27fafb2736a530a8a04f887dd8d6e67da3d8972 (diff)
Merge pull request #6605 from zaps166/old-gl-ext-funcs
Add compatibility with old OpenGL 2.1 drivers
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index e0326f6728..a7edc8d935 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -10821,8 +10821,46 @@ void RasterizerGLES2::init() {
print_line(String("GLES2: Using GLEW ") + (const char*) glewGetString(GLEW_VERSION));
}
+ // Godot makes use of functions from ARB_framebuffer_object extension which is not implemented by all drivers.
+ // On the other hand, these drivers might implement the older EXT_framebuffer_object extension
+ // with which current source code is backward compatible.
+
+ bool framebuffer_object_is_supported = glewIsSupported("GL_ARB_framebuffer_object");
+
+ if ( !framebuffer_object_is_supported ) {
+ WARN_PRINT("GL_ARB_framebuffer_object not supported by your graphics card.");
+
+ if ( glewIsSupported("GL_EXT_framebuffer_object") ) {
+ // falling-back to the older EXT function if present
+ WARN_PRINT("Falling-back to GL_EXT_framebuffer_object.");
+
+ glIsRenderbuffer = glIsRenderbufferEXT;
+ glBindRenderbuffer = glBindRenderbufferEXT;
+ glDeleteRenderbuffers = glDeleteRenderbuffersEXT;
+ glGenRenderbuffers = glGenRenderbuffersEXT;
+ glRenderbufferStorage = glRenderbufferStorageEXT;
+ glGetRenderbufferParameteriv = glGetRenderbufferParameterivEXT;
+ glIsFramebuffer = glIsFramebufferEXT;
+ glBindFramebuffer = glBindFramebufferEXT;
+ glDeleteFramebuffers = glDeleteFramebuffersEXT;
+ glGenFramebuffers = glGenFramebuffersEXT;
+ glCheckFramebufferStatus = glCheckFramebufferStatusEXT;
+ glFramebufferTexture1D = glFramebufferTexture1DEXT;
+ glFramebufferTexture2D = glFramebufferTexture2DEXT;
+ glFramebufferTexture3D = glFramebufferTexture3DEXT;
+ glFramebufferRenderbuffer = glFramebufferRenderbufferEXT;
+ glGetFramebufferAttachmentParameteriv = glGetFramebufferAttachmentParameterivEXT;
+ glGenerateMipmap = glGenerateMipmapEXT;
+
+ framebuffer_object_is_supported = true;
+ }
+ else {
+ ERR_PRINT("Framebuffer Object is not supported by your graphics card.");
+ }
+ }
+
// Check for GL 2.1 compatibility, if not bail out
- if (!glewIsSupported("GL_VERSION_2_1")) {
+ if (!(glewIsSupported("GL_VERSION_2_1") && framebuffer_object_is_supported)) {
ERR_PRINT("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"
"Try a drivers update, buy a new GPU or try software rendering on Linux; Godot is now going to terminate.");
OS::get_singleton()->alert("Your system's graphic drivers seem not to support OpenGL 2.1 / GLES 2.0, sorry :(\n"