[osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO

Remo Eichenberger osgforum at tevs.eu
Fri Jan 27 05:59:48 PST 2017


Hi (Robert :)

I've tried a lot of things to get osgText working on MacOSX with VAO. GL3 on OSX Core Profile requires VAOs.

osgText doesn't setup the VAO path correctly on MacOSX. I can show glyphs when I use a osg::Geometry as a Wrapper to draw geometries from text glyphs like so:


Code:
    
class ExtText : public Text {
    friend class VAOText;
};

class VAOText : public osg::Geometry
{
private:
    osg::ref_ptr<ExtText> _t;

...
    void redraw()
    {
        unsigned int contextID = 0; // renderInfo.getState()->getContextID();
        
        if ( !_t->_textureGlyphQuadMap.empty() )
        {
            const ExtText::GlyphQuads& glyphquad = (_t->_textureGlyphQuadMap.begin())->second;
            if (!glyphquad._transformedCoords[contextID].valid() || glyphquad._transformedCoords[contextID]->empty() )
            {
                _t->computePositions(contextID);
            }
        }
        
        for(ExtText::TextureGlyphQuadMap::iterator titr=_t->_textureGlyphQuadMap.begin();
            titr!=_t->_textureGlyphQuadMap.end();
            ++titr)
        {
            const ExtText::GlyphQuads& glyphquad = titr->second;
            const ExtText::GlyphQuads::Coords3& transformedCoords = glyphquad._transformedCoords[contextID];
            if (transformedCoords.valid() && !transformedCoords->empty())
            {
                
                setVertexArray(transformedCoords.get());
                setTexCoordArray(0, glyphquad._texcoords.get());
                
                getOrCreateStateSet()->setTextureAttributeAndModes(0, titr->first.get(),osg::StateAttribute::ON);
                addPrimitiveSet(glyphquad._quadIndices);
            }
        }
    }




But it doesn't work with plain osgText. So something is wrong in osgText / VAO.

Cheers,
Remo

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70061#70061








More information about the osg-users mailing list