From b2c7d45ceee294cf7a2696e1c3e57a9a8863ecc6 Mon Sep 17 00:00:00 2001 From: Per Inge Mathisen Date: Wed, 19 Dec 2012 23:01:22 +0100 Subject: [PATCH] Also check if vertex array is supported on restoring GL state, not just saving it. This removes OpenGL errors reported repeatedly, and closes ticket:3834. --- 3rdparty/quesoglc/misc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/3rdparty/quesoglc/misc.c b/3rdparty/quesoglc/misc.c index 4f5729ff2..bd6420cbf 100644 --- a/3rdparty/quesoglc/misc.c +++ b/3rdparty/quesoglc/misc.c @@ -607,9 +607,11 @@ void __glcRestoreGLState(const __GLCglState* inGLState, && GLEW_ARB_vertex_buffer_object)) { if (!inGLState->vertexArray) glDisableClientState(GL_VERTEX_ARRAY); - glVertexPointer(inGLState->vertexArraySize, inGLState->vertexArrayType, - inGLState->vertexArrayStride, - inGLState->vertexArrayPointer); + if (inGLState->vertexArray == GL_TRUE) { + glVertexPointer(inGLState->vertexArraySize, inGLState->vertexArrayType, + inGLState->vertexArrayStride, + inGLState->vertexArrayPointer); + } if (!inGLState->normalArray) glDisableClientState(GL_NORMAL_ARRAY); if (!inGLState->colorArray) @@ -618,7 +620,7 @@ void __glcRestoreGLState(const __GLCglState* inGLState, glDisableClientState(GL_INDEX_ARRAY); if (!inGLState->texCoordArray) glDisableClientState(GL_TEXTURE_COORD_ARRAY); - if (inAll || inContext->renderState.renderStyle == GLC_TEXTURE) + if ((inAll || inContext->renderState.renderStyle == GLC_TEXTURE) && inGLState->texCoordArray == GL_TRUE) glTexCoordPointer(inGLState->texCoordArraySize, inGLState->texCoordArrayType, inGLState->texCoordArrayStride,