Code example for FloatBuffer

Methods: glVertexAttribPointer, position

0
	public void bind(){ 
		if(isBound == false){
			//GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, bufferID); // android 2.3+ 
			GLES20.glEnableVertexAttribArray(positionAttribute);
			 
			vertexBuffer.position(0);
			GLES20.glVertexAttribPointer(positionAttribute, 3, GLES20.GL_FLOAT, false, VERTEX_SIZE, vertexBuffer);
			//GLES20.glVertexAttribPointer(positionAttribute, 3, GLES20.GL_FLOAT, false, VERTEX_SIZE, 0); // only for android 2.3+ 
			 
			if(hasNormals){
				GLES20.glEnableVertexAttribArray(normalAttribute);
				vertexBuffer.position(3);
				GLES20.glVertexAttribPointer(normalAttribute, 3, GLES20.GL_FLOAT, false, VERTEX_SIZE, vertexBuffer);
				//GLES20.glVertexAttribPointer(normalAttribute, 3, GLES20.GL_FLOAT, false, VERTEX_SIZE, 3); // only for android 2.3+ 
			} 
			 
			if(hasTexture){
				GLES20.glEnableVertexAttribArray(textureAttribute);
				vertexBuffer.position((hasNormals?6:3));
				GLES20.glVertexAttribPointer(textureAttribute, 2, GLES20.GL_FLOAT, false, VERTEX_SIZE, vertexBuffer);
				//GLES20.glVertexAttribPointer(textureAttribute, 2, GLES20.GL_FLOAT, false, VERTEX_SIZE, (hasNormals?6:3)); // only for android 2.3+ 
			} 
		} 
		 
		isBound = true;