summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-11-07 09:38:07 -0800
committerKonstantin Käfer <mail@kkaefer.com>2014-11-07 09:38:07 -0800
commit8fe8b2f739e997b76fcc768348c66f2007e0968b (patch)
treed0b5ed30332f1c0c9bffa9b3703e2b8702ad1fdf
parent582d616deb5b1febbaa1c8dfb5e3fb405f8cad53 (diff)
downloadqtlocation-mapboxgl-8fe8b2f739e997b76fcc768348c66f2007e0968b.tar.gz
add glx support
-rw-r--r--include/mbgl/platform/gl.hpp1
-rw-r--r--platform/default/glfw_view.cpp8
-rw-r--r--platform/default/headless_view.cpp8
3 files changed, 16 insertions, 1 deletions
diff --git a/include/mbgl/platform/gl.hpp b/include/mbgl/platform/gl.hpp
index 73753746a7..6685d1f379 100644
--- a/include/mbgl/platform/gl.hpp
+++ b/include/mbgl/platform/gl.hpp
@@ -26,6 +26,7 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#else
+ #define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glext.h>
#endif
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp
index 7f8ca69944..34b9ddbef1 100644
--- a/platform/default/glfw_view.cpp
+++ b/platform/default/glfw_view.cpp
@@ -73,7 +73,13 @@ void GLFWView::initialize(mbgl::Map *map_) {
{
using namespace mbgl;
- if (extensions.find("GL_APPLE_vertex_array_object") != std::string::npos) {
+
+ if (extensions.find("GL_ARB_vertex_array_object") != std::string::npos) {
+ gl::BindVertexArray = (gl::PFNGLBINDVERTEXARRAYPROC)glfwGetProcAddress("glBindVertexArrayARB");
+ gl::DeleteVertexArrays = (gl::PFNGLDELETEVERTEXARRAYSPROC)glfwGetProcAddress("glDeleteVertexArraysARB");
+ gl::GenVertexArrays = (gl::PFNGLGENVERTEXARRAYSPROC)glfwGetProcAddress("glGenVertexArraysARB");
+ gl::IsVertexArray = (gl::PFNGLISVERTEXARRAYPROC)glfwGetProcAddress("glIsVertexArrayARB");
+ } else if (extensions.find("GL_APPLE_vertex_array_object") != std::string::npos) {
gl::BindVertexArray = (gl::PFNGLBINDVERTEXARRAYPROC)glfwGetProcAddress("glBindVertexArrayAPPLE");
gl::DeleteVertexArrays = (gl::PFNGLDELETEVERTEXARRAYSPROC)glfwGetProcAddress("glDeleteVertexArraysAPPLE");
gl::GenVertexArrays = (gl::PFNGLGENVERTEXARRAYSPROC)glfwGetProcAddress("glGenVertexArraysAPPLE");
diff --git a/platform/default/headless_view.cpp b/platform/default/headless_view.cpp
index 8ce93030de..687f3ecf7d 100644
--- a/platform/default/headless_view.cpp
+++ b/platform/default/headless_view.cpp
@@ -58,6 +58,14 @@ void HeadlessView::loadExtensions() {
gl::IsVertexArray = (gl::PFNGLISVERTEXARRAYPROC)CGLGetProcAddress("glIsVertexArrayAPPLE");
}
#endif
+#ifdef MBGL_USE_GLX
+ if (extensions.find("GL_ARB_vertex_array_object") != std::string::npos) {
+ gl::BindVertexArray = (gl::PFNGLBINDVERTEXARRAYPROC)glXGetProcAddress((const GLubyte *)"glBindVertexArrayARB");
+ gl::DeleteVertexArrays = (gl::PFNGLDELETEVERTEXARRAYSPROC)glXGetProcAddress((const GLubyte *)"glDeleteVertexArraysARB");
+ gl::GenVertexArrays = (gl::PFNGLGENVERTEXARRAYSPROC)glXGetProcAddress((const GLubyte *)"glGenVertexArraysARB");
+ gl::IsVertexArray = (gl::PFNGLISVERTEXARRAYPROC)glXGetProcAddress((const GLubyte *)"glIsVertexArrayARB");
+ }
+#endif
make_inactive();
}