content: /*
   * Copyright (C) 2023 The Android Open Source Project
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package android.support.viewsgraph3d.glcheck;
  
  import android.support.viewsgraph3d.Object3DGL;
  
  import java.nio.ByteBuffer;
  import java.nio.ByteOrder;
  import java.nio.FloatBuffer;
  
  import javax.microedition.khronos.opengles.GL10;
  
  class BoxGL extends Object3DGL {
  {
      vert = new float[]{
              -1.0f, -1.0f, -1.0f,
              1.0f, -1.0f, -1.0f,
              1.0f, 1.0f, -1.0f,
              -1.0f, 1.0f, -1.0f,
              -1.0f, -1.0f, 1.0f,
              1.0f, -1.0f, 1.0f,
              1.0f, 1.0f, 1.0f,
              -1.0f, 1.0f, 1.0f
      };
     colors = new float[]{
              0.0f, 0.0f, 0.0f, 1.0f,
              1.0f, 0.0f, 0.0f, 1.0f,
              1.0f, 1.0f, 0.0f, 1.0f,
              0.0f, 1.0f, 0.0f, 1.0f,
              0.0f, 0.0f, 1.0f, 1.0f,
              1.0f, 0.0f, 1.0f, 1.0f,
              1.0f, 1.0f, 1.0f, 1.0f,
              0.0f, 1.0f, 1.0f, 1.0f
      };
  
      index =  new short[]{
              0, 4, 5, 0, 5, 1,
              1, 5, 6, 1, 6, 2,
              2, 6, 7, 2, 7, 3,
              3, 7, 4, 3, 4, 0,
              4, 7, 6, 4, 6, 5,
              3, 0, 1, 3, 1, 2
      };
  
  }
  
      public BoxGL() {
          ByteBuffer byteBuf = ByteBuffer.allocateDirect(vert.length * 4);
          byteBuf.order(ByteOrder.nativeOrder());
          mVertexBuffer = byteBuf.asFloatBuffer();
          mVertexBuffer.put(vert);
          mVertexBuffer.position(0);
  
          byteBuf = ByteBuffer.allocateDirect(colors.length * 4);
          byteBuf.order(ByteOrder.nativeOrder());
          mColorBuffer = byteBuf.asFloatBuffer();
          mColorBuffer.put(colors);
          mColorBuffer.position(0);
  
          byteBuf = ByteBuffer.allocateDirect(index.length*4);
          byteBuf.order(ByteOrder.nativeOrder());
          mIndexBuffer = byteBuf.asShortBuffer();
          mIndexBuffer.put(index);
          mIndexBuffer.position(0);
      }
  }
  