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, 0.0f, 1.0f,
	                                     319.0f,   0.0f, 1.0f, 1.0f, 
	                                     160.0f, 479.0f, 0.5f, 0.0f}); 
	        vertices.flip();            
	        textureId = loadTexture("bobrgb888.png");
	    } 
	     
	    public int loadTexture(String fileName) {
	        try { 
	            Bitmap bitmap = BitmapFactory.decodeStream(game.getFileIO().readAsset(fileName));
	            GL10 gl = glGraphics.getGL();
	            int textureIds[] = new int[1];
	            gl.glGenTextures(1, textureIds, 0);
	            int textureId = textureIds[0];
	            gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId);    
	            GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);