Jannik Heller | 5 Feb 14:20 2016
Picon
Gravatar

GL object deletion fix

Hi Robert,

This submission changes deleteGLObject calls to scheduleGLObjectForDeletion, to ensure that the
actual deletion happens from the correct thread (the graphics thread). This fixes the leak I reported in
http://forum.openscenegraph.org/viewtopic.php?t=15567 , and possibly also http://forum.openscenegraph.org/viewtopic.php?t=15564.

Thank you!

Cheers,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66223#66223

_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Jannik Heller | 4 Feb 18:35 2016
Picon
Gravatar

Add missing implementations for asDrawableCullCallback and asDrawableEventCallback

Hi Robert,

I just updated to the latest commit and noticed that drawable cull callbacks were no longer working. As it
turns out there was a missing implementation of the asDrawableCullCallback() and
asDrawableEventCallback(), after implementing these methods everything is working as expected.

See changes on github: https://github.com/openscenegraph/osg/pull/57 or the attached file.

Thanks,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66204#66204

Attachment (Callback): application/octet-stream, 15 KiB
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Voerman, L. | 1 Feb 17:00 2016
Picon

Visual Studio 2013 - callback first seen using 'class' now seen using 'struct'

Hi Robert,

While compiling with Visual Studio 12 (aka 2013 update 3) I get a lot of warnings (~2490 times) about 
osg::DrawableUpdateCallback
osg::DrawableEventCallback
osg::DrawableCullCallback



E:\osg\osgSvnGit\OpenSceneGraph\include\osg/Callback(286): warning C4099: 'osg::DrawableUpdateCallback' : type name first seen using 'class' now seen using 'struct' (E:\osg\osgSvnGit\OpenSceneGraph\src\osgUtil\RenderBin.cpp)
          E:\osg\osgSvnGit\OpenSceneGraph\include\osg/Callback(27) : see declaration of 'osg::DrawableUpdateCallback'

