GLBuffer: fix isVBOSupported()

This commit is contained in:
Zheng, Lei
2018-08-29 12:39:45 +08:00
committed by wmayer
parent b5467b02ad
commit 4231194a37
3 changed files with 6 additions and 3 deletions

View File

@@ -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;

View File

@@ -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();

View File

@@ -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");