]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/opengl/texturecube_backend.cpp
Move the Resource function override of Texture classes into backend
[libs/gl.git] / source / backends / opengl / texturecube_backend.cpp
index b113f1bd21ba1a13f01effd610d67df8e7e01624..2b9e09a9c90ecb9a0f27ce48b37e1b9ae747de97 100644 (file)
@@ -31,6 +31,9 @@ void OpenGLTextureCube::allocate()
        unsigned size = static_cast<const TextureCube *>(this)->size;
        unsigned levels = static_cast<const TextureCube *>(this)->levels;
 
+       if(!id)
+               create();
+
        GLenum gl_fmt = get_gl_pixelformat(storage_fmt);
        if(ARB_texture_storage)
        {
@@ -72,6 +75,13 @@ void OpenGLTextureCube::sub_image(unsigned face, unsigned level, int x, int y, u
        }
 }
 
+size_t OpenGLTextureCube::get_data_size() const
+{
+       unsigned size = static_cast<const TextureCube *>(this)->size;
+       return id ? size*size*6*get_pixel_size(storage_fmt) : 0;
+}
+
+
 unsigned get_gl_cube_face(unsigned face)
 {
        switch(static_cast<TextureCubeFace>(face))