Android Open Source - OpenGlDraw_Android Shape Square






From Project

Back to project page OpenGlDraw_Android.

License

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.

Java Source Code

package com.example.opengldraw.shapes;
/*from  w  w  w .  j a  v a 2  s  .  c  om*/
import com.example.opengldraw.utils.ShapeDataInterface;

public class ShapeSquare extends Object implements ShapeDataInterface {

  float vertices[] = {
        -1.0f, 1.0f, 1.0f,
        -1.0f, -1.0f, 1.0f,
        1.0f, -1.0f, 1.0f,
        1.0f, 1.0f, 1.0f
    };

    /* 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 };

    short indices[] = { 
        0, 1, 2, 
        2, 0, 3
        };
    
    float normals[] = {
        -0f, 0f, 1f,
        0f, 0f, -1f,
        1f, -0f, 0f,
        -1f, -0f, -0f,
        -0f, -0f, 1f,
        -0f, -1f, 0f,
        1f, 0f, 0f,
        0f, 1f, -0f };
    
    float textCoords[] = { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f };
    
  @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;
  }

}




Java Source Code List

com.example.opengldraw.MainActivity.java
com.example.opengldraw.gl.GLSurfaceViewDraw.java
com.example.opengldraw.gl.RendererDraw.java
com.example.opengldraw.gl.ShapeDrawer.java
com.example.opengldraw.shapes.FireEngine.java
com.example.opengldraw.shapes.ShapeCube.java
com.example.opengldraw.shapes.ShapeCup10Verts.java
com.example.opengldraw.shapes.ShapeCup64Verts.java
com.example.opengldraw.shapes.ShapeSquare.java
com.example.opengldraw.utils.IndexOrderObj.java
com.example.opengldraw.utils.ShapeDataInterface.java
com.example.opengldraw.utils.WavefrontObj.java