The red text is photoshopped in, and I have not created my own view matrix.
2008/7/19 Peter Wraae Marino <[EMAIL PROTECTED]>: > Hi, > > have you created your own viewmatrix? > I assume the red text is just photoshopped in, right? > > Peter > http://osghelp.com > > > > > On Fri, Jul 18, 2008 at 10:49 PM, James Dickson <[EMAIL PROTECTED]> > wrote: > >> Hi, >> >> I am having an issue with osgText::Text in that the text appears flipped >> and backwards relative to the other geometry in the scene. (Please see >> screenshot for what I mean) >> In the attached screen shot I have written on the coords. of the billboard >> geometry so hopefully the following code will make some sense: >> >> >> // Go through data and plot lines. >> >> for (_i = _testTimeLine.begin(); _i != _testTimeLine.end(); ++_i) >> >> { >> >> std::stringstream _caption; >> >> _caption << *_j; >> >> int _y = static_cast<int>(((*_j) + _minY) * >> >> (( >> _height - 20) / (_maxY - _minY))); >> >> int _x = static_cast<int>(((*_i) + _minX) * >> >> (( >> _width - 20) / (_maxX - _minX))); >> >> _x = _x + 10; >> >> _y = _y + 10; >> >> // If not at the beginning of the vector, draw a line, otherwise >> >> // colour a pixel. >> >> if (_i != _testTimeLine.begin()) >> >> { >> >> m_graphImage->DrawLine(osg::Vec2(_prevx, _prevy), >> >> osg::Vec2(_x, _y), >> >> osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f)); >> >> } >> >> else >> >> { >> >> m_graphImage->SetPixel(osg::Vec2(_x, _y), >> >> osg::Vec3(0.0f, 0.0f, 1.0f)); >> >> } >> >> _prevx = _x; >> >> _prevy = _y; >> >> // Convert texture coordinates to uv's to use as offsets. >> >> float _u = ((float)_x) / ((float)_width); >> >> float _v = ((float)_y) / ((float)_height); >> >> osg::Vec3 _xoffset(_u, 0.0f, 0.0f); >> >> osg::Vec3 _zoffset(0.0f, 0.0f, _v); >> >> // Use offsets to create world space coordinates. >> >> osg::Vec3 _pos = m_corner + _xoffset + _yoffset >> >> + >> _zoffset; >> >> // Create and position text displaying data point value. >> >> osgText::Text * _text = new osgText::Text; >> >> _text->setFont(_font); >> >> _text->setCharacterSize(characterSize); >> >> _text->setPosition(_pos); >> >> _text->setAxisAlignment(osgText::Text::XZ_PLANE); >> >> _text->setText(_caption.str()); >> >> _captions->addDrawable(_text); >> >> ++ >> _j; >> >> } >> I have managed to fix it by changing the alignment setting to >> REVERSE_XZ_PLANE and switching the sign of the offset coords. However I feel >> this is a slight hack and wondered if there is some other 'proper' setting? >> >> Many thanks, >> >> James >> >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > > > -- > Regards, > Peter Wraae Marino > > www.osghelp.com - OpenSceneGraph support site > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > -- James Dickson
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org