Hi,

On 07/06/11 17:34, hemanth korrapati wrote:
Thank you for your answer. can I find an example related to this idea ?

I can make you one, but that would leave no fun/exploration for you :)

Start simple and look at what "osgviewer --image myimage.jpg" does. Or look at osgmovie. These examples load an osg::Image and place it onto a quad.

What you need to do instead of loading the image, is creating an empty image of the right size (and allocating memory for it - see the osg::Image header for the calls) and then poke your values into it. Attach the image to a texture and then attach the texture to a quad. You can set the texture sampling for the texture (search for FilterMode and NEAREST).

You can visualise this quad with your texture on in many ways, depending on what camera you use to look at it. E.g. normal OSG camera where you can spin it around, or you can put it in a HUD, or you can make an orthographic camera.

HTH
jp



On Tue, Jun 7, 2011 at 1:27 PM, J.P. Delport <[email protected]
<mailto:[email protected]>> wrote:

    Hi,

    another option instead of drawing geometry would be to put your data
    into a texture (image) and then just visualise that. Using "nearest"
    sampling would give you little squares too.

    jp


    On 07/06/11 12:38, Sebastian Messerschmidt wrote:

          From the first look I'd advise to split up the geometries and
        put them
        into multiple nodes.
        Looking at the code I don't know which limit you're hitting
        here, but
        there are limits in the opengl implementations that might dissallow
        buffers beyond certain sizes.

        cheers
        Sebastian

            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 <tel:%2B33%20%280%29650348239>
            http://hemanth-k.co.in


            _______________________________________________
            osg-users mailing list
            [email protected]
            <mailto:[email protected]>
            
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




        _______________________________________________
        osg-users mailing list
        [email protected]
        <mailto:[email protected]>
        
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


    --
    This message is subject to the CSIR's copyright terms and
    conditions, e-mail legal notice, and implemented Open Document
    Format (ODF) standard. The full disclaimer details can be found at
    http://www.csir.co.za/disclaimer.html.

    This message has been scanned for viruses and dangerous content by
    MailScanner, and is believed to be clean.


    _______________________________________________
    osg-users mailing list
    [email protected]
    <mailto:[email protected]>
    http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
Hemanth Korrapati,
Doctoral Student,
LASMEA,
Universite Blaise Pascal,
Campus des Cezeaux
63170 Clermont-Ferrand,
France.
Mobile: +33 (0)650348239 <tel:%2B33%20%280%29650348239>
http://hemanth-k.co.in



_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to