This is because your box has no texture render state. Call updateRenderState() for your Spatial and this won't happen.
as this question comes up
should i use node.detachChildren(spatial) or better
spatial.removeFromParent(), which looks like doing the same things
Ok so I call that and it gives me a null pointer exception, you mean I have to set a texture state first ? I don't see why if I don't have a texture associated with a box that it would copy random peices of memory to my textures, this seems like a bug to me…?
No, I'm saying you should call updateRenderState(). Not that you should add a texture state yourself. The data is not random, it's the texture of the font used for displaying fps, triangles, etc.
The data is for sure random, I did it with a different class and it makes this really ugly texture as well. To state again just in case you arent clear as to whats happening I am:
- casting the geometry to a Box and getting a reference to it
- calling getParent and casting to my own class, which extends a Node
- I then call a function in my class that extends node
updateRenderState() gives me a null ptr exception, I believe its because I didn't specify a texture state. Thanks
Again: the data is not random, it's because the old texture state (from drawing the FPS node) is left.
"A null prt exeption" doesn't help much. It's better if you show the code or at least the stacktrace. A common cause for it is calling jME methods from a seperate thread. You definaltly do not need to specify a texture state for every object.