Don Tolley | 20 Jul 23:47 2014
Picon

Re: FFMPEG plug-in fixes

Hi,

I am tried using this fix, however while I did get sound but it is distorted.  I am using the 3.2.1 version of OSG
and the latest ffmpeg build for windows.

What version of ffmpeg did you use for your tests by the way? any suggestions?

Cheers,

Don

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=60367#60367
Jaap Glas | 17 Jul 14:56 2014

Crash-fix in Glyph.cpp if scene has 2D textures with stride

Dear all,

I am an employee of dGB Earth Sciences. We have ported the 3D visualization
of our open-source seismic interpretation package OpendTect to OpenSceneGraph.
We are currently in the bug fixing stage of the OpendTect 5.0 beta-release.

I want to submit a bugfix for a crash occurring in osgText/Glyph.cpp if
the scene tree contains (large) 2D textures from images with STRIDE.

============================================================================
#0  0x00007fffe8ea4350 in __memmove_ssse3 () from /lib64/libc.so.6
#1  0x00007fffe52ced76 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#2  0x00007fffe52d8e86 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#3  0x00007fffe53dd8be in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#4  0x00007fffe53c2643 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#5  0x00007fffe53c7fdd in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#6  0x00007fffe53cbabf in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#7  0x00007fffe53cc1fa in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#8  0x00007ffff30092fd in osgText::GlyphTexture::apply (this=0x1bb8cf0, state=
    ...)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/src/osgText/Glyph.cpp:234
#9  0x00007ffff56c30b6 in osg::State::applyAttributeOnTexUnit (this=0x125f180,
    unit=0, attribute=0x1bb8cf0, as=...)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:1713
#10 0x00007ffff56c2f3f in osg::State::applyTextureAttribute (this=0x125f180,
    unit=0, attribute=0x1bb8cf0)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:411
#11 0x00007ffff30204da in osgText::Text::drawTextWithBackdrop (this=0x1baed70,
    state=..., colorMultiplier=...)
==============================================================================

The crash disappears if I either (1) disable the use of images with stride
in the (public) osgGeo-library, or (2) add the following bugfix to Glyph.cpp.
This combination gives me the confidence that I understand where this problem
originates from, without trying to understand the full OpenGL details. 

===============================================================================
<at> <at> -221,7 +223,12 <at> <at>
             imageData[i] = 0;
         }
 
+        glPixelStorei(GL_UNPACK_ALIGNMENT,1);
 
+        #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
+        glPixelStorei(GL_UNPACK_ROW_LENGTH,getTextureWidth());
+        #endif
+
         // allocate the texture memory.
         glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
                 getTextureWidth(), getTextureHeight(), 0,
================================================================================

I have copied (and adapted) the added lines above from the same source file,
where they were used in front of a similar call to glTexSubImage2D(.) around
line 515.

QUESTION: The only thing I am wondering is whether exactly the same bugfix
should also be added in front of the call to glTexSubImage2D(.) around
line 376, where "the image is subloaded once"?

The attached file osgText/Glyph.cpp with modifications was taken from the
OSG 3.3.1 developers release, but the same bugfix(es) should go into the
OSG 3.2 stable release too.


Best regards,

Jaap Glas

--
--
dr. Jaap C. Glas
Software Engineer
______________________________

dGB Earth Sciences
Phone: +31 53 4315155
E-mail: jaap.glas-T0UFp3o85ygAvxtiuMwx3w@public.gmane.org
Internet: dgbes.com & opendtect.org
______________________________
Attachment (Glyph.cpp): text/x-c++src, 21 KiB
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Pjotr Svetachov | 16 Jul 16:10 2014
Picon

remove unneeded ref_ptrs in the cullvisitor.

Hi Robert,

I think I spotted some unneeded ref_ptrs in the cullvisitor. The call
pushModelViewMatrix or pushProjectionMatrix will already keep the
reference when adding it to the MatrixStack. In CullVisitor::apply
methods for the billboard and the camera you already take a pointer
instead of a ref_ptr.

