Code example for ShortBuffer

Methods: glBufferDatacapacityput

0
        ByteBuffer dlb = ByteBuffer.allocateDirect(
        // (# of coordinate values * 2 bytes per short) 
        		drawOrder.length * 2);
        dlb.order(ByteOrder.nativeOrder());
        ShortBuffer drawListBuffer = dlb.asShortBuffer();
        drawListBuffer.put(drawOrder).position(0);
    	 
    	 
    	 
    	// First, generate as many buffers as we need. 
    	// This will give us the OpenGL handles for these buffers. 
    	GLES20.glGenBuffers(2, buffers, 0);
 
    	// Bind to the buffer. Future commands will affect this buffer 
    	// specifically. 
    	GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, buffers[0]);
    	GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, buffers[1]);
 
 
    	// Transfer data from client memory to the buffer. 
    	// We can release the client memory after this call. 
    	GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER,
    			everythingBuffer.capacity() * BYTES_PER_FLOAT,
    			everythingBuffer, GLES20.GL_STATIC_DRAW);
    	 
    	 
    	GLES20.glBufferData(GLES20.GL_ELEMENT_ARRAY_BUFFER,
    			drawListBuffer.capacity() * 2,
    			drawListBuffer, GLES20.GL_STATIC_DRAW);
 
 
    	// IMPORTANT: Unbind from the buffer when we're done with it. 
    	GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
Connect your IDE to all the code out there  Get Codota for Java