diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index 195ec8a60..1909fd336 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -799,7 +799,11 @@ int Image::computeNumberOfMipmapLevels(int s,int t, int r) { int w = maximum(s, t); w = maximum(w, r); - return 1 + static_cast(floor(logf(w)/logf(2.0f))); + + int n = 0; + while (w >>= 1) + ++n; + return n+1; } bool Image::isCompressed() const