Incorrect model rendering


I have a problem with rendering model.

After rendering model looks like with flipped normals and no zbuffer enabled.

Please look at picture

This is correct model rendering

This is incorrect model rendering

I have correct image in case of I add model to rootNode inside simpleSetup() function of my class inherited from SimpleCanvasImpl class…

Incorrect image take place if I try to add model to rootNode later ( by mouse click ).

Please help, I don’t know how to solve my problem :frowning:

Looks like you are missing a ZBufferState

Model is attached to Node element and Node attached to rootNode ( rootNode->Node->modelNode ).

I need to apply ZBufferState to Node or to modelNode ?

I don't understand why it works great if I create model inside simpleSetup()…

have add ZBufferState to modelNode and now all right.

Thank you very much.

Calling updateRenderState() on your node after you have attached your nodes to the rootNode should be enough since by default they inherit the zbufferstate.