Cull hint doesn't work

I've made transition from jme 1.0 do 2.0 and I am little confused because cull hint doesn't work… :confused: I try to set CullHint.Dynamic on objects that are attached to rootNode but that does nothing… Any ideas why? My scene extends SimplePassCanvasImpl.

How about a test to show the problem?

simpleSetup() of my implementor



public void simpleSetup() {

       input = new FirstPersonHandler(getCamera(), 500, 1);
       
        renderer.setBackgroundColor(UtilityManager.makeColorRGBA(((ColorUniform)PreferenceMap.get(Key.Background)).getColor()));

        cam.setFrustumPerspective(45.0f, (float) canvas.getWidth() / (float) canvas.getHeight(), 1, 10000);
        manager.clearAll();
       
        lightState = renderer.createLightState();
        lightState.setEnabled(true);
        lightState.detachAll();
        lightState.setGlobalAmbient(new ColorRGBA(0.1f, 0.1f, 0.1f, 1.0f));
        rootNode.setRenderState(lightState);
        rootNode.updateRenderState();
        
        Vector3f loc = new Vector3f(0, 850, -850);
        Vector3f left = new Vector3f(1, 0, 0);
        Vector3f up = new Vector3f(0, 0.7071f, 0.7071f);
        Vector3f dir = new Vector3f(0, -0.7071f, 0.7071f);
        cam.setFrame(loc, left, up, dir);
        cam.update();
       
        rootPass = new RenderPass();
      rootPass.add(rootNode);
      rootPass.add(grid);
      manager.add(rootPass);
       
      shadowPass = new ShadowedRenderPass();
        shadowPass.add(rootNode);
        shadowPass.setLightingMethod(ShadowedRenderPass.LightingMethod.Additive);
        shadowPass.setRenderShadows(true);
        shadowPass.setEnabled(false);
        manager.add(shadowPass);
       
        bloomPass = new BloomRenderPass(cam, 4);
        bloomPass.add(rootNode);
        bloomPass.setUseCurrentScene(false);
        bloomPass.setEnabled(false);
        manager.add(bloomPass); 
       
        ZBufferState zbuffer = renderer.createZBufferState();
        zbuffer.setEnabled(true);
        zbuffer.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
        zbuffer.setWritable(false);
        grid.setRenderState(zbuffer);
        grid.updateRenderState();
       
        WireframeState wireState = renderer.createWireframeState();
        wireState.setEnabled( false );
        rootNode.setRenderState( wireState );
        rootNode.updateRenderState();
       
        CullState cs = renderer.createCullState();
        cs.setCullFace(CullState.Face.Back);
        cs.setEnabled(true);
        rootNode.setRenderState(cs);
        rootNode.updateRenderState();
       
      rootNode.setName("Root");
        rootNode.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
       
        SelectionDebugger.setSelectionColor(UtilityManager.makeColorRGBA(((ColorUniform) PreferenceMap.get(Key.Selection)).getColor()));
      
    }




public void simpleUpdate() {
       
       input.update(tpf);

       grid.updateGeometricState(0, true);
       grid.updateRenderState();
       
    }



And when I try to set CullHint.Dynamic to objects of my scene (attached to rootNode) there is no effect. They are still visible.

Umm, okay; what I mean was a simpleGame implementation that show the problem and nothing else.  I don't see the setCullHint call anywhere in your code…



(someone should be able to just copy ALL of your code and paste it, then run it without any editing…)

to other things, don't call updateRenderState() every update cycle, just after changing RenderStates, and then call it only on the geometry you changed it on. Second, call updateGeometricState() with the tpf as parameter not 0. That will make problems later with Controllers and stuff.