Added checks in the drawImplementation to catch when attribute bindings are set on
but the relevant arrays remain unset, this prevents previous crash when this occured.
This commit is contained in:
parent
34953f7dec
commit
e311cf83d8
@ -1045,22 +1045,22 @@ void Geometry::drawImplementation(State& state) const
|
|||||||
else
|
else
|
||||||
state.disableVertexPointer();
|
state.disableVertexPointer();
|
||||||
|
|
||||||
if (_normalData.binding==BIND_PER_VERTEX)
|
if (_normalData.binding==BIND_PER_VERTEX && _normalData.array.valid())
|
||||||
state.setNormalPointer(GL_FLOAT,0,(const GLvoid*)_normalData.offset);
|
state.setNormalPointer(GL_FLOAT,0,(const GLvoid*)_normalData.offset);
|
||||||
else
|
else
|
||||||
state.disableNormalPointer();
|
state.disableNormalPointer();
|
||||||
|
|
||||||
if (_colorData.binding==BIND_PER_VERTEX)
|
if (_colorData.binding==BIND_PER_VERTEX && _colorData.array.valid())
|
||||||
state.setColorPointer(_colorData.array->getDataSize(),_colorData.array->getDataType(),0,(const GLvoid*)_colorData.offset);
|
state.setColorPointer(_colorData.array->getDataSize(),_colorData.array->getDataType(),0,(const GLvoid*)_colorData.offset);
|
||||||
else
|
else
|
||||||
state.disableColorPointer();
|
state.disableColorPointer();
|
||||||
|
|
||||||
if (secondaryColorBinding==BIND_PER_VERTEX)
|
if (secondaryColorBinding==BIND_PER_VERTEX && _secondaryColorData.array.valid())
|
||||||
state.setSecondaryColorPointer(_secondaryColorData.array->getDataSize(),_secondaryColorData.array->getDataType(),0,(const GLvoid*)_secondaryColorData.offset);
|
state.setSecondaryColorPointer(_secondaryColorData.array->getDataSize(),_secondaryColorData.array->getDataType(),0,(const GLvoid*)_secondaryColorData.offset);
|
||||||
else
|
else
|
||||||
state.disableSecondaryColorPointer();
|
state.disableSecondaryColorPointer();
|
||||||
|
|
||||||
if (fogCoordBinding==BIND_PER_VERTEX)
|
if (fogCoordBinding==BIND_PER_VERTEX && _fogCoordData.array.valid())
|
||||||
state.setFogCoordPointer(GL_FLOAT,0,(const GLvoid*)_fogCoordData.offset);
|
state.setFogCoordPointer(GL_FLOAT,0,(const GLvoid*)_fogCoordData.offset);
|
||||||
else
|
else
|
||||||
state.disableFogCoordPointer();
|
state.disableFogCoordPointer();
|
||||||
@ -1132,22 +1132,22 @@ void Geometry::drawImplementation(State& state) const
|
|||||||
else
|
else
|
||||||
state.disableVertexPointer();
|
state.disableVertexPointer();
|
||||||
|
|
||||||
if (_normalData.binding==BIND_PER_VERTEX)
|
if (_normalData.binding==BIND_PER_VERTEX && _normalData.array.valid())
|
||||||
state.setNormalPointer(_normalData.array->getDataType(),0,_normalData.array->getDataPointer());
|
state.setNormalPointer(_normalData.array->getDataType(),0,_normalData.array->getDataPointer());
|
||||||
else
|
else
|
||||||
state.disableNormalPointer();
|
state.disableNormalPointer();
|
||||||
|
|
||||||
if (_colorData.binding==BIND_PER_VERTEX)
|
if (_colorData.binding==BIND_PER_VERTEX && _colorData.array.valid())
|
||||||
state.setColorPointer(_colorData.array->getDataSize(),_colorData.array->getDataType(),0,_colorData.array->getDataPointer());
|
state.setColorPointer(_colorData.array->getDataSize(),_colorData.array->getDataType(),0,_colorData.array->getDataPointer());
|
||||||
else
|
else
|
||||||
state.disableColorPointer();
|
state.disableColorPointer();
|
||||||
|
|
||||||
if (secondaryColorBinding==BIND_PER_VERTEX)
|
if (secondaryColorBinding==BIND_PER_VERTEX && _secondaryColorData.array.valid())
|
||||||
state.setSecondaryColorPointer(_secondaryColorData.array->getDataSize(),_secondaryColorData.array->getDataType(),0,_secondaryColorData.array->getDataPointer());
|
state.setSecondaryColorPointer(_secondaryColorData.array->getDataSize(),_secondaryColorData.array->getDataType(),0,_secondaryColorData.array->getDataPointer());
|
||||||
else
|
else
|
||||||
state.disableSecondaryColorPointer();
|
state.disableSecondaryColorPointer();
|
||||||
|
|
||||||
if (fogCoordBinding==BIND_PER_VERTEX)
|
if (fogCoordBinding==BIND_PER_VERTEX && _fogCoordData.array.valid())
|
||||||
state.setFogCoordPointer(GL_FLOAT,0,_fogCoordData.array->getDataPointer());
|
state.setFogCoordPointer(GL_FLOAT,0,_fogCoordData.array->getDataPointer());
|
||||||
else
|
else
|
||||||
state.disableFogCoordPointer();
|
state.disableFogCoordPointer();
|
||||||
@ -1210,8 +1210,8 @@ void Geometry::drawImplementation(State& state) const
|
|||||||
//
|
//
|
||||||
// pass the overall binding values onto OpenGL.
|
// pass the overall binding values onto OpenGL.
|
||||||
//
|
//
|
||||||
if (_normalData.binding==BIND_OVERALL) drawNormal(normalIndex++);
|
if (_normalData.binding==BIND_OVERALL) drawNormal(normalIndex++);
|
||||||
if (_colorData.binding==BIND_OVERALL) drawColor(colorIndex++);
|
if (_colorData.binding==BIND_OVERALL) drawColor(colorIndex++);
|
||||||
if (secondaryColorBinding==BIND_OVERALL) drawSecondaryColor(secondaryColorIndex++);
|
if (secondaryColorBinding==BIND_OVERALL) drawSecondaryColor(secondaryColorIndex++);
|
||||||
if (fogCoordBinding==BIND_OVERALL) drawFogCoord(fogCoordIndex++);
|
if (fogCoordBinding==BIND_OVERALL) drawFogCoord(fogCoordIndex++);
|
||||||
if (handleVertexAttributes)
|
if (handleVertexAttributes)
|
||||||
@ -1233,8 +1233,8 @@ void Geometry::drawImplementation(State& state) const
|
|||||||
++itr)
|
++itr)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_normalData.binding==BIND_PER_PRIMITIVE_SET) drawNormal(normalIndex++);
|
if (_normalData.binding==BIND_PER_PRIMITIVE_SET) drawNormal(normalIndex++);
|
||||||
if (_colorData.binding==BIND_PER_PRIMITIVE_SET) drawColor(colorIndex++);
|
if (_colorData.binding==BIND_PER_PRIMITIVE_SET) drawColor(colorIndex++);
|
||||||
if (secondaryColorBinding==BIND_PER_PRIMITIVE_SET) drawSecondaryColor(secondaryColorIndex++);
|
if (secondaryColorBinding==BIND_PER_PRIMITIVE_SET) drawSecondaryColor(secondaryColorIndex++);
|
||||||
if (fogCoordBinding==BIND_PER_PRIMITIVE_SET) drawFogCoord(fogCoordIndex++);
|
if (fogCoordBinding==BIND_PER_PRIMITIVE_SET) drawFogCoord(fogCoordIndex++);
|
||||||
if (handleVertexAttributes)
|
if (handleVertexAttributes)
|
||||||
|
Loading…
Reference in New Issue
Block a user