diff options
-rw-r--r-- | ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java index b98c7ec..88218ea 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java +++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java @@ -346,11 +346,14 @@ public class MeshData implements Savable { * @see #setTextureCoords(FloatBufferData, int) */ public void setTextureBuffer(final FloatBuffer textureBuffer, final int index) { - while (_textureCoords.size() <= index) { - _textureCoords.add(null); + if (textureBuffer != null) { + while (_textureCoords.size() <= index) { + _textureCoords.add(null); + } + _textureCoords.set(index, new FloatBufferData(textureBuffer, 2)); + } else if (index < _textureCoords.size()) { + _textureCoords.set(index, null); } - _textureCoords.set(index, new FloatBufferData(textureBuffer, 2)); - refreshInterleaved(); } /** |