[osg-users] bug: osgText doesn't work on MacOSX GL4.x with VAO
Remo Eichenberger
osgforum at tevs.eu
Fri Jan 20 14:06:45 PST 2017
Hi Sebastian
Thank you for your help. Yes i don't see the glyphs. I use osgEarth, but this should not be a problem :)
I've tried the following according your sample:
Code:
ControlCanvas* canvas = ControlCanvas::getOrCreate( view );
view->getCamera()->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(true);
view->getCamera()->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(true);
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
osg::ref_ptr<osg::Image> image = new osg::Image();
image->allocateImage(512, 512, 1, GL_RGBA, GL_UNSIGNED_BYTE);
texture->setImage(image);
view->getCamera()->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
LabelControl* label = new LabelControl();
osg::Program* textProgramObject = new osg::Program;
osg::Shader* textVertexObject =
new osg::Shader( osg::Shader::VERTEX );
osg::Shader* textFragmentObject =
new osg::Shader( osg::Shader::FRAGMENT );
textProgramObject->addShader( textFragmentObject );
textProgramObject->addShader( textVertexObject );
textFragmentObject->setShaderSource(frag);
textVertexObject->setShaderSource(vert);
label->getOrCreateStateSet()->setAttributeAndModes(textProgramObject, osg::StateAttribute::ON);
label->setTextBackdropType(osgText::Text::BackdropType::NONE);
label->setTextBackdropImplementation(osgText::Text::BackdropImplementation::DELAYED_DEPTH_WRITES);
label->setBackColor( Color( Color::Black, 0.8 ) );
label->setHorizAlign( Control::ALIGN_RIGHT );
label->setVertAlign( Control::ALIGN_BOTTOM );
label->setVisible( true );
But i don't see any glyphs.
Cheers,
Remo[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70024#70024
More information about the osg-users
mailing list