Cheers,
Pjotr
Attachment (CullVisitor.cpp): text/x-c++src, 76 KiB
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Luc Frauciel | 10 Jul 11:48 2014

Bug in osgviewerQt with QT5/VS2012/Windows7

Hi Robert,

 

We’ve recently upgraded to a QT5/VS2012/Windows7 environment.

We use an application that uses osgviewerQt model for Qt/OpenSceneGraph integration.

With the new environment, the application hang each time a widget partially covers the QGLWidget.

Some investigation showed that it was related to QTimer used to refresh the widget.

The problem is similar to this thread :

https://bugreports.qt-project.org/browse/QTBUG-27266

A solution is to fire the timer only once and repeat once called.

This problem only appear on windows, with VS2012, QT up to 5.3,  but the new behavior shouldn’t affect negatively other platforms.

 

    Regards,

 

Luc Frauciel
Responsable R&D

R&D Manager

 









1Spatial France SAS

Les informations contenues dans cet e-mail sont confidentielles et uniquement adressées au destinataire. Les opinions qui y sont exprimées peuvent être celles de l'auteur et ne représentent pas nécessairement celles du Groupe 1Spatial. Cet e-mail a été scanné et est garanti sans aucun virus. 1Spatial France SAS est une société de droit français, membre du Groupe 1Spatial. Siège Social : Immeuble AXEO2, 23-25 Avenue Aristide Briand, 94110 Arcueil, France. RCS CRETEIL 334 416 336

#include <QTimer>
#include <QApplication>
#include <QGridLayout>

#include <osgViewer/CompositeViewer>
#include <osgViewer/ViewerEventHandlers>

#include <osgGA/MultiTouchTrackballManipulator>

#include <osgDB/ReadFile>

#include <osgQt/GraphicsWindowQt>

#include <iostream>

