Skip to content

Commit

Permalink
From Lionel Largarde, "fix for the Image::computeNumberOfMipmapLevels…
Browse files Browse the repository at this point in the history
… method. The method did use the float version of the log function and the / operator.

It works for most of the input sizes, but fails for 8192, 32768...
For 8192, the method returns 13 instead of 14."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14814 16af8721-9629-0410-8352-f15c8da7e697
  • Loading branch information
robertosfield committed Apr 1, 2015
1 parent ebf6139 commit b195c99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/osg/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,11 @@ int Image::computeNumberOfMipmapLevels(int s,int t, int r)
{
int w = maximum(s, t);
w = maximum(w, r);
return 1 + static_cast<int>(floor(logf(w)/logf(2.0f)));

int n = 0;
while (w >>= 1)
++n;
return n+1;
}

bool Image::isCompressed() const
Expand Down

0 comments on commit b195c99

Please sign in to comment.