summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/context_gl_x11.cpp34
-rw-r--r--platform/x11/detect.py3
-rw-r--r--platform/x11/platform_config.h2
3 files changed, 32 insertions, 7 deletions
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index 4e00dbf0a8..cd325dfc99 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -179,14 +179,38 @@ int ContextGL_X11::get_window_height() {
}
void ContextGL_X11::set_use_vsync(bool p_use) {
- GLXDrawable drawable = glXGetCurrentDrawable();
- //GLXSwapIntervalEXT(x11_display, drawable, p_use?1:0);
- use_vsync=p_use;
+ static bool setup = false;
+ static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL;
+ static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalMESA = NULL;
+ static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL;
+
+ if (!setup) {
+ setup = true;
+ String extensions = glXQueryExtensionsString(x11_display, DefaultScreen(x11_display));
+ if (extensions.find("GLX_EXT_swap_control") != -1)
+ glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT");
+ if (extensions.find("GLX_MESA_swap_control") != -1)
+ glXSwapIntervalMESA = (PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA");
+ if (extensions.find("GLX_SGI_swap_control") != -1)
+ glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC) glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI");
+ }
+ int val = p_use ? 1:0;
+ if (glXSwapIntervalMESA) {
+ glXSwapIntervalMESA(val);
+ }
+ else if (glXSwapIntervalSGI) {
+ glXSwapIntervalSGI(val);
+ }
+ else if (glXSwapIntervalEXT) {
+ GLXDrawable drawable = glXGetCurrentDrawable();
+ glXSwapIntervalEXT(x11_display, drawable, val);
+ }
+ else return;
+ use_vsync = p_use;
}
bool ContextGL_X11::is_using_vsync() const {
- return false;
- //return use_vsync;
+ return use_vsync;
}
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 5a43bf9323..2561e09b9a 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -65,6 +65,7 @@ def get_flags():
return [
('builtin_zlib', 'no'),
+ ('glew', 'yes'),
("openssl", "yes"),
#("theora","no"),
]
@@ -147,7 +148,7 @@ def configure(env):
env.Append(CPPPATH=['#drivers/freetype/freetype/include'])
- env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
+ env.Append(CPPFLAGS=['-DOPENGL_ENABLED'])
if os.system("pkg-config --exists alsa")==0:
print("Enabling ALSA")
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index aac50c27c2..3b47b2c92d 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/platform_config.h
@@ -34,6 +34,6 @@
#define PTHREAD_BSD_SET_NAME
#endif
-#define GLES2_INCLUDE_H "gl_context/glew.h"
+#define GLES2_INCLUDE_H "gl_context/GL/glew.h"