indexing description: "[ A global storage for textures. TODO: write usage description TOOD: maybe a mechanism to map textures on ids would be nice. ]" date: "$Date$" revision: "$Revision$" class GL_TEXTURES create {GL_SHARED_TEXTURES} make feature {NONE} -- Initialisation make is -- Initialise default values. do create textures_impl.make end feature -- Access textures: DS_LINEAR [GL_TEXTURE] is -- Saved textures do Result := textures_impl end feature -- Element change save (a_texture: GL_TEXTURE) is -- Save `a_texture'. require a_texture_not_void: a_texture /= Void do textures_impl.force_last (a_texture) ensure texture_added: textures.has (a_texture) end feature -- Removal delete (a_texture: GL_TEXTURE) is -- Delete `a_texture'. require a_texture_not_void: a_texture /= Void do textures_impl.delete (a_texture) ensure texture_deleted: not textures.has (a_texture) end delete_id (an_id: INTEGER) is -- Delete texture with `an_id'. local a_cursor: DS_LIST_CURSOR [GL_TEXTURE] do a_cursor := textures_impl.new_cursor from a_cursor.start until a_cursor.after loop if a_cursor.item.id = an_id then a_cursor.remove else a_cursor.forth end end end delete_all is -- Delete all textures. do textures_impl.wipe_out ensure textures_deleted: textures.is_empty end feature {NONE} -- Implementation textures_impl: DS_LINKED_LIST [GL_TEXTURE] -- Saved textures invariant textures_not_void: textures /= Void end