attached is a modified version of include/osg/Callback:
changing 
- struct OSG_EXPORT DrawableUpdateCallback : public virtual Callback
- {
to 
+ class OSG_EXPORT DrawableUpdateCallback : public virtual Callback
+ {
+ public:

and the same changes for DrawableEventCallback and DrawableCullCallback

applies to the git repository only (updated 1 Feb 2016 ae6bade641ee4d8436ef69e7a7a347be81195a47 )

Regards, Laurens Voerman.
Attachment (Callback.zip): application/zip, 3736 bytes
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Voerman, L. | 1 Feb 16:37 2016
Picon

Visual Studio 2013 - PrimitiveSet.cpp(364): error C2039: 'min' : is not a member of 'std'

Hi Robert,
after makeing the switch to git:

While compiling with Visual Studio 12 (aka 2013 update 3) I get a these errors:
E:\osg\osgSvnGit\OpenSceneGraph\src\osg\PrimitiveSet.cpp(364): error C2039: 'min' : is not a member of 'std'
E:\osg\osgSvnGit\OpenSceneGraph\src\osg\PrimitiveSet.cpp(364): error C3861: 'min': identifier not found
E:\osg\osgSvnGit\OpenSceneGraph\src\osg\PrimitiveSet.cpp(372): error C2039: 'min' : is not a member of 'std'
E:\osg\osgSvnGit\OpenSceneGraph\src\osg\PrimitiveSet.cpp(372): error C3861: 'min': identifier not found
E:\osg\osgSvnGit\OpenSceneGraph\src\osg\PrimitiveSet.cpp(381): error C2039: 'min' : is not a member of 'std'
E:\osg\osgSvnGit\OpenSceneGraph\src\osg\PrimitiveSet.cpp(381): error C3861: 'min': identifier not found
E:\osg\osgSvnGit\OpenSceneGraph\src\osg\PrimitiveSet.cpp(436): error C2039: 'min' : is not a member of 'std'
E:\osg\osgSvnGit\OpenSceneGraph\src\osg\PrimitiveSet.cpp(436): error C3861: 'min': identifier not found

I suggest to replace std::min by osg::minimum, attached is a (zipped) modified version of src/osg/PrimitiveSet.cpp
applies to the git reposetory only (updated 1 Feb 2016 ae6bade641ee4d8436ef69e7a7a347be81195a47 )

compiled (not tested - some more copilation problems) on windows 7 / Visual Studio 2013
compiled gcc version 4.7.2 (Debian 4.7.2-5)

Regards, Laurens Voerman.
Attachment (PrimitiveSet.zip): application/zip, 2877 bytes
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Sebastian Messerschmidt | 29 Jan 12:40 2016
Picon
Picon

exporter fix for Wavefront obj

Hi Robert
The exporter wasn't taking all StateSets (specifically group-statesets) 
into account when exporting materials.

Changes made against trunk.

Cheers
Sebastian

// -*-c++-*-

/*
 * Wavefront OBJ loader for Open Scene Graph
 *
 * Copyright (C) 2001 Ulrich Hertlein <u.hertlein <at> web.de>
 *
 * Modified by Robert Osfield to support per Drawable coord, normal and
 * texture coord arrays, bug fixes, and support for texture mapping.
 *
 * Writing support added 2007 by Stephan Huber, http://digitalmind.de,

 * some ideas taken from the dae-plugin
 *
 * The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for
 * real-time rendering of large 3D photo-realistic models.
 * The OSG homepage is http://www.openscenegraph.org/

 */

 #ifndef OBJ_WRITER_NODE_VISITOR_HEADER__
 #define OBJ_WRITER_NODE_VISITOR_HEADER__


#include <string>
#include <stack>
#include <sstream>

#include <osg/Notify>
#include <osg/Node>
#include <osg/MatrixTransform>
#include <osg/Geode>

#include <osg/Geometry>
#include <osg/StateSet>
#include <osg/Material>
#include <osg/Texture2D>
#include <osg/TexGen>
#include <osg/TexMat>

#include <osgDB/Registry>
#include <osgDB/ReadFile>
#include <osgDB/FileUtils>
#include <osgDB/FileNameUtils>




#include <map>
#include <set>

class OBJWriterNodeVisitor: public osg::NodeVisitor {

    public:
        OBJWriterNodeVisitor(std::ostream& fout, const std::string materialFileName = "") :
            osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
            _fout(fout),
            _currentStateSet(new osg::StateSet()),
            _lastVertexIndex(1),
            _lastNormalIndex(1),
            _lastTexIndex(1)
        {
            _fout << "# file written by OpenSceneGraph" << std::endl << std::endl;

            if (!materialFileName.empty()) {
                _fout << "mtllib " << materialFileName << std::endl << std::endl;
            }
        }

        virtual void apply(osg::Geode &node);

        virtual void apply(osg::Group &node)
        {
			 pushStateSet(node.getStateSet());
            _nameStack.push_back( node.getName().empty() ? node.className() : node.getName() );
            _fout << std::endl;
            _fout << "g " << getUniqueName() << std::endl;

            osg::NodeVisitor::traverse( node );
            _nameStack.pop_back();
			 popStateSet(node.getStateSet());
        }

        void traverse (osg::Node &node)
        {
            pushStateSet(node.getStateSet());

            osg::NodeVisitor::traverse( node );

            popStateSet(node.getStateSet());
        }

        void pushStateSet(osg::StateSet* ss)
        {
          if (NULL!=ss) {
            // Save our current stateset
            _stateSetStack.push(_currentStateSet.get());

            // merge with node stateset
            _currentStateSet = static_cast<osg::StateSet*>(_currentStateSet->clone(osg::CopyOp::SHALLOW_COPY));
            _currentStateSet->merge(*ss);
          }
        }


        void popStateSet(osg::StateSet* ss)
        {
            if (NULL!=ss) {
              // restore the previous stateset
              _currentStateSet = _stateSetStack.top();
              _stateSetStack.pop();
            }
        }


        void writeMaterials(std::ostream& fout);



        class OBJMaterial {
            public:
                OBJMaterial() {}
                OBJMaterial(osg::Material* mat, osg::Texture* tex);

                osg::Vec4  diffuse, ambient, specular;
                std::string    image;
                std::string name;
        };

    protected:
        struct CompareStateSet
        {
            bool operator()(const osg::ref_ptr<osg::StateSet>& ss1, const osg::ref_ptr<osg::StateSet>& ss2) const
            {
                //std::cout << "CompareStateSet: " << ss1->compare(*ss2, false) << " " << ss1 << " " << ss2 << std::endl;
                return ss1->compare(*ss2, true) < 0;
            }
        };


    private:

        OBJWriterNodeVisitor& operator = (const OBJWriterNodeVisitor&) { return *this; }

        void processGeometry(osg::Geometry* geo, osg::Matrix& m);
        void processArray(const std::string& key, osg::Array* array, const osg::Matrix& m =
osg::Matrix::identity(), bool isNormal = false);

        void processStateSet(osg::StateSet* stateset);

        std::string getUniqueName(const std::string& defaultValue = "");

        typedef std::stack<osg::ref_ptr<osg::StateSet> > StateSetStack;
        typedef std::map< osg::ref_ptr<osg::StateSet>, OBJMaterial, CompareStateSet> MaterialMap;


        std::ostream&                            _fout;
        std::list<std::string>                    _nameStack;
        StateSetStack                            _stateSetStack;
        osg::ref_ptr<osg::StateSet>                _currentStateSet;
        std::map<std::string, unsigned int>        _nameMap;
        unsigned int                            _lastVertexIndex, _lastNormalIndex, _lastTexIndex;
        MaterialMap                                _materialMap;

};

#endif
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Tony Vasile | 29 Jan 00:27 2016
Picon

Re: Fixed for problem with switches in OpenFlight files

Hi 
 I was wondering if this change is acceptable as I haven't seen the change incorporated into any of the releases.

------------------------
Tony V

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66161#66161
Colin McDonald | 25 Jan 12:57 2016
Picon

ReadResult/WriteResult statusMessage method commit

Hi Robert,

As best as I can tell from GitHub, this commit on 19th January was done to the OpenSceneGraph-3.4 branch, but not to the master branch.  I'm guessing that should have been the other way round.

Regards

Colin McDonald
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Gianni Ambrosio | 21 Jan 10:05 2016
Picon

Re: Fixed numeric instability in triangle-line intersection test in LineSegmentIntersector

Hi,
I have the same bunch of warnings and the application hangs.
The code falls into:

osg80-osgUtild.dll!LineSegmentIntersectorUtils::TriangleIntersector::operator()(const
osg::Vec3f & v1, const osg::Vec3f & v2, const osg::Vec3f & v3, bool treatVertexDataAsTemporary)  Line 173	C++

Going backward on the call stack I can reach:

osg80-osgViewerd.dll!osgViewer::CompositeViewer::eventTraversal()  Line 1023 + 0x67 bytes	C++

where event._my and event._my are both = -1.#IND

I have a Qt application and the problem happens when the 3D viewer starts widget height = 0. Then if I resize it
and I move the mouse over the 3D viewer I get the warnings. Moreover if I something to the scene I can not see
it, and the application hangs.

As a workaround I overridden the minimumSize() virtual method of the 3D viewer widget to return a valid
QSize (1,1). Anyway I would like to understand where is the main problem.
Currently I didn't find where the event with "-1.#IND" for _mx and _my is added to the event queue.

Regards,
Gianni

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66074#66074
Joe | 21 Jan 00:57 2016
Picon
Picon

Re: OSG 3.4.0 wont build with Visual Studio 2008


On 1/20/2016 2:04 PM,
osg-submissions-request@... 
wrote:

Hi Robert, all,
Use Joe Thompson.

Cheers,
Joe
> ----------------------------------------------------------------------
>
>
> Hi, Guys,
>
> I remember I have sent a patch for those other "places" which defined their
> own stdint types. Afar it was STL and JSON plugin. It was then solved by
> removing own definitions and only including osg/Types directly. And now OSG
> 3.5.1 builds fine with VS 2008. Are you sure these are the osg/Types which
> need fixes or maybe porting 3.5.1 fix backwards will do ?
>
> Cheers,
> Wojtek Lewandowski
>
> 2016-01-19 18:03 GMT+01:00 Robert Osfield <robert.osfield@...>:
>
>> Hi Joe,
>>
>> When I check submissions in I use the full name to give credit as well
>> as make it easier to track back submissions if we need further
>> clarification at a later date.  What name should I use for you?
>>
>> Cheers,
>> Robert.
>>
>> On 19 November 2015 at 05:22, Joe <mini_joe@...> wrote:
>>> Hello,
>>> OpenSceneGraph cannot be built with Visual Studio 2008.
>>> The file osg-OpenSceneGraph-3.4.0\include\osg\Types
>>> typedefs int8_t, int16_t, int32_t and int64_t
>>> These are typedefed as signed __intX in several other places.
>>> With VS2008, this causes an error "int8_t redifined, different basic
>> types"
>>> Explicitly declaring them signed fixes the error.
>>>
>>> Cheers,
>>> Joe
>>>
>>>
>>> _______________________________________________
>>>
Anish Thomas | 14 Jan 09:59 2016
Picon

Underflow bug in BufferObject pool usage

Hi,

I noticed a bug in BufferObject handling. The size stored into the profile object when the GLBufferObject
is added to a profile-set is used to update the BufferObject pool size. The buffer-alignment is not
considered here.

When a BufferObject is compiled, the profile size can get an update as the buffer-alignment is also
considered in the size calculation. But this update in the object's size is not reflected in the
pool-size. When the object gets deleted, it can cause the pool-size variable to underflow. The fix is a
small change in the function void GLBufferObject::compileBuffer() which are marked in red below:

if (newTotalSize > _profile._size)
    {
        OSG_INFO<<"newTotalSize="<<newTotalSize<<", _profile._size="<<_profile._size<<std::endl;

        unsigned int sizeDifference = newTotalSize - _profile._size;
        _profile._size = newTotalSize;

        if (_set)
        {
            _set->moveToSet(this, _set->getParent()->getGLBufferObjectSet(_profile));
            _set->getParent()->getCurrGLBufferObjectPoolSize() += sizeDifference;
        }

    }

Thank you!

Cheers,
Anish

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66007#66007
Jannik Heller | 14 Jan 02:28 2016
Picon
Gravatar

Re: Regression: setAttributeAndModes ignores mode setting

Hi Robert,

Any update regarding the merging of this submission as it's an easy one line fix that should take no time at
all to review. It took me some time to find this nasty bug and I want to avoid other OSG users having to go
through the same.

Thanks,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=66004#66004

Gmane