diff --git a/Source/OpenTK/TexturePacker.cs b/Source/OpenTK/TexturePacker.cs
index 7d37676b..7d39f34d 100644
--- a/Source/OpenTK/TexturePacker.cs
+++ b/Source/OpenTK/TexturePacker.cs
@@ -76,7 +76,10 @@ namespace OpenTK
{
Node node;
bool found = items.TryGetValue(item, out node);
- rect = node.Rect;
+ if (found)
+ rect = node.Rect;
+ else
+ rect = new Rectangle();
return found;
}
@@ -95,6 +98,23 @@ namespace OpenTK
#endregion
+ #region public void ChangeSize(int new_width, int new_height)
+
+ ///
+ /// Changes the dimensions of the TexturePacker surface.
+ ///
+ /// The new width of the TexturePacker surface.
+ /// The new height of the TexturePacker surface.
+ /// Changing the size of the TexturePacker surface will implicitly call TexturePacker.Clear().
+ ///
+ public void ChangeSize(int new_width, int new_height)
+ {
+ Clear();
+ root.Rect = new Rectangle(0, 0, new_width, new_height);
+ }
+
+ #endregion
+
#region Node
class Node