]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/opengl/texture1d_backend.cpp
Move the Resource function override of Texture classes into backend
[libs/gl.git] / source / backends / opengl / texture1d_backend.cpp
index e44ceb4e757d6efefc4b54414d396894d8a9f019..a270468b141883437f46d51de02a54888f69ee6f 100644 (file)
@@ -19,6 +19,9 @@ void OpenGLTexture1D::allocate()
        unsigned width = static_cast<const Texture1D *>(this)->width;
        unsigned levels = static_cast<const Texture1D *>(this)->levels;
 
+       if(!id)
+               create();
+
        GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
        if(ARB_texture_storage)
        {
@@ -59,5 +62,11 @@ void OpenGLTexture1D::sub_image(unsigned level, int x, unsigned wd, const void *
        }
 }
 
+size_t OpenGLTexture1D::get_data_size() const
+{
+       unsigned width = static_cast<const Texture1D *>(this)->width;
+       return id ? width*get_pixel_size(storage_fmt) : 0;
+}
+
 } // namespace GL
 } // namespace Msp