hi Guy,

are you perhaps using multiple threads on a multi core machine? then it
might be a cache coherence problem. You'd need to declare your shared
data as volatile:

volatile osg::Vec3 v[12];

regards Ralph

Guy Wallis schrieb:
> Hello,
> 
> I just tried to do something in osg that produces different behavior
> depending on which platform I compile it on. I realize it’s an ugly
> thing to do, but I set up a global variable v that is of type osg::Vec3
> and then made it an array of size 12:
> 
>  
> 
> osg::Vec3 v[12];
> 
>  
> 
> If I compile the code in debug mode using MSVC v9, (or using
> optimization with the gnu compiler under IRIX) the code works fine. If I
> compile it using the ‘Release’ setting in MSVC I find setting the global
> in one part of my code isn’t detected in other sections – which see the
> array’s initial values (all zeros).
> 
>  
> 
> If I use an osg::Vec3Array everything works fine, irrespective of platform.
> 
>  
> 
> Is it simply not a good idea to use an array of osg::Vec3 (and I’m lucky
> it happens to work at all), or is something up with the MSVC optimizer?
> 
>  
> 
> Thanks,
> 
>  
> 
> Guy
> 

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

Reply via email to