Code example for ShortBuffer

Methods: glBufferDatacapacityput

        ByteBuffer dlb = ByteBuffer.allocateDirect(
        // (# of coordinate values * 2 bytes per short) 
        		drawOrder.length * 2);
        ShortBuffer drawListBuffer = dlb.asShortBuffer();
    	// 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. 
    			everythingBuffer.capacity() * BYTES_PER_FLOAT,
    			everythingBuffer, GLES20.GL_STATIC_DRAW);
    			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);
Experience pair programming with AI  Get Codota for Java