title: Android: Google Filament GLTF/GLB model not displayed
body: <p>My issue is that I'm trying to make a <code>SurfaceView</code> display a 3D model that's just a small part of the whole application layout. The layout includes multiple views for displaying other data; however, as soon as I create the <code>ModelViewer</code> the <code>SurfaceView</code> vanishes. When I use version <code>1.9.9</code> of Filament the layout is displayed, but heavily pixelated and seems to make other layout elements disappear. With <code>v1.7.0</code> the other elements don't dissapear, but nothing is displayed.</p>
  <p>I'm using the following version in Gradle file:</p>
  <pre><code>implementation 'com.google.android.filament:filament-android:1.7.0'
  implementation 'com.google.android.filament:filament-utils-android:1.7.0'
  implementation 'com.google.android.filament:gltfio-android:1.7.0'
  </code></pre>
  <p>I have a model copying to the assets folder as I've seen in their Kotlin example:
  <a href="https://github.com/google/filament/tree/main/android/samples/sample-gltf-viewer" rel="nofollow noreferrer">https://github.com/google/filament/tree/main/android/samples/sample-gltf-viewer</a></p>
  <p>This is my Java attempt at loading a custom GLTF 2.0 model exported from Blender:</p>
  <pre><code>import android.content.Context;
  import androidx.constraintlayout.widget.ConstraintLayout;
  
  import android.view.Choreographer;
  import android.view.SurfaceView;
  
  import com.google.android.filament.Engine;
  import com.google.android.filament.utils.*;
  
  import java.io.IOException;
  import java.io.InputStream;
  import java.nio.ByteBuffer;
  
  public class Model implements Choreographer.FrameCallback {
  
      static {
          Utils.INSTANCE.init();
      }
  
      private final String TAG = Model.class.getSimpleName();
      private Context context;
      private SurfaceView surfaceView;
      private ModelViewer modelViewer;
      private Engine engine;
      private Choreographer choreographer;
      private final String modelFilename = &quot;models/modelTest.glb&quot;;
  
      @Override
      public void doFrame(long currentTime) {
          choreographer.postFrameCallback(this);
          modelViewer.render(currentTime);
      }
  
      public Model(Context context, ConstraintLayout layout) {
  
          this.context = context;
          choreographer = Choreographer.getInstance();
  
          surfaceView = new SurfaceView(context);
          layout.addView(surfaceView);
          engine = Engine.create();
          modelViewer = new ModelViewer(surfaceView, engine, null);
          loadModel(modelFilename);
          choreographer.postFrameCallback(this);
      }
  
      private void loadModel(String filepath) {
          try {
              InputStream buffer = context.getAssets().open(filepath);
              byte[] bytes = new byte[buffer.available()];
              buffer.read(bytes);
              ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
              modelViewer.loadModelGlb(byteBuffer);
              modelViewer.transformToUnitCube(new Float3(0,0,0));
          }
          catch(IOException e) {
  
          }
      }
  
  }
  </code></pre>
  <p>Edit 1:</p>
  <p>This is what displays when using any version above 1.9.4. The choreographer loop makes the static portions look like static noise on a TV. The red parts appear to be a small portion of the model.
  <a href="https://i.stack.imgur.com/eXBtK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eXBtK.jpg" alt="enter image description here" /></a></p>