[SOLVED] (but need a explanation if possible?) TextureState pointer is null

Hi all,

I'm trying to get up to date with jme 2.0 and I'm playing with texture states. I'm creating a textureState somewhere in my code like this

given that initially, ts is declared as a public attribute of my class (this class is named Rooms)

 ts = display.getRenderer().createTextureState();
      Texture t = TextureManager.loadTexture(

when I check with eclipse debugger, ts is not null.

Then, later in another function (not belonging to the same class but the call is made by a function of the class Rooms) I call this textureState like this:

if (fatherRooms.t1==null){
               int k=10; // so that I can put a breakpoint here with the eclipse debugger
//mapNodes contains a TriMesh child called "floor"

the point is that I have this javaNullPointerException if I launch the code, and in debugger, it stops at the "int k = 10;" and when within the debugger I check the content of the variable "fatherRooms.t1", I found what seems to me a normally initialized texture state with a texture in it ....
so I'm wondering if there wouldn't be an access restriction problem but I'm not sure why since this member of the fatherRooms object is public ...

any idea ?



I'm almost sure it's a question of privileges,

when instead of setting the texture state within my son class, I call a function in the motherclass (that contains the textureState) that does the same job, it works !

if the public variable is called "ts", then why do you access it from your son class with "fatherClass.t1"? maybe "t1" is just another member variable that really is null?

I forgot to put the code where I state t1=ts

but I really checked, and from the debugger, the variable t1 really contains the correct texture state (at least anything but not a "null" element)

This sounds like a race condition to me. Especially the part about the debugger breaking when null is detected and then the value being set. Are you running the two different pieces of code on different threads?