summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorLeith Bade <leith@mapbox.com>2014-12-20 15:15:43 +1300
committerLeith Bade <leith@mapbox.com>2014-12-20 15:15:43 +1300
commit2731b582f24063e339c047635c6d7b2316eb8037 (patch)
tree54539846e3bb827a09ba56bf25c867502a49b40a /platform
parent4a2cf4aa62b9f467f0757844b4a4c3dbf75fdc40 (diff)
parent15b47197a79c05ca6fe4f604a7803ecbcb7a7e4d (diff)
downloadqtlocation-mapboxgl-2731b582f24063e339c047635c6d7b2316eb8037.tar.gz
Merge pull request #729 from mapbox/shader-iostream
Use iostream for saving GL program binary + check GL_NUM_PROGRAM_BINARY_FORMATS > 0
Diffstat (limited to 'platform')
-rw-r--r--platform/default/glfw_view.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp
index e33f8eed15..21cd95c8bf 100644
--- a/platform/default/glfw_view.cpp
+++ b/platform/default/glfw_view.cpp
@@ -152,12 +152,16 @@ void GLFWView::initialize(mbgl::Map *map_) {
}
if (extensions.find("GL_ARB_get_program_binary") != std::string::npos) {
- gl::GetProgramBinary = (gl::PFNGLGETPROGRAMBINARYPROC)glfwGetProcAddress("glGetProgramBinary");
- gl::ProgramBinary = (gl::PFNGLPROGRAMBINARYPROC)glfwGetProcAddress("glProgramBinary");
- gl::ProgramParameteri = (gl::PFNGLPROGRAMPARAMETERIPROC)glfwGetProcAddress("glProgramParameteri");
- assert(gl::GetProgramBinary != nullptr);
- assert(gl::ProgramBinary != nullptr);
- assert(gl::ProgramParameteri != nullptr);
+ GLint numBinaryFormats;
+ MBGL_CHECK_ERROR(glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &numBinaryFormats));
+ if (numBinaryFormats > 0) {
+ gl::GetProgramBinary = (gl::PFNGLGETPROGRAMBINARYPROC)glfwGetProcAddress("glGetProgramBinary");
+ gl::ProgramBinary = (gl::PFNGLPROGRAMBINARYPROC)glfwGetProcAddress("glProgramBinary");
+ gl::ProgramParameteri = (gl::PFNGLPROGRAMPARAMETERIPROC)glfwGetProcAddress("glProgramParameteri");
+ assert(gl::GetProgramBinary != nullptr);
+ assert(gl::ProgramBinary != nullptr);
+ assert(gl::ProgramParameteri != nullptr);
+ }
}
}