[SOLVED] Strange Texture Behavior

Hey folks,



I'm new to jME and trying to get my feet wet.  Right now I have 3 "things" in the world:  the terrain (TerrainBlock-based), 1 player, 1 mob.



I have 3 different texture files and am passing 3 different (non-null) URLs to the TextureManager.loadTexture() method… but all of my objects have the same texture.   :?  Oddly, it's whichever texture I specify for the terrain.



From log messages I've set up, it looks like the 3 Image objects have different data (TextureState.getTexture().getImage().getWidth() gives 3 different results)



     [java] terrain=256
     [java] player=2048
     [java] mob=256



Here's some of my code for reference.  This is from MobState (extends BasicGameState).  This method gets called after the state is created:


    public void init() {
       
        if (log.isDebugEnabled()) {
            log.debug("Initializing:  " + this.getName());
        }
       
        mob = new Sphere("mob", 30, 30, scale.toGameUnits(1.5f));
        mob.getLocalTranslation().set(50.0f, 0.0f, 50.0f);
        mob.setModelBound(new BoundingBox());
        mob.updateModelBound();

        URL u = getClass().getResource("/data/textures/mob.gif");
       
        if (log.isDebugEnabled()) {
            log.debug(getName() + " texture:  " + u.toExternalForm());
        }

        TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        ts.setTexture(TextureManager.loadTexture(u, Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear));
System.out.println("mob="+ts.getTexture().getImage().getWidth());
        mob.setRenderState(ts);
       
        this.getRootNode().attachChild(mob);

    }

I'd struggled with this issue for quite a while, but right after I posted my question I came upon the answer.



So I guess it pays not to overlook the



Node.updateRenderState()



method.