Re: [osg-users] osgText setColor problem
On 11 November 2016 at 06:58, Rambabu Repakawrote: > Hi,Iam new to osg can anyone help me in setting a color to the 2d text. Just look at the code. The osgtext example for instance. It was written *exactly* for this purpose. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText setColor problem
Hi,Iam new to osg can anyone help me in setting a color to the 2d text. ... Thank you! Cheers, Rambabu -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69316#69316 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgText setColor problem
Hi, I've got a simple function which creates a text object and attaches it to a Geode: osg::ref_ptrosg::Geode drawLabels() { osg::ref_ptrosg::Geode geode = new osg::Geode; osg::ref_ptrosgText::Font font = osgText::readFontFile(fonts/forte.ttf); osg::ref_ptrosgText::Text text1 = new osgText::Text; text1-setFont(font.get()); text1-setColor(osg::Vec4(1.0f,0.0f,0.0,1.0f)); text1-setCharacterSize(200.0f); text1-setPosition(osg::Vec3(0.0f,0.0f,0.0f)); text1-setAxisAlignment(osgText::Text::SCREEN); text1-setText(SomeText); geode-addDrawable(text1.get()); return geode.release(); } Everything works correctly (correct font, size, etc...) except that whatever I put in the setColor function call, the text is always black. I tried setting GL_LIGHTING to off for the geode but it had no effect. Any Ideas? Cheers, Matthew -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37505#37505 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText setColor problem
Hi Mathew, I now idea what might amiss. What happens when you run the osgtext example? Robert. On Thu, Mar 10, 2011 at 2:46 PM, Matthew Parry matthew...@live.co.uk wrote: Hi, I've got a simple function which creates a text object and attaches it to a Geode: osg::ref_ptrosg::Geode drawLabels() { osg::ref_ptrosg::Geode geode = new osg::Geode; osg::ref_ptrosgText::Font font = osgText::readFontFile(fonts/forte.ttf); osg::ref_ptrosgText::Text text1 = new osgText::Text; text1-setFont(font.get()); text1-setColor(osg::Vec4(1.0f,0.0f,0.0,1.0f)); text1-setCharacterSize(200.0f); text1-setPosition(osg::Vec3(0.0f,0.0f,0.0f)); text1-setAxisAlignment(osgText::Text::SCREEN); text1-setText(SomeText); geode-addDrawable(text1.get()); return geode.release(); } Everything works correctly (correct font, size, etc...) except that whatever I put in the setColor function call, the text is always black. I tried setting GL_LIGHTING to off for the geode but it had no effect. Any Ideas? Cheers, Matthew -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37505#37505 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText setColor problem
Hi Robert, I just tried running the example and the color works correctly. I'm now even more confused! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37509#37509 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText setColor problem
Hi Matthew, On Thu, Mar 10, 2011 at 3:23 PM, Matthew Parry matthew...@live.co.uk wrote: I just tried running the example and the color works correctly. I'm now even more confused! Might you have a StateSet higher up in the scene graph that decorates the Text drawable and override it's state, such as adding multi-texturing or provideding an osg::Material that switches off the GL_COLOR_MATERIAL feature that allows glColor to override the colour. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText setColor problem
Ok, I tried attaching it to the root node and the color now works, previously it was attached to a ShadowedScene node which was itself attached to the root. So obviously something in that ShadowedScene node is causing the problem, I still don't know what it is as I don't do set anything in the stateset that should affect the text color to my knowledge but at least it works now! Thanks for the help. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37511#37511 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText setColor problem
Hi Matthew, On Thu, Mar 10, 2011 at 3:56 PM, Matthew Parry matthew...@live.co.uk wrote: Ok, I tried attaching it to the root node and the color now works, previously it was attached to a ShadowedScene node which was itself attached to the root. So obviously something in that ShadowedScene node is causing the problem, I still don't know what it is as I don't do set anything in the stateset that should affect the text color to my knowledge but at least it works now! Thanks for the help. The shaders used for shadowing will probably be the culprit, or perhaps you text is just in shadow ;-) Do you want your text to be effected by shadows? If not putting them outseide of teh ShadowedScene subgraph would be the thing to do. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org