I fixed this by change all log2(x) to:
log((double)maximum(...))/log(2.0)
Then I successfully built under VS2005.
Attachment is my patch for this problem. Please test it.
2007/9/11, Shue, John <[EMAIL PROTECTED]>:
>
> I'm getting same compiler error on FreeBSD:
> Texture1D.cpp:417: error: `log2' was not declared in this scope
>
> I did:
> # svn update
> # ./configure
> # make
>
> -john
>
> ------------------------------
> *From:* [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *sicong he
> *Sent:* Tuesday, September 11, 2007 10:21 AM
> *To:* Public OpenSceneGraph Users discussion list.
> *Subject:* Re: [osg-users] Please test SVN version of OpenSceneGraph
>
>
> I get latest version and build under VS2005.
> But in these line:
> TextureRectangle.cpp Line 561, TextureCubeMap.cpp Line 387, Texture3D.cppLine
> 459,
> Texture2DArray.cpp Line 467, Texture2D.cpp Line 411,
> Texture1D.cpp Line 417
> These lines VS2005 reports:
> error C3861: "log2" can't find symbol
> Is there some header lost?
>
>
>
> 2007/9/11, Robert Osfield <[EMAIL PROTECTED]>:
> >
> > Hi All,
> >
> > I have merged quite a few changes to the OSG over the last few days,
> > these could break the build, so I'd like some feedback on how the OSG
> > is build and running on various platforms before I go ahead the weekly
> > dev release (2.1.10).
> >
> > Thanks in advance,
> > Robert.
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
>
> This communication, along with any attachments, is covered by federal and
> state law governing electronic communications and may contain company
> proprietary and legally privileged information.
> If the reader of this message is not the intended recipient, you are hereby
> notified that any dissemination, distribution, use or copying of this message
> is strictly prohibited.
> If you have received this in error, please reply immediately to the sender
> and delete this message. Thank you.
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
Index: Texture1D.cpp
===================================================================
--- Texture1D.cpp (revision 7391)
+++ Texture1D.cpp (working copy)
@@ -414,7 +414,7 @@
// compute number of mipmap levels
int width = _textureWidth;
- int numMipmapLevels = 1 + (int)floor(log2(width));
+ int numMipmapLevels = 1 + (int)floor(log((double)width)/log(2.0));
// we do not reallocate the level 0, since it was already allocated
width >>= 1;
Index: Texture2D.cpp
===================================================================
--- Texture2D.cpp (revision 7391)
+++ Texture2D.cpp (working copy)
@@ -408,7 +408,7 @@
// compute number of mipmap levels
int width = _textureWidth;
int height = _textureHeight;
- int numMipmapLevels = 1 + (int)floor(log2(maximum(width, height)));
+ int numMipmapLevels = 1 + (int)floor(log((double)maximum(width,
height))/log(2.0));
// we do not reallocate the level 0, since it was already allocated
width >>= 1;
Index: Texture2DArray.cpp
===================================================================
--- Texture2DArray.cpp (revision 7391)
+++ Texture2DArray.cpp (working copy)
@@ -464,7 +464,7 @@
// compute number of mipmap levels
int width = _textureWidth;
int height = _textureHeight;
- int numMipmapLevels = 1 + (int)floor(log2(maximum(width, height)));
+ int numMipmapLevels = 1 + (int)floor(log((double)maximum(width,
height))/log(2.0));
// we do not reallocate the level 0, since it was already allocated
width >>= 1;
Index: Texture3D.cpp
===================================================================
--- Texture3D.cpp (revision 7391)
+++ Texture3D.cpp (working copy)
@@ -456,7 +456,7 @@
int width = _textureWidth;
int height = _textureHeight;
int depth = _textureDepth;
- int numMipmapLevels = 1 + (int)floor(log2(maximum(width,
maximum(depth, height))));
+ int numMipmapLevels = 1 + (int)floor(log((double)maximum(width,
maximum(depth, height)))/log(2.0));
// we do not reallocate the level 0, since it was already allocated
width >>= 1;
Index: TextureCubeMap.cpp
===================================================================
--- TextureCubeMap.cpp (revision 7391)
+++ TextureCubeMap.cpp (working copy)
@@ -384,7 +384,7 @@
// compute number of mipmap levels
int width = _textureWidth;
int height = _textureHeight;
- int numMipmapLevels = 1 + (int)floor(log2(maximum(width, height)));
+ int numMipmapLevels = 1 + (int)floor(log((double)maximum(width,
height))/log(2.0));
// we do not reallocate the level 0, since it was already allocated
width >>= 1;
Index: TextureRectangle.cpp
===================================================================
--- TextureRectangle.cpp (revision 7391)
+++ TextureRectangle.cpp (working copy)
@@ -558,7 +558,8 @@
// compute number of mipmap levels
int width = _textureWidth;
int height = _textureHeight;
- int numMipmapLevels = 1 + (int)floor(log2(maximum(width, height)));
+ int numMipmapLevels = 1 + (int)floor(log((double)maximum(width,
height))/log(2.0));
+
// we do not reallocate the level 0, since it was already allocated
width >>= 1;
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org