X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fbackends%2Fopengl%2Ftexture2d_backend.cpp;h=72962117bc9967d98228735063b5189e10368dfd;hp=578cefe390f0a2ec2bfa4bdb15e73426fef43822;hb=f73e671dcb36c097647cddbf5b1eaaad2ffc9299;hpb=9e63512930bc7dace6dc169c65161961e5dcfcf6 diff --git a/source/backends/opengl/texture2d_backend.cpp b/source/backends/opengl/texture2d_backend.cpp index 578cefe3..72962117 100644 --- a/source/backends/opengl/texture2d_backend.cpp +++ b/source/backends/opengl/texture2d_backend.cpp @@ -95,11 +95,18 @@ void OpenGLTexture2D::sub_image(unsigned level, int x, int y, unsigned wd, unsig glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); } -Resource::AsyncLoader *OpenGLTexture2D::create_async_loader(IO::Seekable &io) +Resource::AsyncLoader *OpenGLTexture2D::load(IO::Seekable &io, const Resources *) { return new AsyncLoader(static_cast(*this), io); } +uint64_t OpenGLTexture2D::get_data_size() const +{ + unsigned width = static_cast(this)->width; + unsigned height = static_cast(this)->height; + return id ? width*height*get_pixel_size(format) : 0; +} + void OpenGLTexture2D::unload() { glDeleteTextures(1, &id);