public void resizeCapacity(int newCapacity){
  if (newCapacity == capacity_)   return;
  totalQuads_=Math.min(totalQuads_,newCapacity);
  capacity_=newCapacity;
  ByteBuffer tbb=ByteBuffer.allocateDirect(ccQuad2.size * newCapacity * 4);
  tbb.order(ByteOrder.nativeOrder());
  FloatBuffer tmpTexCoords=tbb.asFloatBuffer();
  tmpTexCoords.put(textureCoordinates);
  textureCoordinates=tmpTexCoords;
  textureCoordinates.position(0);
  ByteBuffer vbb=ByteBuffer.allocateDirect(ccQuad3.size * newCapacity * 4);
  vbb.order(ByteOrder.nativeOrder());
  FloatBuffer tmpVertexCoords=vbb.asFloatBuffer();
  tmpVertexCoords.put(vertexCoordinates);
  vertexCoordinates=tmpVertexCoords;
  vertexCoordinates.position(0);
  ByteBuffer isb=ByteBuffer.allocateDirect(6 * newCapacity * 2);
  isb.order(ByteOrder.nativeOrder());
  ShortBuffer tmpIndices=isb.asShortBuffer();
  tmpIndices.put(indices);
  indices=tmpIndices;
  indices.position(0);
  initIndices();
  if (withColorArray_) {
    ByteBuffer cbb=ByteBuffer.allocateDirect(4 * ccColor4B.size * newCapacity* 4);
    cbb.order(ByteOrder.nativeOrder());
    FloatBuffer tmpColors=cbb.asFloatBuffer();
    tmpColors.put(colors);
    colors=tmpColors;
    colors.position(0);
  }
}

public void resizeCapacity ( int newCapacity ) { if ( newCapacity == capacity_ ) return ; totalQuads_ = Math . min ( totalQuads_ , newCapacity ) ; capacity_ = newCapacity ; ByteBuffer tbb = ByteBuffer . allocateDirect ( ccQuad2 . size * newCapacity * 4 ) ; tbb . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer tmpTexCoords = tbb . asFloatBuffer ( ) ; tmpTexCoords . put ( textureCoordinates ) ; textureCoordinates = tmpTexCoords ; textureCoordinates . position ( 0 ) ; ByteBuffer vbb = ByteBuffer . allocateDirect ( ccQuad3 . size * newCapacity * 4 ) ; vbb . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer tmpVertexCoords = vbb . asFloatBuffer ( ) ; tmpVertexCoords . put ( vertexCoordinates ) ; vertexCoordinates = tmpVertexCoords ; vertexCoordinates . position ( 0 ) ; ByteBuffer isb = ByteBuffer . allocateDirect ( 6 * newCapacity * 2 ) ; isb . order ( ByteOrder . nativeOrder ( ) ) ; ShortBuffer tmpIndices = isb . asShortBuffer ( ) ; tmpIndices . put ( indices ) ; indices = tmpIndices ; indices . position ( 0 ) ; initIndices ( ) ; if ( withColorArray_ ) { ByteBuffer cbb = ByteBuffer . allocateDirect ( 4 * ccColor4B . size * newCapacity * 4 ) ; cbb . order ( ByteOrder . nativeOrder ( ) ) ; FloatBuffer tmpColors = cbb . asFloatBuffer ( ) ; tmpColors . put ( colors ) ; colors = tmpColors ; colors . position ( 0 ) ; } }
resize the capacity of the texture atlas . the new capacity can be lower or higher than the current one it returns yes if the resize was successful . if it fails to resize the capacity it will return no with a new capacity of 0 .
