private void initVertexData(float width, float height) { // TODO Auto-generated method stub vCount = 6; float w = width / 2;//起着定位作用 float h = height / 2; float vertices[] = new float[] { -w, h, 0, -w, -h, 0, w, -h, 0, w, -h, 0, w, h, 0, -w, h, 0, };//画三角形原理来构建四边形 ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4); vbb.order(ByteOrder.nativeOrder()); mVertexBuffer = vbb.asFloatBuffer(); mVertexBuffer.put(vertices); mVertexBuffer.position(0); float texCoor[] = new float[] { 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 }; ByteBuffer cbb = ByteBuffer.allocateDirect(texCoor.length * 4); cbb.order(ByteOrder.nativeOrder()); mTexCoorBuffer = cbb.asFloatBuffer(); mTexCoorBuffer.put(texCoor); mTexCoorBuffer.position(0); }