From 3f0c474a71ceaa2be457e1f5d734e320cc1d7fd9 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Wed, 29 Aug 2018 12:39:45 +0800 Subject: [PATCH] GLBuffer: fix isVBOSupported() --- src/Gui/GLBuffer.cpp | 5 ++++- src/Gui/GLBuffer.h | 2 +- src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Gui/GLBuffer.cpp b/src/Gui/GLBuffer.cpp index a00202c527..2abc8d0ad8 100644 --- a/src/Gui/GLBuffer.cpp +++ b/src/Gui/GLBuffer.cpp @@ -71,8 +71,11 @@ OpenGLBuffer::~OpenGLBuffer() * When calling this function there must be a current OpenGL context. * \return */ -bool OpenGLBuffer::isVBOSupported() +bool OpenGLBuffer::isVBOSupported(uint32_t ctx) { + auto glue = cc_glglue_instance(ctx); + if (!glue || !cc_glglue_has_vertex_buffer_object(glue)) + return false; const GLubyte * str = glGetString(GL_EXTENSIONS); if (!str) return false; diff --git a/src/Gui/GLBuffer.h b/src/Gui/GLBuffer.h index 5f2283df87..f4f9dfe793 100644 --- a/src/Gui/GLBuffer.h +++ b/src/Gui/GLBuffer.h @@ -34,7 +34,7 @@ public: OpenGLBuffer(GLenum type); ~OpenGLBuffer(); - static bool isVBOSupported(); + static bool isVBOSupported(uint32_t ctx); void setCurrentContext(uint32_t ctx); bool create(); diff --git a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp index ad27faf945..123aa9387b 100644 --- a/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp +++ b/src/Mod/Mesh/Gui/SoFCIndexedFaceSet.cpp @@ -106,7 +106,7 @@ bool MeshRenderer::Private::canRenderGLArray(SoGLRenderAction *action) const static bool init = false; static bool vboAvailable = false; if (!init) { - vboAvailable = Gui::OpenGLBuffer::isVBOSupported(); + vboAvailable = Gui::OpenGLBuffer::isVBOSupported(action->getCacheContext()); if (!vboAvailable) { SoDebugError::postInfo("MeshRenderer", "GL_ARB_vertex_buffer_object extension not supported");