Replaced osg::DrawElementeUInt usage for a more flexible DrawElements base class approach with the default set to DrawElementUShort to ensure compatibility with GLES2 implementes that don't support uint for glDrawElements.
This commit is contained in:
@@ -313,7 +313,7 @@ public:
|
|||||||
osg::buffered_object<Coords3> _transformedBackdropCoords[8];
|
osg::buffered_object<Coords3> _transformedBackdropCoords[8];
|
||||||
ColorCoords _colorCoords;
|
ColorCoords _colorCoords;
|
||||||
|
|
||||||
osg::ref_ptr<osg::DrawElementsUInt> _quadIndices;
|
osg::ref_ptr<osg::DrawElements> _quadIndices;
|
||||||
void updateQuadIndices();
|
void updateQuadIndices();
|
||||||
|
|
||||||
GlyphQuads();
|
GlyphQuads();
|
||||||
|
|||||||
@@ -2091,26 +2091,33 @@ void Text::GlyphQuads::initGlyphQuads()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_quadIndices = new DrawElementsUInt(PrimitiveSet::TRIANGLES);
|
_quadIndices = new DrawElementsUShort(PrimitiveSet::TRIANGLES);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::GlyphQuads::updateQuadIndices()
|
void Text::GlyphQuads::updateQuadIndices()
|
||||||
{
|
{
|
||||||
_quadIndices->clear();
|
unsigned int numCoords = _coords->size();
|
||||||
if (_coords->size() % 4 != 0)
|
unsigned int numQuads = numCoords/4;
|
||||||
|
unsigned int numVertices = numQuads*6;
|
||||||
|
|
||||||
|
if (numCoords % 4 != 0)
|
||||||
{
|
{
|
||||||
OSG_WARN << "size of _coords is not divisible by 4.";
|
OSG_WARN << "size of _coords is not divisible by 4.";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < (unsigned int)_coords->size(); i += 4)
|
|
||||||
{
|
|
||||||
_quadIndices->push_back(i);
|
|
||||||
_quadIndices->push_back(i + 1);
|
|
||||||
_quadIndices->push_back(i + 3);
|
|
||||||
|
|
||||||
_quadIndices->push_back(i + 1);
|
_quadIndices->resizeElements(numVertices);
|
||||||
_quadIndices->push_back(i + 2);
|
|
||||||
_quadIndices->push_back(i + 3);
|
unsigned int vi=0;
|
||||||
|
for (unsigned int i = 0; i < numCoords; i += 4)
|
||||||
|
{
|
||||||
|
_quadIndices->setElement(vi++, i);
|
||||||
|
_quadIndices->setElement(vi++, i + 1);
|
||||||
|
_quadIndices->setElement(vi++, i + 3);
|
||||||
|
|
||||||
|
_quadIndices->setElement(vi++, i + 1);
|
||||||
|
_quadIndices->setElement(vi++, i + 2);
|
||||||
|
_quadIndices->setElement(vi++, i + 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user