title: LibGDX - StillModel with textures
body: <p>I have read this article: <a href="https://code.google.com/p/libgdx-users/wiki/GenericTextureBinding" rel="nofollow noreferrer">https://code.google.com/p/libgdx-users/wiki/GenericTextureBinding</a>
  And tried to use it. I am using complex .obj(airplane) and 10 textures. Seems to me everything goes as expected, but I don't see any textures on the model. The model is gray. What am I doing wrong?</p>
  
  <pre><code>int listPosition; 
  List&lt;Texture&gt; modelTextures = new ArrayList&lt;Texture&gt;();
  StillModel m_mesh;
  
  public onCreate(){
  String texturePath;
       FileHandle texturePathToLoad;
       boolean engageTextureLookupStrategy2 = false;        
  
       m_mesh = ModelLoaderRegistry.loadStillModel(Gdx.files.internal("obj/airplane.obj"));
  
       SubMesh[] subMeshes = m_mesh.getSubMeshes();
  
       for(SubMesh subMesh : subMeshes)
           Gdx.app.log("create", subMesh.name);
      // strategy #1: texture files share
       //              the object names as basename
       for(SubMesh subMesh : subMeshes)
       {
              // looking for texture file if sub mesh
              // has uv coordinates attached, only!
              if(m_mesh.getSubMesh(subMesh.name).mesh.getVertexAttribute(Usage.TextureCoordinates)!=null)
              {
                      texturePath = "obj/" + subMesh.name;
                      texturePathToLoad = guessTextureFile(texturePath);
                      if(texturePathToLoad!=null)
                      {
                              Gdx.app.log("create","... found Texture! Adding " + texturePathToLoad.path() + " to list of model textures.");
  
                              Texture temp_texture = new Texture(texturePathToLoad);                             
                              modelTextures.add(temp_texture);
                      }
                      else
                      {
                              Gdx.app.log("create","... not found. Object " + subMesh.name + " will not be textured.");
                              engageTextureLookupStrategy2 = true;
                      }
              }
       }
  
  public void render(float delta) {
      Gdx.graphics.getGL10().glClearColor( 0.5f, 0, 0, 1 );
      Gdx.graphics.getGL10().glClear( GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT );
  
       listPosition = 0;      
  
       SubMesh[] subMeshes = m_mesh.getSubMeshes();
  
       for(SubMesh subMesh : subMeshes){      
       if( (modelTextures!=null)
       &amp;&amp;  (modelTextures.size()&gt;0)       
       &amp;&amp; (m_mesh.getSubMesh(subMesh.name).mesh.getVertexAttribute(Usage.TextureCoordinates)!=null)
       )
       {
              if(listPosition&lt;modelTextures.size())
              {
                      // we don't want the texture to be tinted,
                      // thus setting white color.
                  Gdx.gl11.glColor4f(1,1,1,1);
  
                      Gdx.app.log("render","binding texture #" + listPosition + " to texture unit #" + listPosition + " for submesh " + subMesh.name);
                      Gdx.gl.glActiveTexture(listPosition);                      
                      Gdx.gl.glEnable(GL11.GL_TEXTURE_2D);
                      modelTextures.get(listPosition).bind();                    
              }
              else
              {
                  Gdx.gl.glActiveTexture(listPosition);
                  Gdx.gl.glDisable(GL11.GL_TEXTURE_2D);
              }
              listPosition++;
       }
       }             
          m_mesh.render();           
  }
  </code></pre>
  
  <p>LogCat:</p>
  
  <pre><code>create: ... found Texture! Adding obj/left_wing_1.tga to list of model textures.
  create: ... found Texture! Adding obj/rear.tga to list of model textures.
  create: ... found Texture! Adding obj/wheel_support.tga to list of model textures.
  create: ... found Texture! Adding obj/right_wing_1.tga to list of model textures.
  create: ... found Texture! Adding obj/landing_light.tga to list of model textures.
  create: ... found Texture! Adding obj/cockpit_1.tga to list of model textures.
  create: ... found Texture! Adding obj/glass_1.tga to list of model textures.
  create: ... found Texture! Adding obj/body_front.tga to list of model textures.
  create: ... found Texture! Adding obj/pilot.tga to list of model textures.
  create: ... found Texture! Adding obj/reflect.tga to list of model textures.
  render: binding texture #0 to texture unit #0 for submesh left_wing_1
  render: binding texture #1 to texture unit #1 for submesh rear
  render: binding texture #2 to texture unit #2 for submesh wheel_support
  render: binding texture #3 to texture unit #3 for submesh right_wing_1
  render: binding texture #4 to texture unit #4 for submesh landing_light
  render: binding texture #5 to texture unit #5 for submesh cockpit_1
  render: binding texture #6 to texture unit #6 for submesh glass_1
  render: binding texture #7 to texture unit #7 for submesh body_front
  render: binding texture #8 to texture unit #8 for submesh pilot
  render: binding texture #9 to texture unit #9 for submesh reflect
  </code></pre>
  
  <p>Result:</p>
  
  <p><img src="https://i.stack.imgur.com/ATm13.png" alt="enter image description here"></p>