Hello everyone,

I'm working on a project where I need to load and display OpenFlight files. 
I've found that some of my test files make my program crash. The file is loaded 
correctly but it crashes when rendering.  I also noticed that osgviewer doesn't 
 make it with this files.

After debuging a little, I've found out that the method 
IndexedLightPoint::readRecord (RecordInputStream& in, Document& document) was 
setting the osgSim::LightPointNode's maxPixelSize to zero.   This is causing a 
index out of range exception afterwards in the draw traversal...

I've solved this problem by simply adding a check for zero before setting the  
maxPixelSize read from the file.

> 
> --- /tmp/LightPointRecords-0.2.cpp
> +++ 
> /home/ulises/Development/OpenSceneGrpah/trunk/src/osgPlugins/OpenFlight/LightPointRecords.cpp
> @@ -392,7 +392,8 @@
>          if (_appearance.valid())
>          {
>              _lpn->setMinPixelSize(_appearance->minPixelSize);
> -            _lpn->setMaxPixelSize(_appearance->maxPixelSize);
> +            if (_appearance->maxPixelSize > 0)
> +                _lpn->setMaxPixelSize(_appearance->maxPixelSize);
>  
>              if (_appearance->texturePatternIndex != -1)
>              {
> 
> 


With this simple patch the flt files that made osgviewer to crash are now 
loaded and displayed correctly.
I hope this helps. 
Thank you!

Cheers,
Ulises[/code]

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





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

Reply via email to