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:
@@ -313,7 +313,7 @@ public:
|
||||
osg::buffered_object<Coords3> _transformedBackdropCoords[8];
|
||||
ColorCoords _colorCoords;
|
||||
|
||||
osg::ref_ptr<osg::DrawElementsUInt> _quadIndices;
|
||||
osg::ref_ptr<osg::DrawElementsUShort> _quadIndices;
|
||||
void updateQuadIndices();
|
||||
|
||||
GlyphQuads();
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
|
||||
LineNumbers& getLineNumbers() { return _lineNumbers; }
|
||||
const LineNumbers& getLineNumbers() const { return _lineNumbers; }
|
||||
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
@@ -344,9 +344,9 @@ public:
|
||||
* the specified graphics context. Otherwise, releases OpenGL objexts
|
||||
* for all graphics contexts. */
|
||||
void releaseGLObjects(osg::State* state=0) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
GlyphQuads& operator = (const GlyphQuads&) { return *this; }
|
||||
};
|
||||
|
||||
|
||||
@@ -2091,7 +2091,7 @@ void Text::GlyphQuads::initGlyphQuads()
|
||||
}
|
||||
}
|
||||
|
||||
_quadIndices = new DrawElementsUInt(PrimitiveSet::TRIANGLES);
|
||||
_quadIndices = new DrawElementsUShort(PrimitiveSet::TRIANGLES);
|
||||
}
|
||||
|
||||
void Text::GlyphQuads::updateQuadIndices()
|
||||
@@ -2102,7 +2102,7 @@ void Text::GlyphQuads::updateQuadIndices()
|
||||
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 + 1);
|
||||
|
||||
Reference in New Issue
Block a user