Re: [osg-users] MSVC v9

2009-02-04 Thread Jean-Sébastien Guay

Hi Tanguy,

I wonder, why have I not seen this problem with my OSG builds? Is it 
that the default optimization options are lower than what generates this 
bug? (sorry I've been speed-reading this thread and may have missed 
mention of this)


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-02-04 Thread Tanguy Fautre
Hi Robert,

I agree such changes would be too risky to be done for the current
release. But I don't think a compiler flag change would help much at
this point (especially that the bug was reported on this mailing list as
part of the user code, not OSG code).

Neil has expressed that he is willing to implement those changes
himself, which would be introduced post-2.8.0 obviously.


Tanguy


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: Wednesday 04 February 2009 14:48
To: OpenSceneGraph Users
Subject: Re: [osg-users] MSVC v9

HI Tanguy,

OK, since the changes are intrusive and widespread there certainly are
candidates for inclusion into 2.8.0, it's just too much of risk.

Changing the compile options should be less intrusive so I'd suggest
looking into adding this option to the VS compile options in
OpenSceneGraph/CMakeLists.txt.  One could make these extra build
options, optionally so that you can toggle them on/off from with
ccmake/CMakeSetup.

Robert.

On Wed, Feb 4, 2009 at 2:37 PM, Tanguy Fautre
 wrote:
