public void createBuffer(BufferInfo bufferInfo,BufferType type,Buffer buffer,int target,int usage){
  int byteSize=FLOAT_SIZE_BYTES;
  if (type == BufferType.SHORT_BUFFER)   byteSize=SHORT_SIZE_BYTES;
 else   if (type == BufferType.BYTE_BUFFER)   byteSize=BYTE_SIZE_BYTES;
 else   if (type == BufferType.INT_BUFFER)   byteSize=INT_SIZE_BYTES;
  bufferInfo.byteSize=byteSize;
  int buff[]=new int[1];
  GLES20.glGenBuffers(1,buff,0);
  int handle=buff[0];
  if (buffer != null) {
    buffer.rewind();
    GLES20.glBindBuffer(target,handle);
    GLES20.glBufferData(target,buffer.capacity() * byteSize,buffer,usage);
    GLES20.glBindBuffer(target,0);
  }
  bufferInfo.buffer=buffer;
  bufferInfo.bufferHandle=handle;
  bufferInfo.bufferType=type;
  bufferInfo.target=target;
  bufferInfo.usage=usage;
}

public void createBuffer ( BufferInfo bufferInfo , BufferType type , Buffer buffer , int target , int usage ) { int byteSize = FLOAT_SIZE_BYTES ; if ( type == BufferType . SHORT_BUFFER ) byteSize = SHORT_SIZE_BYTES ; else if ( type == BufferType . BYTE_BUFFER ) byteSize = BYTE_SIZE_BYTES ; else if ( type == BufferType . INT_BUFFER ) byteSize = INT_SIZE_BYTES ; bufferInfo . byteSize = byteSize ; int buff [ ] = new int [ 1 ] ; GLES20 . glGenBuffers ( 1 , buff , 0 ) ; int handle = buff [ 0 ] ; if ( buffer != null ) { buffer . rewind ( ) ; GLES20 . glBindBuffer ( target , handle ) ; GLES20 . glBufferData ( target , buffer . capacity ( ) * byteSize , buffer , usage ) ; GLES20 . glBindBuffer ( target , 0 ) ; } bufferInfo . buffer = buffer ; bufferInfo . bufferHandle = handle ; bufferInfo . bufferType = type ; bufferInfo . target = target ; bufferInfo . usage = usage ; }
creates a buffer and uploads it to the gpu .
