]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/opengl/texture1d_backend.cpp
Store the number of mipmap levels in the Texture base class
[libs/gl.git] / source / backends / opengl / texture1d_backend.cpp
index 8e33d278984ca06c8f81c4222e01717d195b5b55..aa9e1f298f9f5a9a407ccc9b24262762bf86ac8f 100644 (file)
@@ -25,20 +25,20 @@ void OpenGLTexture1D::allocate()
        if(ARB_texture_storage)
        {
                if(ARB_direct_state_access)
-                       glTextureStorage1D(id, self.levels, gl_fmt, self.width);
+                       glTextureStorage1D(id, n_levels, gl_fmt, self.width);
                else
                {
                        bind_scratch();
-                       glTexStorage1D(target, self.levels, gl_fmt, self.width);
+                       glTexStorage1D(target, n_levels, gl_fmt, self.width);
                }
        }
        else
        {
                bind_scratch();
-               glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, self.levels-1);
+               glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, n_levels-1);
                GLenum comp = get_gl_components(get_components(storage_fmt));
                GLenum type = get_gl_type(get_component_type(storage_fmt));
-               for(unsigned i=0; i<self.levels; ++i)
+               for(unsigned i=0; i<n_levels; ++i)
                {
                        unsigned lv_size = self.get_level_size(i);
                        glTexImage1D(target, i, gl_fmt, lv_size, 0, comp, type, 0);
@@ -70,7 +70,7 @@ size_t OpenGLTexture1D::get_data_size() const
 
        size_t level_size = self.width*get_pixel_size(storage_fmt);
        size_t total_size = level_size;
-       for(unsigned i=0; i<self.levels; ++i, level_size>>=2)
+       for(unsigned i=0; i<n_levels; ++i, level_size>>=2)
                total_size += level_size;
        return total_size;
 }