Hi George,

I have just reviewed your changes and used these as inspiration for the
changes I have just applied.  The difference is that I initialized all the
variables and use setTextureDepth rather than setTextureSize.

$ svn diff
Index: src/osg/Texture2DArray.cpp
===================================================================
--- src/osg/Texture2DArray.cpp  (revision 14409)
+++ src/osg/Texture2DArray.cpp  (working copy)
@@ -32,15 +32,16 @@
             Texture(text,copyop),
             _textureWidth(text._textureWidth),
             _textureHeight(text._textureHeight),
-            _textureDepth(text._textureDepth),
+            _textureDepth(0),
             _numMipmapLevels(text._numMipmapLevels),
             _subloadCallback(text._subloadCallback)
 {
+    setTextureDepth(text._textureDepth);
+
     // copy all images by iterating through all of them
     for (int i=0; i < text._textureDepth; i++)
     {
         setImage(i, copyop(text._images[i].get()));
-        _modifiedCount.push_back(ImageModifiedCount());
     }
 }

These changes are now checked into svn/trunk and OSG-3.2.  Could you please
test them on your usage case to make they work fine for you.

Cheers,
Robert.


On 22 August 2014 23:41, Tim George <[email protected]> wrote:

> Hi,
>
> The Texture2DArray copy constructor Texture2DArray(const Texture2DArray&
> text,const CopyOp& copyop) seg faults because the _images vector is not
> initialized prior to calling setImage. I suggest that it be changed to call
> setTextureSize with the new dimensions instead of setting the member
> variables directly. That will correctly initialize the _images vector.
>
> Attached is the latest OSG trunk Texture2DArray with the proposed change.
>
> besides adding the call to setTextureSize the line:
>
> _modifiedCount.push_back(ImageModifiedCount());
>
> was also removed because this is also taken care of by the setTextureSize
> call. _textureDepth was initialized to 0 so that setTextureSize works
> correctly.
>
> Thanks,
>
> Tim
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=60742#60742
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/texture2darray_171.cpp
>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to