/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.badlogic.gdx.graphics.glutils;

import java.nio.FloatBuffer;

import com.badlogic.gdx.graphics.VertexAttributes;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.IntIntMap;

/** A VertexData instance holds vertices for rendering with OpenGL. It is implemented as either a {@link VertexArray} or a
 * {@link VertexBufferObject}. Only the later supports OpenGL ES 2.0.
 * 
 * @author mzechner */
public interface VertexData extends Disposable {
	/** @return the number of vertices this VertexData stores */
	public int getNumVertices ();

	/** @return the number of vertices this VertedData can store */
	public int getNumMaxVertices ();

	/** @return the {@link VertexAttributes} as specified during construction. */
	public VertexAttributes getAttributes ();

	/** Sets the vertices of this VertexData, discarding the old vertex data. The count must equal the number of floats per vertex
	 * times the number of vertices to be copied to this VertexData. The order of the vertex attributes must be the same as
	 * specified at construction time via {@link VertexAttributes}.
	 * <p>
	 * This can be called in between calls to bind and unbind. The vertex data will be updated instantly.
	 * @param vertices the vertex data
	 * @param offset the offset to start copying the data from
	 * @param count the number of floats to copy */
	public void setVertices (float[] vertices, int offset, int count);

	/** Update (a portion of) the vertices. Does not resize the backing buffer.
	 * @param vertices the vertex data
	 * @param sourceOffset the offset to start copying the data from
	 * @param count the number of floats to copy */
	public void updateVertices (int targetOffset, float[] vertices, int sourceOffset, int count);

	/** Returns the underlying FloatBuffer. If you modify the buffer contents they will be uploaded on the next call to bind. If you
	 * need immediate uploading use {@link #setVertices(float[], int, int)};
	 * @return the underlying FloatBuffer holding the vertex data. */
	public FloatBuffer getBuffer ();

	/** Binds this VertexData for rendering via glDrawArrays or glDrawElements. */
	public void bind (ShaderProgram shader);

	/** Binds this VertexData for rendering via glDrawArrays or glDrawElements.
	 * @param locations array containing the attribute locations. */
	public void bind (ShaderProgram shader, int[] locations);

	/** Unbinds this VertexData. */
	public void unbind (ShaderProgram shader);

	/** Unbinds this VertexData.
	 * @param locations array containing the attribute locations. */
	public void unbind (ShaderProgram shader, int[] locations);
	
	/** Invalidates the VertexData if applicable. Use this in case of a context loss. */
	public void invalidate ();

	/** Disposes this VertexData and all its associated OpenGL resources. */
	public void dispose ();
}

@@ -2606,23 +2606,39 @@
 ffer
-. If you modify
+ and marks it as dirty, causing
  the
@@ -2659,16 +2659,9 @@
 ts t
-hey will
+o
  be 
@@ -2688,16 +2688,21 @@
  call to
+%0D%0A%09 *
  bind. I
@@ -2706,21 +2706,16 @@
 . If you
-%0D%0A%09 *
  need im
@@ -2776,16 +2776,119 @@
 , int)%7D;
+ Any modifications made to the Buffer%0D%0A%09 * *after* the call to bind will not automatically be uploaded.
 %0D%0A%09 * @r

Update VertexData.java