Matrix Cube

I’ve been messing around with a bunch of cubes. Something very weird happened due to a logic flaw in code to a cube when I detached all root children by pressing a number from 2-6, that was supposed to detach all children rootNode and draw another bunch of cubes.



Here is the picture:







Is it some sort of default texture?

unfortunately no one can be told what the matrix is …

xD

As far as I know, OpenGL is still set to draw some textures on the screen (from the last call that wanted to draw them), and you can see that the texture is actually the one which is used to draw a text on the screen. Anyway, you should try clearing TextureState for the box. :slight_smile:

According to my own thread & same problem http://www.jmonkeyengine.com/forum/index.php?topic=12896.0 you should try this:


Core-Dump said:

you are probably missing a node.updateRenderstate(), its a very common pitfall when creating objects on the fly.

try this:


.....
rootNode.attachChild(node);
node.updateRenderState();



It works at the startup, because at the the end of initGame() (depends on what game implementation you use), updateRenderstate() is called for you on the root node already.

heh yes, the matrix cube is a pretty common sight in jME.

Always call updateRenderState() after attaching something to a node.



Since jME is a Scenegraph, the child nodes inherit the renderstates from its parents, and updateRenderState() does just that.

Without it, the result is pretty much undefined.

@Core-Dump: Someday I will buy you a t-shirt with the default-charset(aka Matrix-Cube) and Default-jME-Texture plus the Text "do you see this?" on the front-side and the text 'call node.updateRenderState()' shown on the back…



:smiley:


I thank everybody, i shall call updateRenderStat() from now on when I'm creating something on the fly :slight_smile: