Fix bad usage of glDrawArrays that could lead to crash in some specific cases

This commit is contained in:
Eduardo Bart 2012-06-18 11:15:44 -03:00
parent 2d04d41f09
commit dff1564395
1 changed files with 5 additions and 1 deletions

View File

@ -100,7 +100,8 @@ void PainterOGL2::drawCoords(CoordsBuffer& coordsBuffer, DrawMode drawMode)
m_drawProgram->setAttributeArray(PainterShaderProgram::TEXCOORD_ATTR, nullptr, 2); m_drawProgram->setAttributeArray(PainterShaderProgram::TEXCOORD_ATTR, nullptr, 2);
} else } else
m_drawProgram->setAttributeArray(PainterShaderProgram::TEXCOORD_ATTR, coordsBuffer.getTextureCoordArray(), 2); m_drawProgram->setAttributeArray(PainterShaderProgram::TEXCOORD_ATTR, coordsBuffer.getTextureCoordArray(), 2);
} } else
PainterShaderProgram::disableAttributeArray(PainterShaderProgram::TEXCOORD_ATTR);
// set vertex array // set vertex array
if(hardwareCached) { if(hardwareCached) {
@ -112,6 +113,9 @@ void PainterOGL2::drawCoords(CoordsBuffer& coordsBuffer, DrawMode drawMode)
// draw the element in coords buffers // draw the element in coords buffers
glDrawArrays(drawMode, 0, vertexCount); glDrawArrays(drawMode, 0, vertexCount);
if(!textured)
PainterShaderProgram::enableAttributeArray(PainterShaderProgram::TEXCOORD_ATTR);
} }
void PainterOGL2::drawTextureCoords(CoordsBuffer& coordsBuffer, const TexturePtr& texture) void PainterOGL2::drawTextureCoords(CoordsBuffer& coordsBuffer, const TexturePtr& texture)