]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/texture2d.cpp
Remove remaining deprecated things from the core classes
[libs/gl.git] / source / core / texture2d.cpp
index ed0b206c1e05069ada3d8e677c84995b706e920b..b5b989a81c88a631abdfc2dbe2993196ac5e39c0 100644 (file)
@@ -1,6 +1,6 @@
-#include <msp/core/raii.h>
 #include <msp/gl/extensions/arb_direct_state_access.h>
 #include <msp/gl/extensions/arb_texture_storage.h>
+#include <msp/gl/extensions/arb_vertex_buffer_object.h>
 #include <msp/graphics/imageloader.h>
 #include "buffer.h"
 #include "error.h"
@@ -116,18 +116,6 @@ void Texture2D::image(unsigned level, const void *data)
        glTexImage2D(target, level, fmt, size.x, size.y, 0, comp, type, data);
 
        allocated |= 1<<level;
-       if(auto_gen_mipmap && level==0)
-       {
-               generate_mipmap();
-               allocated |= (1<<levels)-1;
-       }
-}
-
-void Texture2D::image(unsigned level, PixelComponents comp, DataType type, const void *data)
-{
-       if(comp!=get_components(format) || type!=get_component_type(format))
-               throw incompatible_data("Texture2D::image");
-       image(level, data);
 }
 
 void Texture2D::sub_image(unsigned level, int x, int y, unsigned wd, unsigned ht, const void *data)
@@ -148,16 +136,6 @@ void Texture2D::sub_image(unsigned level, int x, int y, unsigned wd, unsigned ht
                bind_scratch();
                glTexSubImage2D(target, level, x, y, wd, ht, comp, type, data);
        }
-
-       if(auto_gen_mipmap && level==0)
-               generate_mipmap();
-}
-
-void Texture2D::sub_image(unsigned level, int x, int y, unsigned wd, unsigned ht, PixelComponents comp, DataType type, const void *data)
-{
-       if(comp!=get_components(format) || type!=get_component_type(format))
-               throw incompatible_data("Texture2D::sub_image");
-       sub_image(level, x, y, wd, ht, data);
 }
 
 void Texture2D::image(const Graphics::Image &img, unsigned lv)
@@ -201,7 +179,7 @@ Resource::AsyncLoader *Texture2D::load(IO::Seekable &io, const Resources *)
        return ldr;
 }
 
-UInt64 Texture2D::get_data_size() const
+uint64_t Texture2D::get_data_size() const
 {
        return id ? width*height*get_pixel_size(format) : 0;
 }
@@ -303,6 +281,8 @@ bool Texture2D::AsyncLoader::process()
                glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pixel_buffer.get_id());
                texture.image(image, 0, true);
                glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
+               if(texture.auto_gen_mipmap)
+                       texture.generate_mipmap();
        }
 
        ++phase;