Code example for FloatBuffer

Methods: flip, put

0
	        glGraphics = ((GLGame) game).getGLGraphics();
	 
	        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(3 * VERTEX_SIZE);
	        byteBuffer.order(ByteOrder.nativeOrder());
	        vertices = byteBuffer.asFloatBuffer();
	        vertices.put( new float[] {   0.0f,   0.0f, 1, 0, 0, 1,
	                                    319.0f,   0.0f, 0, 1, 0, 1, 
	                                    160.0f, 479.0f, 0, 0, 1, 1}); 
	        vertices.flip();
	    } 
	 
	    @Override 
	    public void present(float deltaTime) {
	        GL10 gl = glGraphics.getGL();
	        gl.glViewport(0, 0, glGraphics.getWidth(), glGraphics.getHeight());
	        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
	        gl.glMatrixMode(GL10.GL_PROJECTION);
	        gl.glLoadIdentity();
	        gl.glOrthof(0, 320, 0, 480, 1, -1);
	         
	        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);