Java Reference
In-Depth Information
private Graphics3D mGraphics3D = Graphics3D.getInstance();
private Camera mCamera = new Camera();;
private Light mLight = new Light();
private float mAngle = 0.0f;
private Transform mTransform = new Transform();
private Background mBackground = new Background();
private VertexBuffer mVertexBuffer;
private IndexBuffer mIndexBuffer;
private Appearance mAppearance = new Appearance();
private Material mMaterial = new Material();
private Image mImage;
public CornerCanvas() {
super(true);
}
public void init() {
short[] vertices = {
0, 0, 0, 3, 0, 0, 0, 3, 0, 3, 3, 0,
3, 0, 0, 3, 3, 0, 3, 0, -3, 3, 3, -3,
0, 0, 0, 3, 0, 0, 0, 0, -3, 3, 0, -3
};
VertexArray vertexArray = new VertexArray(vertices.length / 3, 3, 2);
vertexArray.set(0, vertices.length/3, vertices);
byte[] normals = {
0, 0, 127, 0, 0, 127, 0, 0, 127, 0, 0, 127,
127, 0, 0, 127, 0, 0, 127, 0, 0, 127, 0, 0,
0, -127, 0, 0, -127, 0, 0, -127, 0, 0, -127, 0
};
VertexArray normalsArray = new VertexArray(normals.length / 3, 3, 1);
normalsArray.set(0, normals.length/3, normals);
short[] texturecords = {
0,1, 1,1, 0, 0, 1, 0,
0,1, 0,0, 1, 1, 1, 0,
0,0, 1,0, 0, 1, 1, 1 };
VertexArray textureArray =
new VertexArray(texturecords.length / 2, 2, 2);
textureArray.set(0, texturecords.length/2, texturecords);
Search WWH ::




Custom Search