From Ognjen Kostic, "Some android phones have no support for OES_element_index_uint extension that is required if glDrawElements is to be called with GL_UNSIGNED_INT for element type.

In OSG 3.4, osgText::Text( ::_quadIndices) uses DrawElementsUInt that will fail on these devices and no text will appear - tested on Samsung Galaxy Trend 2 SM-G313HN.

When DrawElementsUInt is replaced with DrawElementsUShort it works, although I'm not sure if this can cause other problems with some fonts.

Fix:
- In include\osgText\Text, line 316:
        replace: "osg::ref_ptr< osg::DrawElementsUInt > _quadIndices;"
        with:    "osg::ref_ptr< osg::DrawElementsUShort > _quadIndices;"

- In src\osgText\Text.cpp, line 2094:
        replace: "_quadIndices = new DrawElementsUInt(PrimitiveSet::TRIANGLES);"
        with:    "_quadIndices = new DrawElementsUShort(PrimitiveSet::TRIANGLES);"
"
This commit is contained in:
Robert Osfield 2016-03-01 10:21:14 +00:00
parent f73d1fb7ea
commit be98c884bd
2 changed files with 6 additions and 6 deletions

View File

@ -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::DrawElementsUShort> _quadIndices;
void updateQuadIndices(); void updateQuadIndices();
GlyphQuads(); GlyphQuads();

View File

@ -2091,7 +2091,7 @@ void Text::GlyphQuads::initGlyphQuads()
} }
} }
_quadIndices = new DrawElementsUInt(PrimitiveSet::TRIANGLES); _quadIndices = new DrawElementsUShort(PrimitiveSet::TRIANGLES);
} }
void Text::GlyphQuads::updateQuadIndices() void Text::GlyphQuads::updateQuadIndices()
@ -2102,7 +2102,7 @@ void Text::GlyphQuads::updateQuadIndices()
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) for (unsigned short i = 0; i < (unsigned short)_coords->size(); i += 4)
{ {
_quadIndices->push_back(i); _quadIndices->push_back(i);
_quadIndices->push_back(i + 1); _quadIndices->push_back(i + 1);