FloatBuffer put - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for FloatBuffer put method.

This code example shows how to use the following methods:position, put
This code example shows how to use the following methods:position, put
This code example shows how to use the following methods:sleep, flip, position, put
 
	public static void main(String[] args) {
		try { PServer v = null; //new PServer(4444);
		ByteBuffer b = ByteBuffer.allocate(20);
		FloatBuffer fb = b.asFloatBuffer();
		fb.put(0.1f); fb.flip();
		System.out.println(fb.position() + "=fpos   bpos=" + b.position());
		Thread t = new Thread(v);
		t.start();
		try {Thread.sleep(100); } catch (Exception e ) {}
		PServerClient psc = new PServerClient("localhost",4444);
		{	int[] e = {201, 202, 203, 1000000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2};
			int[] f = {101, 102, 103, 104, 105, 106,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,2,3,5,3,4,2,3,4,5,3,2,5,6,7,12345,34};
			PhrasePair pp = new PhrasePair(new Phrase(e, 0), new Phrase(f, 1));
			psc.query(pp, true);
		} 
		//try {Thread.sleep(500); } catch (Exception ex){} 
		{int[] e = {201, 202, 203,2,2,2};
		int[] f = {101, 102, 103,6,7,12345,34};
			PhrasePair pp = new PhrasePair(new Phrase(f, 0), new Phrase(e, 1));

7
CodeRank
This code example shows how to use the following methods:position, put
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
 
    } 
 
    public static void fillFloatBuffer(FloatBuffer fb, float[] arr) {
        fb.position(0);
        fb.put(arr);
    } 
 
    public static FloatBuffer makeFloatBuffer(float[] arr) {
        ByteBuffer bb = BufferProvider.allocateDirect(arr.length * 4);
        bb.order(ByteOrder.nativeOrder());
        FloatBuffer fb = bb.asFloatBuffer();
        fb.put(arr);
        fb.position(0);
        return fb;
    } 
 
    public static FloatBuffer createFloatBuffer(int arrayElementCount) {
        ByteBuffer temp = BufferProvider.allocateDirect(4 * arrayElementCount);
7
CodeRank
This code example shows how to use the following methods:position, put
        mVertexBuffer.position(0);
 
        vbb = ByteBuffer.allocateDirect(colors.length*4);
        vbb.order(ByteOrder.nativeOrder());
        mColorBuffer = vbb.asFloatBuffer();
        mColorBuffer.put(colors);
        mColorBuffer.position(0);
 
        mIndexBuffer = ByteBuffer.allocateDirect(indices.length);
        mIndexBuffer.put(indices);
        mIndexBuffer.position(0);
    } 
 
    public void onAccuracyChanged(Sensor sensor, int accuracy) {
    } 
 
    public void onSensorChanged(SensorEvent event) {
        int type = event.sensor.getType();
        float[] data;
        if (type == Sensor.TYPE_ACCELEROMETER) {
7
CodeRank
This code example shows how to use the following methods:position, put
	public Triangle() { 
		// 
		ByteBuffer byteBuf = ByteBuffer.allocateDirect(vertices.length * 4);
		byteBuf.order(ByteOrder.nativeOrder());
		vertexBuffer = byteBuf.asFloatBuffer();
		vertexBuffer.put(vertices);
		vertexBuffer.position(0);
	} 
 
	/** 
	 * The object own drawing function. Called from the renderer to redraw this 
	 * instance with possible changes in values. 
	 *  
	 * @param gl 
	 *            - The GL context 
	 */ 
	public void draw(GL10 gl) {
		// Set the face rotation 
		gl.glFrontFace(GL10.GL_CCW);
 
7
CodeRank
This code example shows how to use the following methods:put
This code example shows how to use the following methods:put
	/** 
	 * Copy with JNI for devices prior GINGERBREAD(api 9), put for newer versions(HTC Sensation has faster put(float[]) )   
	 */ 
	public static void copyFloats(float[] src, int srcOffset, FloatBuffer dst, int numElements) {
		if(Build.VERSION.SDK_INT >= 9) {
			dst.put(src, srcOffset, numElements);
		} else { 
			com.badlogic.gdx.utils.BufferUtils.copy(src, srcOffset, dst, numElements);
		} 
	} 
} 
6
CodeRank
This code example shows how to use the following methods:position, put
 
		// 
		byteBuf = ByteBuffer.allocateDirect(normals.length * 4);
		byteBuf.order(ByteOrder.nativeOrder());
		normalBuffer = byteBuf.asFloatBuffer();
		normalBuffer.put(normals);
		normalBuffer.position(0);
 
		// 
		indexBuffer = ByteBuffer.allocateDirect(indices.length);
		indexBuffer.put(indices);
		indexBuffer.position(0);
	} 
 
	/** 
	 * The object own drawing function. 
	 * Called from the renderer to redraw this instance 
	 * with possible changes in values. 
	 *  
	 * @param gl - The GL Context 
7
CodeRank
This code example shows how to use the following methods:position, put
	public Square() { 
		// 
		ByteBuffer byteBuf = ByteBuffer.allocateDirect(vertices.length * 4);
		byteBuf.order(ByteOrder.nativeOrder());
		vertexBuffer = byteBuf.asFloatBuffer();
		vertexBuffer.put(vertices);
		vertexBuffer.position(0);
	} 
 
	/** 
	 * The object own drawing function. Called from the renderer to redraw this 
	 * instance with possible changes in values. 
	 *  
	 * @param gl 
	 *            - The GL context 
	 */ 
	public void draw(GL10 gl) {
		// Set the face rotation 
		gl.glFrontFace(GL10.GL_CCW);
 
7
CodeRank

Related FloatBuffer put Questions & Answers:

put Method Overview
Relative bulk put method  (optional operation).
See Code Examples for other Java 8 FloatBuffer Methods: