Robert Osfield wrote:
> We've all been busy testing out 2.8.0-rc1 and uncovered a few more
> bugs, build problems and warnings that our now fixed - testing really
> is paying dividends ;-)
I noticed that two empty lines in an osgText::Text are not rendered
correctly (it only shows one empty line), see the attached test.
However, I ran this test a few times now and I get a segfault at exit a
small percentage of the time. The traceback is

#0  0xb7888576 in glDrawBuffer () from
//usr//lib/opengl/nvidia/lib/libGL.so.1
(gdb) bt
#0  0xb7888576 in glDrawBuffer () from
//usr//lib/opengl/nvidia/lib/libGL.so.1
#1  0xb757e68d in osgUtil::RenderStage::drawInner (this=0x80899c0,
renderin...@0xb6518d30, previo...@0xb65190d4, docopytextu...@0xb6518d57)
    at /home/melis/c/osg/svn/branches-2.8/src/osgUtil/RenderStage.cpp:830
#2  0xb7581226 in osgUtil::RenderStage::draw (this=0x80899c0,
renderin...@0x8088664, previo...@0xb65190d4) at
/home/melis/c/osg/svn/branches-2.8/src/osgUtil/RenderStage.cpp:1108
#3  0xb7589bd6 in osgUtil::SceneView::draw (this=0x8088608) at
/home/melis/c/osg/svn/branches-2.8/src/osgUtil/SceneView.cpp:1540
#4  0xb7bdc248 in osgViewer::Renderer::draw (this=0x8087ec8) at
/home/melis/c/osg/svn/branches-2.8/src/osgViewer/Renderer.cpp:451
#5  0xb7bd5998 in osgViewer::Renderer::operator() (this=0x8089ab4,
context=0x8088798) at
/home/melis/c/osg/svn/branches-2.8/src/osgViewer/Renderer.cpp:693
#6  0xb7dd557a in osg::GraphicsContext::runOperations (this=0x8088798)
at /home/melis/c/osg/svn/branches-2.8/src/osg/GraphicsContext.cpp:688
#7  0xb7ddbfad in osg::RunOperations::operator() (this=0x80c71e8,
context=0x8088798) at
/home/melis/c/osg/svn/branches-2.8/src/osg/GraphicsThread.cpp:134
#8  0xb7ddc0a5 in osg::GraphicsOperation::operator() (this=0x80c71e8,
object=0x8088798) at
/home/melis/c/osg/svn/branches-2.8/src/osg/GraphicsThread.cpp:50
#9  0xb7e24c59 in osg::OperationThread::run (this=0x80c6fc8) at
/home/melis/c/osg/svn/branches-2.8/src/osg/OperationThread.cpp:413
#10 0xb7ddc117 in osg::GraphicsThread::run (this=0x80c6fc8) at
/home/melis/c/osg/svn/branches-2.8/src/osg/GraphicsThread.cpp:38
#11 0xb792e1bd in OpenThreads::ThreadPrivateActions::StartThread
(data=0x80c6fd4) at
/home/melis/c/osg/svn/branches-2.8/src/OpenThreads/pthreads/PThread.c++:170
#12 0xb791818b in start_thread () from /lib/libpthread.so.0
#13 0xb79f409e in clone () from /lib/libc.so.6

I'm not modifying the text in the viewer loop, it's all set up before
the viewer is even constructed. I'm not using ref_ptr<> because
everything is constructed in main(), is that the problem here?

Paul
// g++ -o txt text.cpp -I ~/osg2.8/include -L ~/osg2.8/lib -losg -losgText 
-losgViewer -losgDB -losgUtil -losgGA
#include <osgViewer/Viewer>
#include <osgText/Text>
#include <osg/Camera>

// lines 5 and 6 (both empty) are rendered as a single emtpy line
const char *s = "Line 1\nLine 2\n\nLine 4\n\n\nLine 7\nLine 8\n";

int
main()
{
    osgText::Text *t = new osgText::Text();
    t->setFont("fonts/arial.ttf");
    t->setText(s);
    t->setCharacterSize(32.0);
    t->setPosition(osg::Vec3(100, 600, 0));

    osg::Geode *g = new osg::Geode();
    g->addDrawable(t);

    osg::Camera *c = new osg::Camera();
    c->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
    c->setProjectionMatrixAsOrtho2D(0, 1280, 0, 1024);
    c->setViewMatrix(osg::Matrix::identity());
    c->setClearMask(GL_DEPTH_BUFFER_BIT);
    c->addChild(g);
    c->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

    osgViewer::Viewer *v = new osgViewer::Viewer();
    v->setSceneData(c);
    v->realize();
    v->run();
}
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to