X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fopengl%2Ftexture3d_backend.cpp;h=961dd7e721766596f439312c45d11348e4eaebc7;hb=e2a707feb62c5df69884cca34d099dd2f7b7e4e2;hp=0796472a041de543d67239591928d393fbc97678;hpb=2b930a353df652ade5baacae21d5d8a01f37c09d;p=libs%2Fgl.git diff --git a/source/backends/opengl/texture3d_backend.cpp b/source/backends/opengl/texture3d_backend.cpp index 0796472a..961dd7e7 100644 --- a/source/backends/opengl/texture3d_backend.cpp +++ b/source/backends/opengl/texture3d_backend.cpp @@ -76,10 +76,19 @@ bool OpenGLTexture3D::is_array() const size_t OpenGLTexture3D::get_data_size() const { + if(!id) + return 0; + unsigned width = static_cast(this)->width; unsigned height = static_cast(this)->height; unsigned depth = static_cast(this)->depth; - return id ? width*height*depth*get_pixel_size(storage_fmt) : 0; + unsigned levels = static_cast(this)->levels; + + size_t level_size = width*height*depth*get_pixel_size(format); + size_t total_size = level_size; + for(unsigned i=0; i>=2) + total_size += level_size; + return total_size; } } // namespace GL