]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/texture.cpp
Store the number of mipmap levels in the Texture base class
[libs/gl.git] / source / core / texture.cpp
index 73dd39b6c5cf79a5662a31ff3846b8981fc677b6..0d7a81512e7f73f5c0a49659b4feddc16739c582 100644 (file)
@@ -34,6 +34,13 @@ void Texture::set_format(PixelFormat fmt)
        swizzle = swiz;
 }
 
+unsigned Texture::count_levels(unsigned size)
+{
+       unsigned n = 0;
+       for(; size; size>>=1, ++n) ;
+       return n;
+}
+
 void Texture::load_image(const string &fn, unsigned lv)
 {
        Graphics::Image img;