CullState set face back JME 2.0

Hi All, can somebody tell me how to set the CullState face to Back in JME 2.0, I'm only learning Java and I'm a bit stumped… cheers.

Hi!



This is an extract of the source code of TUER:

//Activate back face culling
model.setRenderState(DisplaySystem.getDisplaySystem().getRenderer().createCullState());
((CullState)model.getRenderState(RenderState.StateType.Cull)).setCullFace(CullState.Face.Back);
model.updateRenderState();

That worked :slight_smile: thanks!

gouessej said:


model.setRenderState(DisplaySystem.getDisplaySystem().getRenderer().createCullState());
((CullState)model.getRenderState(RenderState.StateType.Cull)).setCullFace(CullState.Face.Back);
model.updateRenderState();




You should really start programming "cleanly", although the above will work:


CullState cs = DisplaySystem.getDisplaySystem().getRenderer().createCullState();
cs.setActive(true);
cs.setCullFace(CullState.Face.Back);
model.setRenderState(cs);
model.updateRenderState();



cheers
dhdd said:

You should really start programming "cleanly"

Sorry, you're right. I realized a few minutes later that I could have provided a cleaner piece of code.