/** Sets up texturing for the object */
  private void setupTextures(Object3D ob) {
    // create new texture ids if object has them
    if (ob.hasTexture()) {
      // number of textures
      int[] texIDs = ob.get_texID();
      int[] textures = new int[texIDs.length];
      _texIDs = new int[texIDs.length];
      // texture file ids
      int[] texFiles = ob.getTexFile();

      Log.d("TEXFILES LENGTH: ", texFiles.length + "");
      GLES20.glGenTextures(texIDs.length, textures, 0);

      for (int i = 0; i < texIDs.length; i++) {
        texIDs[i] = textures[i];

        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texIDs[i]);

        // parameters
        GLES20.glTexParameterf(
            GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
        GLES20.glTexParameterf(
            GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);

        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_REPEAT);
        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_REPEAT);

        InputStream is = mContext.getResources().openRawResource(texFiles[i]);
        Bitmap bitmap;
        try {
          bitmap = BitmapFactory.decodeStream(is);
        } finally {
          try {
            is.close();
          } catch (IOException e) {
            // Ignore.
          }
        }

        // create it
        GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
        bitmap.recycle();

        Log.d("ATTACHING TEXTURES: ", "Attached " + i);
      }
    }
  }