> Hi Robert,
>
> It's not a small set of changes. It's actually quite tedious (but not
complex to do). Unfortunately, we cannot be sure it avoids the invalid
code generation bug in all cases.
>
>
> Basically, changing the operator (in this case, it's operator -) from:
>
>
>/** Binary vector subtract. */
>inline const Vec3f operator - (const Vec3f& rhs) const
>{
>return Vec3f(_v[0]-rhs._v[0], _v[1]-rhs._v[1],
_v[2]-rhs._v[2]);
>}
>
>/** Unary vector subtract. */
>inline Vec3f& operator -= (const Vec3f& rhs)
>{
>_v[0]-=rhs._v[0];
>_v[1]-=rhs._v[1];
>_v[2]-=rhs._v[2];
>return *this;
>}
>
>
> To:
>
>inline Vec3f & operator -= (const Vec3f& rhs)
>{
>_v[0] -= rhs._v[0];
>_v[1] -= rhs._v[1];
>_v[2] -= rhs._v[2];
>return *this;
>}
>
>inline friend Vec3f operator - (const Vec3f& lhs, const Vec3f& rhs)
>{
>return Vec3f(lhs) -= rhs;
>}
>
>
> Seems to work around the problem with VS2005 and VS2008 without
requiring changes in the user code. Also, someone's pointed out the
latter is more correct in some cases (e.g. argument dependent lookup,
see below).
>
> But changing all the operators of classes like Vec3f, Vec3d (and I
suppose others such as Matrix classes) would be quite tedious. I guess
it really depends on how many people are really by this problem.
>
> One a broader note, I've noticed Boost has a very nice library for
dealing with this
(http://www.boost.org/doc/libs/1_37_0/libs/utility/operators.htm). Too
bad OSG probably cannot use it because of the dependencies it would
introduce. But it's still worth a read, as they explain several issues
that may not be obvious at first sight.
>
>
> Cheers,
>
> Tanguy
>
>
> -Original Message-
> From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
Osfield
> Sent: Wednesday 04 February 2009 12:40
> To: OpenSceneGraph Users
> Subject: Spam: Re: [osg-users] MSVC v9
>
> Hi Tanguy,
>
> On Wed, Feb 4, 2009 at 12:22 PM, Tanguy Fautre
>  wrote:
>> Robert, do you thing the problem may be serious enough to possibly
motivate
>> a code change for all operators of Vec3f and co as a workaround?
>
> We could change code, it would all depend on how intrusive the changes
> are, without code changes in front of me I can't make this judgement
> call.  Could you send me a modified Vec* files so I could do a review?
>
> The other approach is to change the compile flags of the OSG to avoid
> this bug.  This wouldn't help 3rd party apps though.
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-02-04 Thread Robert Osfield
HI Tanguy,

OK, since the changes are intrusive and widespread there certainly are
candidates for inclusion into 2.8.0, it's just too much of risk.

Changing the compile options should be less intrusive so I'd suggest
looking into adding this option to the VS compile options in
OpenSceneGraph/CMakeLists.txt.  One could make these extra build
options, optionally so that you can toggle them on/off from with
ccmake/CMakeSetup.

Robert.

On Wed, Feb 4, 2009 at 2:37 PM, Tanguy Fautre
 wrote:
> Hi Robert,
>
> It's not a small set of changes. It's actually quite tedious (but not complex 
> to do). Unfortunately, we cannot be sure it avoids the invalid code 
> generation bug in all cases.
>
>
> Basically, changing the operator (in this case, it's operator -) from:
>
>
>/** Binary vector subtract. */
>inline const Vec3f operator - (const Vec3f& rhs) const
>{
>return Vec3f(_v[0]-rhs._v[0], _v[1]-rhs._v[1], _v[2]-rhs._v[2]);
>}
>
>/** Unary vector subtract. */
>inline Vec3f& operator -= (const Vec3f& rhs)
>{
>_v[0]-=rhs._v[0];
>_v[1]-=rhs._v[1];
>_v[2]-=rhs._v[2];
>return *this;
>}
>
>
> To:
>
>inline Vec3f & operator -= (const Vec3f& rhs)
>{
>_v[0] -= rhs._v[0];
>_v[1] -= rhs._v[1];
>_v[2] -= rhs._v[2];
>return *this;
>}
>
>inline friend Vec3f operator - (const Vec3f& lhs, const Vec3f& rhs)
>{
>return Vec3f(lhs) -= rhs;
>}
>
>
> Seems to work around the problem with VS2005 and VS2008 without requiring 
> changes in the user code. Also, someone's pointed out the latter is more 
> correct in some cases (e.g. argument dependent lookup, see below).
>
> But changing all the operators of classes like Vec3f, Vec3d (and I suppose 
> others such as Matrix classes) would be quite tedious. I guess it really 
> depends on how many people are really by this problem.
>
> One a broader note, I've noticed Boost has a very nice library for dealing 
> with this (http://www.boost.org/doc/libs/1_37_0/libs/utility/operators.htm). 
> Too bad OSG probably cannot use it because of the dependencies it would 
> introduce. But it's still worth a read, as they explain several issues that 
> may not be obvious at first sight.
>
>
> Cheers,
>
> Tanguy
>
>
> -Original Message-
> From: osg-users-boun...@lists.openscenegraph.org 
> [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert 
> Osfield
> Sent: Wednesday 04 February 2009 12:40
> To: OpenSceneGraph Users
> Subject: Spam: Re: [osg-users] MSVC v9
>
> Hi Tanguy,
>
> On Wed, Feb 4, 2009 at 12:22 PM, Tanguy Fautre
>  wrote:
>> Robert, do you thing the problem may be serious enough to possibly motivate
>> a code change for all operators of Vec3f and co as a workaround?
>
> We could change code, it would all depend on how intrusive the changes
> are, without code changes in front of me I can't make this judgement
> call.  Could you send me a modified Vec* files so I could do a review?
>
> The other approach is to change the compile flags of the OSG to avoid
> this bug.  This wouldn't help 3rd party apps though.
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-02-04 Thread Tanguy Fautre
Hi Robert,

It's not a small set of changes. It's actually quite tedious (but not complex 
to do). Unfortunately, we cannot be sure it avoids the invalid code generation 
bug in all cases.


Basically, changing the operator (in this case, it's operator -) from:


/** Binary vector subtract. */
inline const Vec3f operator - (const Vec3f& rhs) const
{
return Vec3f(_v[0]-rhs._v[0], _v[1]-rhs._v[1], _v[2]-rhs._v[2]);
}

/** Unary vector subtract. */
inline Vec3f& operator -= (const Vec3f& rhs)
{
_v[0]-=rhs._v[0];
_v[1]-=rhs._v[1];
_v[2]-=rhs._v[2];
return *this;
}


To:

inline Vec3f & operator -= (const Vec3f& rhs)
{
_v[0] -= rhs._v[0];
_v[1] -= rhs._v[1];
_v[2] -= rhs._v[2];
return *this;
}

inline friend Vec3f operator - (const Vec3f& lhs, const Vec3f& rhs)
{
return Vec3f(lhs) -= rhs;
}


Seems to work around the problem with VS2005 and VS2008 without requiring 
changes in the user code. Also, someone's pointed out the latter is more 
correct in some cases (e.g. argument dependent lookup, see below).

But changing all the operators of classes like Vec3f, Vec3d (and I suppose 
others such as Matrix classes) would be quite tedious. I guess it really 
depends on how many people are really by this problem.

One a broader note, I've noticed Boost has a very nice library for dealing with 
this (http://www.boost.org/doc/libs/1_37_0/libs/utility/operators.htm). Too bad 
OSG probably cannot use it because of the dependencies it would introduce. But 
it's still worth a read, as they explain several issues that may not be obvious 
at first sight.


Cheers,

Tanguy


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield
Sent: Wednesday 04 February 2009 12:40
To: OpenSceneGraph Users
Subject: Spam: Re: [osg-users] MSVC v9

Hi Tanguy,

On Wed, Feb 4, 2009 at 12:22 PM, Tanguy Fautre
 wrote:
> Robert, do you thing the problem may be serious enough to possibly motivate
> a code change for all operators of Vec3f and co as a workaround?

We could change code, it would all depend on how intrusive the changes
are, without code changes in front of me I can't make this judgement
call.  Could you send me a modified Vec* files so I could do a review?

The other approach is to change the compile flags of the OSG to avoid
this bug.  This wouldn't help 3rd party apps though.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-02-04 Thread Robert Osfield
Hi Tanguy,

On Wed, Feb 4, 2009 at 12:22 PM, Tanguy Fautre
 wrote:
> Robert, do you thing the problem may be serious enough to possibly motivate
> a code change for all operators of Vec3f and co as a workaround?

We could change code, it would all depend on how intrusive the changes
are, without code changes in front of me I can't make this judgement
call.  Could you send me a modified Vec* files so I could do a review?

The other approach is to change the compile flags of the OSG to avoid
this bug.  This wouldn't help 3rd party apps though.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-02-04 Thread Tanguy Fautre
I’ve submitted the bug to Microsoft.

Hopefully they will be able to further enlighten us on the issue.

 

Robert, do you thing the problem may be serious enough to possibly motivate a 
code change for all operators of Vec3f and co as a workaround?

 

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=411031

 

 

Tanguy

 

 

From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Guy Wallis
Sent: Monday 02 February 2009 00:04
To: OpenSceneGraph Users
Subject: Spam: Re: [osg-users] MSVC v9

 

Hi Tanguy,

I tried your code on an SGI (IRIX 6.5.22) using the GNU C++ compiler (version 
2.4.3) and level 3 optimisation.

 

No errors using either form of the subtraction operator.

 

Cheers,

 

Guy

 

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-02-01 Thread Guy Wallis
Hi Tanguy,

I tried your code on an SGI (IRIX 6.5.22) using the GNU C++ compiler
(version 2.4.3) and level 3 optimisation.

 

No errors using either form of the subtraction operator.

 

Cheers,

 

Guy

 

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-01-30 Thread Tanguy Fautre
I've already posted it: 
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2009-January/022302.html

I've changed the subject line to be more explicit given the recent findings. 
Maybe this was a mistake. ;-)

Cheers,

T


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Guy Wallis
Sent: Friday 30 January 2009 00:56
To: OpenSceneGraph Users
Subject: Spam: Re: [osg-users] MSVC v9

Hi Tanguy,
Intriguing. I'd be keen to see your version of the program too.

Thanks for taking the time to investigate and for passing the bug on to
MS. It's a bit of a worry for them that the bug has gone unnoticed since
the release of v8, that was late 2005 wasn't it?!

Guy

Hi Tanguy,

> I've reduced the size of the example program,  removed the OSG 
> dependency, and getting ready to submit to MS.

Can you post your reduced example? I'm just curious as to what the
problem seems to be.

J-S
--

Apparently, it's also broken on VC8.

I've reduced the size of the example program,  removed the OSG
dependency, and getting ready to submit to MS.

 

T
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-01-29 Thread Guy Wallis
Hi Tanguy,
Intriguing. I'd be keen to see your version of the program too.

Thanks for taking the time to investigate and for passing the bug on to
MS. It's a bit of a worry for them that the bug has gone unnoticed since
the release of v8, that was late 2005 wasn't it?!

Guy

Hi Tanguy,

> I've reduced the size of the example program,  removed the OSG 
> dependency, and getting ready to submit to MS.

Can you post your reduced example? I'm just curious as to what the
problem seems to be.

J-S
--

Apparently, it's also broken on VC8.

I've reduced the size of the example program,  removed the OSG
dependency, and getting ready to submit to MS.

 

T
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-01-29 Thread Jean-Sébastien Guay

Hi Tanguy,

I’ve reduced the size of the example program,  removed the OSG 
dependency, and getting ready to submit to MS.


Can you post your reduced example? I'm just curious as to what the 
problem seems to be.


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-01-29 Thread Tanguy Fautre
Apparently, it's also broken on VC8.

 

I've reduced the size of the example program,  removed the OSG
dependency, and getting ready to submit to MS.

 

T

 

 

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Tanguy
Fautre
Sent: Thursday 29 January 2009 11:43
To: OpenSceneGraph Users
Subject: Re: [osg-users] MSVC v9

 

Hi Guy,

 

I was able to reproduce the problem on my computer too.

You got my colleagues and I quite puzzled. At this point it's very
tempting to say it's a compiler bug.

 

I'll do some more investigation. If you don't mind, I'll submit this bug
to Microsoft if we cannot fix it.

 

 

Tanguy

 

 

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Guy
Wallis
Sent: Thursday 29 January 2009 03:38
To: OpenSceneGraph Users
Subject: [osg-users] MSVC v9

 

First, sorry Jan!

 

I'm new to mailing lists and assumed that threads were generated on the
basis of the subject line not who I replied to. Thanks for pointing out
my mistake.

 

 

 

 

Second, thanks to Tanguy and Ralph for suggestions.

 

I'm using an old 2.8 Ghz Pentium 4 - so not a dual core problem. But the
error does remind me of threading issues I used to have with
multiprocessor IRIX machines.

 

I tried using the volatile type qualifier but then I got a load of
conversion errors because MSVC++ v9 didn't recognise the variable as an
osg::Vec3 anymore:

 

.\dodec.cpp(78) : error C2678: binary '-' : no operator found which
takes a left-hand operand of type 'volatile osg::Vec3' (or there is no
acceptable conversion)

C:\Program Files\OpenSceneGraph\include\osg/Vec3f(152): could be
'const osg::Vec3f osg::Vec3f::operator -(const osg::Vec3f &) const'

C:\Program Files\OpenSceneGraph\include\osg/Vec3f(167): or
'const osg::Vec3f osg::Vec3f::operator -(void) const'

 

 

I've distilled the problem into a pretty simple program - I don't even
need to pop up a window. Some things might look a little odd, but almost
any changes from this point result in correct behaviour. I'm expecting a
list of coordinates from (0.0, 0.0, 0.0) to (11.0, 11.0, 11.0) but as
you'll hopefully see, I get the central part of the array not updating
properly.

 

 

#include 

 

osg::Vec3 vc[12];

 

int main( int argc, char **argv )

{

  int a;

  osg::Vec3   vt[12], p;

 

  for(a=0;a<12;a++){

vc[a].set((float)a, (float)a, (float)a+1.0f);

  }

 

  p = osg::Vec3(0.0f,0.0f,1.0f);

  vt[0] = vc[0]-p;

  for(a=1;a<12;a++){

vt[a] = vc[a]-p;

  }

  for(a=0;a<12;a++){

printf("%5.2f %5.2f %5.2f\n", vt[a].x(), vt[a].y(),
vt[a].z());

  }

  return 0;

}

 

Two crucial steps are the vc[a]-p stage, and using the local variable vt
for printing because otherwise the array updates correctly.

 

Any ideas? Such as leave it for Microsoft to sort out!

 

Thanks,

 

Guy

 

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-01-29 Thread Tanguy Fautre
Hi Guy,

 

I was able to reproduce the problem on my computer too.

You got my colleagues and I quite puzzled. At this point it's very
tempting to say it's a compiler bug.

 

I'll do some more investigation. If you don't mind, I'll submit this bug
to Microsoft if we cannot fix it.

 

 

Tanguy

 

 

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Guy
Wallis
Sent: Thursday 29 January 2009 03:38
To: OpenSceneGraph Users
Subject: [osg-users] MSVC v9

 

First, sorry Jan!

 

I'm new to mailing lists and assumed that threads were generated on the
basis of the subject line not who I replied to. Thanks for pointing out
my mistake.

 

 

 

 

Second, thanks to Tanguy and Ralph for suggestions.

 

I'm using an old 2.8 Ghz Pentium 4 - so not a dual core problem. But the
error does remind me of threading issues I used to have with
multiprocessor IRIX machines.

 

I tried using the volatile type qualifier but then I got a load of
conversion errors because MSVC++ v9 didn't recognise the variable as an
osg::Vec3 anymore:

 

.\dodec.cpp(78) : error C2678: binary '-' : no operator found which
takes a left-hand operand of type 'volatile osg::Vec3' (or there is no
acceptable conversion)

C:\Program Files\OpenSceneGraph\include\osg/Vec3f(152): could be
'const osg::Vec3f osg::Vec3f::operator -(const osg::Vec3f &) const'

C:\Program Files\OpenSceneGraph\include\osg/Vec3f(167): or
'const osg::Vec3f osg::Vec3f::operator -(void) const'

 

 

I've distilled the problem into a pretty simple program - I don't even
need to pop up a window. Some things might look a little odd, but almost
any changes from this point result in correct behaviour. I'm expecting a
list of coordinates from (0.0, 0.0, 0.0) to (11.0, 11.0, 11.0) but as
you'll hopefully see, I get the central part of the array not updating
properly.

 

 

#include 

 

osg::Vec3 vc[12];

 

int main( int argc, char **argv )

{

  int a;

  osg::Vec3   vt[12], p;

 

  for(a=0;a<12;a++){

vc[a].set((float)a, (float)a, (float)a+1.0f);

  }

 

  p = osg::Vec3(0.0f,0.0f,1.0f);

  vt[0] = vc[0]-p;

  for(a=1;a<12;a++){

vt[a] = vc[a]-p;

  }

  for(a=0;a<12;a++){

printf("%5.2f %5.2f %5.2f\n", vt[a].x(), vt[a].y(),
vt[a].z());

  }

  return 0;

}

 

Two crucial steps are the vc[a]-p stage, and using the local variable vt
for printing because otherwise the array updates correctly.

 

Any ideas? Such as leave it for Microsoft to sort out!

 

Thanks,

 

Guy

 

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-01-29 Thread Robert Osfield
Hi Guy,

On Thu, Jan 29, 2009 at 3:37 AM, Guy Wallis  wrote:
> I'm new to mailing lists and assumed that threads were generated on the
> basis of the subject line not who I replied to. Thanks for pointing out my
> mistake.

This isn't a mailman mailing list convention, the threading is all
client side, so it's your mail client that will do all the sorting
into threads.  Some mail tools just look at the subject line for
threading, others that other elements from the mail header.  If you do
reply to and change the subject line you still keep some of the old
mail header info which then misdirects some mail clients to thread in
a way that you didn't intend which can be really confusing and
frustrating for those community members with perfectly correct mail
clients.

The best way to start a new thread is to just write directly to the
osg-users this way you don't inherit any of the wrong header info.
And when replying to existing thread just do a reply to and things
should work just fine.

As for your specific problem, the code segment looked correct to me,
so I don't have any ideas what might be up.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-01-26 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Guy Wallis wrote:
> 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:
> 

Please, do not hijack the thread - post a new message instead of
replying to a random message in the list with a new subject.

Thank you,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJfaBmn11XseNj94gRApMXAJ95WJMkuCzepZYqx9GoCGLfL2SKngCfbN9G
B96wfqIMo0E6oInc7qgZNH0=
=znO0
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-01-26 Thread Ralph Kern
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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] MSVC v9

2009-01-26 Thread Tanguy Fautre
Hi Guy,

 

AFAIK this should work. Could you reduce that problem to a small example
program so we could actually review the code?

 

 

Cheers,

 

Tanguy

 

 

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Guy
Wallis
Sent: Monday 26 January 2009 10:58
To: OpenSceneGraph Users
Subject: [osg-users] MSVC v9

 

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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org