X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fopengl%2Ftexture1d_backend.cpp;h=b8424872b37c3ee960801bfda52eddd4f4185611;hb=e2a707feb62c5df69884cca34d099dd2f7b7e4e2;hp=a270468b141883437f46d51de02a54888f69ee6f;hpb=2b930a353df652ade5baacae21d5d8a01f37c09d;p=libs%2Fgl.git diff --git a/source/backends/opengl/texture1d_backend.cpp b/source/backends/opengl/texture1d_backend.cpp index a270468b..b8424872 100644 --- a/source/backends/opengl/texture1d_backend.cpp +++ b/source/backends/opengl/texture1d_backend.cpp @@ -64,8 +64,17 @@ void OpenGLTexture1D::sub_image(unsigned level, int x, unsigned wd, const void * size_t OpenGLTexture1D::get_data_size() const { + if(!id) + return 0; + unsigned width = static_cast(this)->width; - return id ? width*get_pixel_size(storage_fmt) : 0; + unsigned levels = static_cast(this)->levels; + + size_t level_size = width*get_pixel_size(storage_fmt); + size_t total_size = level_size; + for(unsigned i=0; i>=2) + total_size += level_size; + return total_size; } } // namespace GL