Graphics Programs Reference
In-Depth Information
0.1f,-0.1f,0.0f
// fourth quadrant
};
ByteBuffer pointVBB =
ByteBuffer.allocateDirect(pointVFA.length * 4);
pointVBB.order(ByteOrder.nativeOrder());
_pointVFB = pointVBB.asFloatBuffer();
_pointVFB.put(pointVFA);
_pointVFB.position(0);
}
Listing 4-3. GL POINT ELEMENTS/src/com/apress/android/glpointelements/
GLES20Renderer.java
private void initShapes() {
float[] pointVFA = { // vertex (float) array
0.1f,0.1f,0.0f, // 0
-0.1f,0.1f,0.0f, // 1
-0.1f,-0.1f,0.0f, // 2
0.1f,-0.1f,0.0f
// 3
};
ByteBuffer pointVBB =
ByteBuffer.allocateDirect(pointVFA.length * 4);
pointVBB.order(ByteOrder.nativeOrder());
_pointVFB = pointVBB.asFloatBuffer();
_pointVFB.put(pointVFA);
_pointVFB.position(0);
short[] pointISA = { // index (short) array
0,1,2,3
};
ByteBuffer pointIBB =
ByteBuffer.allocateDirect(pointISA.length * 2);
pointIBB.order(ByteOrder.nativeOrder());
_pointISB = pointIBB.asShortBuffer();
_pointISB.put(pointISA);
_pointISB.position(0);
}
 
Search WWH ::




Custom Search