Wrong TextureState assigned

I guess (but hope not :slight_smile: i found a bug. Concearning TextureStates.

Here is what I do:


I implemented a simple GameState system (because i couldn’t get those from jME to work… -_- ).

In principle, it’s only a class where the input handler and a game state specific Node are held.

Example: Game menu

InputHandler: “Nothing but a mouse coursor”

Node: A menu dialog. (Ortho of course)

As a first simple test, I tried two GameStates:

“ingameState” (active at program start) with a simple green quad as indicator

and “menuState” (inactive at program start) with a red quad as indicator.

The GameState specific nodes and their child-quads are created in their construtors.

Switching means to only set the right InputHandler and (detach) attach the (current) new node. Which works fine.

As “ingame” should be active at program start, I already attached its node during simpleInitGame().

the “menu” node is first attached when switching into the menu GameState.

When i start the program, it looks like it’s supposed to be:

But then, the “red” quad (no matter if it has assigned only a solid color or a own texture) is displayed with a wrong Texture(State?).

One i never assigned to it (but to another object).

Only if I attach the menu node during simpleInitGame() as well, it is displayed correctely.


(note: the transparency of the red quad is intentional)

I suppose the error must lay on side of jME (sadly), as i never touch the Node’s TextureStates after initialising them.

And it can’t be that i initialized the quad with a wrong texture, because the texture is correct when adding the node during simpleInitGame()

So my assumption (and my question) would be:

Could it be that objects (i.e. a Quad in a seperate Node), which are not attached to the rootNode during Init have or may have an error in their texture when first attached during runtime ?

I hope this is enough information to make the problem clear.

And i’m as always thankful for your answers :slight_smile:

Did you call updateRenderState() on the object after assigning it the texture?

omg -.-

Guess i just learned another thing. :smiley:

Pretty relieving that it is actually no bug this time but my fault, which can be fixed immediately.

Thx :slight_smile:

Added to the FAQ: