Hi

I have modified the createHUD function provided in the 'osgpick' example,
for my application as below. Essentially i have to plot a matrix of values
on the screen with each matrix entry represented by a square and its color
represented by its value.
The size of the matrix is 1615 x 1615. when i run the program, it takes a
long time with a blank screen before giving a segmentation fault message.

Can I get some help on this - the reason for the error and an efficient way
to do this, because I may have to plot 6500 x 6500 sized matrices in the
future. I have also posted the gdb output below.
Thank you

======================================================================================================================
modified createHUD function used in my application
____________________________________________________________________________________________________________________

osg::Node* createHUD(osgText::Text* updateText, vector<vector<double> > &
simmat, double max)
{

    // create the hud. derived from osgHud.cpp
    // adds a set of quads, each in a separate Geode - which can be picked
individually
    // eg to be used as a menuing/help system!
    // Can pick texts too!

    osg::Camera* hudCamera = new osg::Camera;
    hudCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
    hudCamera->setProjectionMatrixAsOrtho2D(0,3200,0,1600);
    hudCamera->setViewMatrix(osg::Matrix::identity());
    hudCamera->setRenderOrder(osg::Camera::POST_RENDER);
    hudCamera->setClearMask(GL_DEPTH_BUFFER_BIT);

    std::string timesFont("fonts/times.ttf");

    // turn lighting off for the text and disable depth test to ensure its
always ontop.
    osg::Vec3 position(100.0f,1550.0f,0.0f);
    osg::Vec3 delta(0.0f,-60.0f,0.0f);

    osg::Geode* geode = new osg::Geode();
    osg::StateSet* stateset = geode->getOrCreateStateSet();
    stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
    stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);

    for(int i=0; i<simmat.size(); i++)
    {
            for(int j=0; j<simmat[i].size(); j++)
            {

                    osg::Geometry *quad=new osg::Geometry;
                    osg::Vec3Array* vertices = new osg::Vec3Array(4); // 1
quad
                    osg::Vec4Array* colors = new osg::Vec4Array;
                    double colorval=simmat[i][j]/max;
                    colors->push_back(osg::Vec4(colorval,colorval,colorval,
1.0));
                    quad->setColorArray(colors);

quad->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE);
                   osg::Vec3 newpos=position+osg::Vec3(j,i,0);
                    (*vertices)[0]=newpos;
                    (*vertices)[1]=newpos+osg::Vec3(0.0f,-1.0f,0.0f);
                    (*vertices)[2]=newpos+osg::Vec3(1.0f,-1.0f,0.0f);
                    (*vertices)[3]=newpos+osg::Vec3(1.0f,0.0f,0.0f);
                    quad->setVertexArray(vertices);
                    quad->addPrimitiveSet(new
osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
                    geode->addDrawable(quad);
           }
    }



        hudCamera->addChild(geode);
    return hudCamera;

}
===================================================================================================

====================================================================================================
GDB output:
____________________________________________________________________________________________________________________

Starting program: /hemanth/Workspace/visualization/a.out
/hemanth/Workspace/loop_closure/log_pavin25610_56_usurf128_delta4_tfidfm/matches
[Thread debugging using libthread_db enabled]
[New Thread 0xb7b48b70 (LWP 3756)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7b48b70 (LWP 3756)]
0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so
(gdb) bt
#0  0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so
#1  0x012767d8 in _mesa_NewList () from /usr/lib/dri/swrast_dri.so
#2  0x002c1944 in osg::Drawable::compileGLObjects(osg::RenderInfo&) const ()
from /usr/local/lib/libosg.so.65
#3  0x005ac85b in osgUtil::GLObjectsVisitor::apply(osg::Drawable&) () from
/usr/local/lib/libosgUtil.so.65
#4  0x005ad461 in osgUtil::GLObjectsVisitor::apply(osg::Geode&) () from
/usr/local/lib/libosgUtil.so.65
#5  0x002d7079 in osg::Geode::accept(osg::NodeVisitor&) () from
/usr/local/lib/libosg.so.65
#6  0x0030e7d4 in osg::Group::traverse(osg::NodeVisitor&) () from
/usr/local/lib/libosg.so.65
#7  0x005ad3db in osgUtil::GLObjectsVisitor::apply(osg::Node&) () from
/usr/local/lib/libosgUtil.so.65
#8  0x0034ff18 in osg::NodeVisitor::apply(osg::Group&) () from
/usr/local/lib/libosg.so.65
#9  0x0034fff8 in osg::NodeVisitor::apply(osg::Transform&) () from
/usr/local/lib/libosg.so.65
#10 0x00350018 in osg::NodeVisitor::apply(osg::Camera&) () from
/usr/local/lib/libosg.so.65
#11 0x002932f9 in osg::Camera::accept(osg::NodeVisitor&) () from
/usr/local/lib/libosg.so.65
#12 0x0030e7d4 in osg::Group::traverse(osg::NodeVisitor&) () from
/usr/local/lib/libosg.so.65
#13 0x005ad3db in osgUtil::GLObjectsVisitor::apply(osg::Node&) () from
/usr/local/lib/libosgUtil.so.65
#14 0x0034ff18 in osg::NodeVisitor::apply(osg::Group&) () from
/usr/local/lib/libosg.so.65
#15 0x003105d9 in osg::Group::accept(osg::NodeVisitor&) () from
/usr/local/lib/libosg.so.65
#16 0x0083b3d4 in osgViewer::Renderer::compile() () from
/usr/local/lib/libosgViewer.so.65
#17 0x00839713 in osgViewer::Renderer::draw() () from
/usr/local/lib/libosgViewer.so.65
#18 0x00835f77 in osgViewer::Renderer::operator()(osg::GraphicsContext*) ()
from /usr/local/lib/libosgViewer.so.65
#19 0x0030a9c8 in osg::GraphicsContext::runOperations() () from
/usr/local/lib/libosg.so.65
#20 0x0030c84d in osg::RunOperations::operator()(osg::GraphicsContext*) ()
from /usr/local/lib/libosg.so.65
#21 0x0030c9c5 in osg::GraphicsOperation::operator()(osg::Object*) () from
/usr/local/lib/libosg.so.65
#22 0x00359c22 in osg::OperationThread::run() () from
/usr/local/lib/libosg.so.65
#23 0x0030ca49 in osg::GraphicsThread::run() () from
/usr/local/lib/libosg.so.65
#24 0x001ad45b in OpenThreads::ThreadPrivateActions::StartThread(void*) ()
from /usr/local/lib/libOpenThreads.so.11
#25 0x0048f80e in start_thread (arg=0xb7b48b70) at pthread_create.c:300
#26 0x00f5fa0e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
(gdb) q
=============================================================================================================

-- 
Hemanth Korrapati,
LASMEA,
Universite Blaise Pascal,
France.
Mobile: +33 (0)650348239
http://hemanth-k.co.in
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to