class ViewerWidget : public QWidget, public osgViewer::CompositeViewer
{
public:
    ViewerWidget(osgViewer::ViewerBase::ThreadingModel
threadingModel=osgViewer::CompositeViewer::SingleThreaded) : QWidget()
    {
        setThreadingModel(threadingModel);

        // disable the default setting of viewer.done() by pressing Escape.
        setKeyEventSetsDone(0);

        QWidget* widget1 = addViewWidget( createGraphicsWindow(0,0,100,100),
osgDB::readNodeFile("cow.osgt") );
        QWidget* widget2 = addViewWidget( createGraphicsWindow(0,0,100,100),
osgDB::readNodeFile("glider.osgt") );
        QWidget* widget3 = addViewWidget( createGraphicsWindow(0,0,100,100),
osgDB::readNodeFile("axes.osgt") );
        QWidget* widget4 = addViewWidget( createGraphicsWindow(0,0,100,100),
osgDB::readNodeFile("fountain.osgt") );
        QWidget* popupWidget = addViewWidget( createGraphicsWindow(900,100,320,240,"Popup
window",true), osgDB::readNodeFile("dumptruck.osgt") );
        popupWidget->show();

        QGridLayout* grid = new QGridLayout;
        grid->addWidget( widget1, 0, 0 );
        grid->addWidget( widget2, 0, 1 );
        grid->addWidget( widget3, 1, 0 );
        grid->addWidget( widget4, 1, 1 );
        setLayout( grid );

        connect( &_timer, SIGNAL(timeout()), this, SLOT(update()) );
		_timer.setSingleShot(true);
        _timer.start( 10 );
    }

    QWidget* addViewWidget( osgQt::GraphicsWindowQt* gw, osg::Node* scene )
    {
        osgViewer::View* view = new osgViewer::View;
        addView( view );

        osg::Camera* camera = view->getCamera();
        camera->setGraphicsContext( gw );

        const osg::GraphicsContext::Traits* traits = gw->getTraits();

        camera->setClearColor( osg::Vec4(0.2, 0.2, 0.6, 1.0) );
        camera->setViewport( new osg::Viewport(0, 0, traits->width, traits->height) );
        camera->setProjectionMatrixAsPerspective(30.0f,
static_cast<double>(traits->width)/static_cast<double>(traits->height), 1.0f, 10000.0f );

        view->setSceneData( scene );
        view->addEventHandler( new osgViewer::StatsHandler );
        view->setCameraManipulator( new osgGA::MultiTouchTrackballManipulator );
        gw->setTouchEventsEnabled( true );
        return gw->getGLWidget();
    }

    osgQt::GraphicsWindowQt* createGraphicsWindow( int x, int y, int w, int h, const std::string& name="",
bool windowDecoration=false )
    {
        osg::DisplaySettings* ds = osg::DisplaySettings::instance().get();
        osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
        traits->windowName = name;
        traits->windowDecoration = windowDecoration;
        traits->x = x;
        traits->y = y;
        traits->width = w;
        traits->height = h;
        traits->doubleBuffer = true;
        traits->alpha = ds->getMinimumNumAlphaBits();
        traits->stencil = ds->getMinimumNumStencilBits();
        traits->sampleBuffers = ds->getMultiSamples();
        traits->samples = ds->getNumMultiSamples();

        return new osgQt::GraphicsWindowQt(traits.get());
    }

    virtual void paintEvent( QPaintEvent* event )
    { 
	    frame();
		_timer.start( 10 );
	}

protected:

    QTimer _timer;
};

int main( int argc, char** argv )
{
    osg::ArgumentParser arguments(&argc, argv);

#if QT_VERSION >= 0x050000
    // Qt5 is currently crashing and reporting "Cannot make QOpenGLContext current in a different thread"
when the viewer is run multi-threaded, this is regression from Qt4
    osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::SingleThreaded;
#else
    osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::CullDrawThreadPerContext;
#endif

    while (arguments.read("--SingleThreaded")) threadingModel = osgViewer::ViewerBase::SingleThreaded;
    while (arguments.read("--CullDrawThreadPerContext")) threadingModel = osgViewer::ViewerBase::CullDrawThreadPerContext;
    while (arguments.read("--DrawThreadPerContext")) threadingModel = osgViewer::ViewerBase::DrawThreadPerContext;
    while (arguments.read("--CullThreadPerCameraDrawThreadPerContext")) threadingModel = osgViewer::ViewerBase::CullThreadPerCameraDrawThreadPerContext;

    QApplication app(argc, argv);
    ViewerWidget* viewWidget = new ViewerWidget(threadingModel);
    viewWidget->setGeometry( 100, 100, 800, 600 );
    viewWidget->show();
    return app.exec();
}
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Voerman, L. | 8 Jul 13:11 2014
Picon

bug in deprecated-dotosg ProxyNode with NULL options

Hi Robert,
I found a new way to crach the osgviewer:
osgviewer "ProxyNode { FileNameList { cow.osgt } num_children 1 }".osgs

The proxy node reader wrongly assumes options to be non NULL.

fixed in attached zip:
src\osgWrappers\deprecated-dotosg\osg\ProxyNode.cpp

applies to both the 3.2 branch and svn trunk

Regards, Laurens.

_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
FlySky | 8 Jul 04:37 2014

Compile fix for Visual Studio

 
Hi Robert,
 
    osgviewer.cpp(3.3.2) compile error with vs2003-vs2008 :
   .\osgviewer.cpp(41) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
  
   Visual Studio 2003 - 2008 (Visual C++ 7.1 - 9) don't claim to be C99 compatible.
 
   code:
   #include <stdint.h>
 
   Just define them.
 
   #ifdef _MSC_VER
   typedef __int32 int32_t;
   typedef unsigned __int32 uint32_t;
   typedef __int64 int64_t;
   typedef unsigned __int64 uint64_t;
   #else
   #include <stdint.h>
   #endif
 
cheers,
 
FlySky
 


_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Mikhail Matrosov | 7 Jul 15:24 2014
Picon

Division by zero on resize

When viewer width or height is equal to zero, division by zero occurs in GraphicsContext::resizedImplementation(). It breaks camera projection matrix and the scene is not drawn. 

Many people have already experienced this issue when viewer is added as QWidget to QTabWidget or QMdiArea. See http://forum.openscenegraph.org/viewtopic.php?t=7239

In the attached GraphicsContext.cpp file call to GraphicsContext::resizedImplementation() is ignored in the case any dimension is equal to zero. This fixes the issue for me.

Base version of OSG is 3.2.1, published in stable releases.

-----
Best regards, Mikhail Matrosov
Attachment (GraphicsContext.cpp): text/x-c++src, 41 KiB
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Voerman, L. | 2 Jul 11:53 2014
Picon

MSVC warning: InteractiveImageHandler inherits run via dominance

Hi Robert,
just like ClusterCullingCallback (fixed in r14322) visual studio likes an explicit implementation of run() for InteractiveImageHandler.

The warning is (14 times):
include\osgViewer/ViewerEventHandlers(542): warning C4250: 'osgViewer::InteractiveImageHandler' : inherits 'osgGA::EventHandler::osgGA::EventHandler::run' via dominance (src\osgViewer\StatsHandler.cpp)
          include\osgGA/EventHandler(45) : see declaration of 'osgGA::EventHandler::run'


attached a zipped version of include\osgViewer\ViewerEventHandlers
patch applies to svn trunk (3.3.3) only.

Regards, Laurens.
Attachment (ViewerEventHandlers.zip): application/zip, 6958 bytes
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
We See | 30 Jun 13:49 2014
Picon

Re: Change CPU-affinity of DatabaseThreads

Hi Robert,
A long time ago (Nov 2013) I submitted a small change for DatabasePager, which allows users to change the
CPU-affinity of DatabaseThread. You never answerred to this submission and also did not merge it in.

Is there a problem with this change or did you simply overlook it?

Please could you have a look at this (for me important) extension and merge it in, or tell me what's wrong with it?

Thank you!

Cheers,
WeSee

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=60064#60064
Mikhail Izmestev | 30 Jun 12:37 2014
Picon

Add StateGraph objects cache

Hi,

There are lot of allocation and deallocation of StateGraph objects and 
StateGraph::_children map nodes each frame.

Added StateGraph objects cache.
Added ChildList map pool allocator.

Thanks,
Mikhail.
Attachment (StateGraph-cache.zip): application/x-zip-compressed, 7368 bytes
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Mikhail Izmestev | 30 Jun 11:24 2014
Picon

Avoid vector reallocs in StateGraph::moveStateGraph

Hi,

Attached fix to avoid vector reallocs on push_back in 
StateGraph::moveStateGraph.

Thanks,
Mikhail.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
 *
 * This library is open source and may be redistributed and/or modified under
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * OpenSceneGraph Public License for more details.
*/

#ifndef OSGUTIL_STATEGRAPH
#define OSGUTIL_STATEGRAPH 1

#include <osg/Matrix>
#include <osg/Drawable>
#include <osg/StateSet>
#include <osg/State>
#include <osg/Light>

#include <osgUtil/RenderLeaf>

#include <set>
#include <vector>
#include <algorithm>

namespace osgUtil {

struct LessDepthSortFunctor
{
    bool operator() (const osg::ref_ptr<RenderLeaf>& lhs,const osg::ref_ptr<RenderLeaf>& rhs)
    {
        return (lhs->_depth < rhs->_depth);
    }
};

/** StateGraph - contained in a renderBin, defines the scene to be drawn.
  */
class OSGUTIL_EXPORT StateGraph : public osg::Referenced
{
    public:

        typedef std::map< const osg::StateSet*, osg::ref_ptr<StateGraph> >   ChildList;
        typedef std::vector< osg::ref_ptr<RenderLeaf> >                 LeafList;

        StateGraph*                         _parent;

#ifdef OSGUTIL_RENDERBACKEND_USE_REF_PTR
        osg::ref_ptr<const osg::StateSet> _stateset;
#else
        const osg::StateSet* _stateset;
#endif

        int                                 _depth;
        ChildList                           _children;
        LeafList                            _leaves;

        mutable float                       _averageDistance;
        mutable float                       _minimumDistance;

        osg::ref_ptr<osg::Referenced>       _userData;

        bool                                _dynamic;

        StateGraph():
            osg::Referenced(false),
            _parent(NULL),
            _stateset(NULL),
            _depth(0),
            _averageDistance(0),
            _minimumDistance(0),
            _userData(NULL),
            _dynamic(false)
        {
        }

        StateGraph(StateGraph* parent,const osg::StateSet* stateset):
            osg::Referenced(false),
            _parent(parent),
            _stateset(stateset),
            _depth(0),
            _averageDistance(0),
            _minimumDistance(0),
            _userData(NULL),
            _dynamic(false)
        {
            if (_parent) _depth = _parent->_depth + 1;

            if (_parent && _parent->_dynamic) _dynamic = true;
            else _dynamic = stateset->getDataVariance()==osg::Object::DYNAMIC;
        }

        ~StateGraph() {}

        StateGraph* cloneType() const { return new StateGraph; }

        void setUserData(osg::Referenced* obj) { _userData = obj; }
        osg::Referenced* getUserData() { return _userData.get(); }
        const osg::Referenced* getUserData() const { return _userData.get(); }

        void setStateSet(const osg::StateSet* stateset) { _stateset = stateset; }

#ifdef OSGUTIL_RENDERBACKEND_USE_REF_PTR
        const osg::StateSet* getStateSet() const { return _stateset.get(); }
#else
        const osg::StateSet* getStateSet() const { return _stateset; }
#endif

        /** return true if all of drawables, lights and children are empty.*/
        inline bool empty() const
        {
            return _leaves.empty() && _children.empty();
        }

        inline bool leaves_empty() const
        {
            return _leaves.empty();
        }

        inline float getAverageDistance() const
        {
            if (_averageDistance==FLT_MAX && !_leaves.empty())
            {
                _averageDistance = 0.0f;
                for(LeafList::const_iterator itr=_leaves.begin();
                    itr!=_leaves.end();
                    ++itr)
                {
                   _averageDistance += (*itr)->_depth;
                }
                _averageDistance /= (float)_leaves.size();

            }
            return _averageDistance;
        }

        inline float getMinimumDistance() const
        {
            if (_minimumDistance==FLT_MAX && !_leaves.empty())
            {
                LeafList::const_iterator itr=_leaves.begin();
                _minimumDistance = (*itr)->_depth;
                ++itr;
                for(;
                    itr!=_leaves.end();
                    ++itr)
                {
                   if ((*itr)->_depth<_minimumDistance) _minimumDistance=(*itr)->_depth;
                }

            }
            return _minimumDistance;
        }

        inline void sortFrontToBack()
        {
            std::sort(_leaves.begin(),_leaves.end(),LessDepthSortFunctor());
        }

        /** Reset the internal contents of a StateGraph, including deleting all children.*/
        void reset();

        /** Recursively clean the StateGraph of all its drawables, lights and depths.
          * Leaves children intact, and ready to be populated again.*/
        void clean();

        /** Recursively prune the StateGraph of empty children.*/
        void prune();

        inline StateGraph* find_or_insert(const osg::StateSet* stateset)
        {
            // search for the appropriate state group, return it if found.
            ChildList::iterator itr = _children.find(stateset);
            if (itr!=_children.end()) return itr->second.get();

            // create a state group and insert it into the children list
            // then return the state group.
            StateGraph* sg = new StateGraph(this,stateset);
            _children[stateset] = sg;
            return sg;
        }

        /** add a render leaf.*/
        inline void addLeaf(RenderLeaf* leaf)
        {
            if (leaf)
            {
                _averageDistance = FLT_MAX; // signify dirty.
                _minimumDistance = FLT_MAX; // signify dirty.
                _leaves.push_back(leaf);
                leaf->_parent = this;
                if (_dynamic) leaf->_dynamic = true;
            }
        }

        static inline void moveStateGraph(osg::State& state,StateGraph* sg_curr,StateGraph* sg_new)
        {
            if (sg_new==sg_curr || sg_new==NULL) return;

            if (sg_curr==NULL)
            {

                // use return path to trace back steps to sg_new.
                std::vector<StateGraph*> return_path;
                return_path.reserve(sg_new->_depth+1);

                // need to pop back root render graph.
                do
                {
                    return_path.push_back(sg_new);
                    sg_new = sg_new->_parent;
                } while (sg_new);

                for(std::vector<StateGraph*>::reverse_iterator itr=return_path.rbegin();
                    itr!=return_path.rend();
                    ++itr)
                {
                    StateGraph* rg = (*itr);
                    if (rg->getStateSet()) state.pushStateSet(rg->getStateSet());
                }
                return;
            }

            // first handle the typical case which is two state groups
            // are neighbours.
            if (sg_curr->_parent==sg_new->_parent)
            {

                // state has changed so need to pop old state.
                if (sg_curr->getStateSet()) state.popStateSet();
                // and push new state.
                if (sg_new->getStateSet()) state.pushStateSet(sg_new->getStateSet());
                return;
            }

            // need to pop back up to the same depth as the new state group.
            while (sg_curr->_depth>sg_new->_depth)
            {
                if (sg_curr->getStateSet()) state.popStateSet();
                sg_curr = sg_curr->_parent;
            }

            // use return path to trace back steps to sg_new.
            std::vector<StateGraph*> return_path;
            return_path.reserve(sg_new->_depth+1);

            // need to pop back up to the same depth as the curr state group.
            while (sg_new->_depth>sg_curr->_depth)
            {
                return_path.push_back(sg_new);
                sg_new = sg_new->_parent;
            }

            // now pop back up both parent paths until they agree.

            // DRT - 10/22/02
            // should be this to conform with above case where two StateGraph
            // nodes have the same parent
            while (sg_curr != sg_new)
            {
                if (sg_curr->getStateSet()) state.popStateSet();
                sg_curr = sg_curr->_parent;

                return_path.push_back(sg_new);
                sg_new = sg_new->_parent;
            }

            for(std::vector<StateGraph*>::reverse_iterator itr=return_path.rbegin();
                itr!=return_path.rend();
                ++itr)
            {
                StateGraph* rg = (*itr);
                if (rg->getStateSet()) state.pushStateSet(rg->getStateSet());
            }

        }

        inline static void moveToRootStateGraph(osg::State& state,StateGraph* sg_curr)
        {
            // need to pop back all statesets and matrices.
            while (sg_curr)
            {
                if (sg_curr->getStateSet()) state.popStateSet();
                sg_curr = sg_curr->_parent;
            }

        }

        inline static int numToPop(StateGraph* sg_curr)
        {
            int numToPop = 0;
            // need to pop back all statesets and matrices.
            while (sg_curr)
            {
                if (sg_curr->getStateSet()) ++numToPop;
                sg_curr = sg_curr->_parent;
            }

            return numToPop;
        }

    private:

        /// disallow copy construction.
        StateGraph(const StateGraph&):osg::Referenced() {}
        /// disallow copy operator.
        StateGraph& operator = (const StateGraph&) { return *this; }

};

}

#endif

_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Gmane