[osg-users] [osgOcean] Error used osgOcean1.0 in MFC vc2005sp1

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Mon Nov 2 06:02:45 PST 2009


Hello Tian,

>    Was it those that you deleted? Yes, I just delet thems, because I found that these two "inline " functions had not been used in anywhere. And now my project just goes right,  the same with the "oceanExample".

Sorry I didn't pick up on this thread... I'm pretty darn busy so I just 
glance over threads that I don't immediately have an answer for, but 
looking at the OceanScene header in the osgOcean-1.0 tag, lines 213 and 
223, it was immediately obvious what the problem was. You do not need to 
delete them. Just rename the variables called "near" and "far" to 
something else, like this for example:

         /** Set near DOF blur distance.
           * Updates the uniform is DOF state is valid.
           */
         inline void setDOFNear( float zNear ) {
             _dofNear = zNear;

             if( _dofStateSet.valid() )
 
_dofStateSet->getUniform("osgOcean_DOF_Near")->set(_dofNear);
         }

         /** Set far DOF blur distance
           * Updates the uniform is DOF state is valid.
           */
         inline void setDOFFar(float zFar ) {
             _dofFar = zFar;

             if( _dofStateSet.valid() )
 
_dofStateSet->getUniform("osgOcean_DOF_Far")->set(_dofNear);
         }

Just for general reference, the problem was that on Windows compilers 
(and previously DOS), "near" and "far" were once keywords used to refer 
to memory inside the first 64k page, and outside, respectively (back 
when you needed to address them differently, which is a long time ago). 
Nowadays it's pretty obsolete, but some compilers on PC still carry that 
legacy. And I get bitten by it every time I do OpenGL or raytracing code 
that needs to have a frustum, with near and far planes :-)

And it doesn't matter that these methods are not used in osgOcean or the 
oceanExample themselves, they're still useful methods to have in order 
to be able to tweak osgOcean's rendering.

>     Sorry , I did not know the meaning of  "the trunk update" clearly.

Kim meant checking out from

   http://osgocean.googlecode.com/svn/trunk/

instead of

   http://osgocean.googlecode.com/svn/tags/osgOcean-1.0/

The 1.0 tag is pretty old now, people should not check out using it 
anymore... Kim, is it possible to make changes on the googlecode site so 
that it doesn't show up by default when people click on the "source" 
tab? The default checkout should be from the trunk now. And the trunk 
has the above fix already, btw.

Hope this helps,

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
                                http://www.cm-labs.com/
                         http://whitestar02.webhop.org/


More information about the osg-users mailing list