Back to project page OpenGlDraw_Android.
The source code is released under:
GNU General Public License
If you think the Android project OpenGlDraw_Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.opengldraw.shapes; //w w w. j a v a 2 s.c o m import com.example.opengldraw.utils.ShapeDataInterface; public class ShapeCube extends Object implements ShapeDataInterface { float vertices[] = { -1.000000f, -1.000000f, 1.000000f, -1.000000f, -1.000000f, -1.000000f, 1.000000f, -1.000000f, -1.000000f, 1.000000f, -1.000000f, 1.000000f, -1.000000f, 1.000000f, 1.000000f, -1.000000f, 1.000000f, -1.000000f, 1.000000f, 1.000000f, -1.000000f, 1.000000f, 1.000000f, 1.000000f }; /* set the materials to the same color values (or at least one of the materials) */ float colors[] = { 50/255f, 205/255f, 50/255f, 1.0f, 50/255f, 205/255f, 50/255f, 1.0f, 50/255f, 205/255f, 50/255f, 1.0f, 50/255f, 205/255f, 50/255f, 1.0f, 50/255f, 205/255f, 50/255f, 1.0f, 50/255f, 205/255f, 50/255f, 1.0f, 50/255f, 205/255f, 50/255f, 1.0f, 50/255f, 205/255f, 50/255f, 1.0f }; short indices[] = { 4, 5, 0,//1 5, 6, 1,//2 6, 7, 3,//3 7, 4, 0,//4 0, 1, 2,//5 7, 6, 5,//6 5, 1, 0,//1 6, 2, 1,//2 2, 6, 3,//3 3, 7, 0,//4 3, 0, 2,//5 4, 7, 5//6 }; float normals[] = { -1.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, -1.000000f, 1.000000f, -0.000000f, 0.000000f, 0.000000f, 0.000000f, 1.000000f, 0.000000f, -1.000000f, 0.000000f, 0.000000f, 1.000000f, 0.000000f }; float textCoords[] = { 0 }; @Override public float[] getVertices() { return vertices; } @Override public float[] getColors() { return colors; } @Override public float[] getNormals() { return normals; } @Override public short[] getDrawOrder() { return indices; } @Override public float[] getTextCoords() { return textCoords; } }