CullState Question

I don't need an answer, its just an observation i've made whilst coding:



I was trying to cull certain faces using the method of Node .setCullState(CullState.CS_BACK); which failed miserably.

When I instead used .setRenderState() to a new CullState object like below (edited from another thread) everything worked fine:



CullState cullState = display.getRenderer().createCullState();
cullState.setCullMode(CullState.CS_BACK);
node.setRenderState(cullState);



Is there supposed to be a difference? I assumed they were the samething.

they are two different cull modes:



SceneElement.setCullMode() is for camera culling. (cull objects outside the view for example):


setCullMode sets how scene culling should work on this spatial during drawing.
CULL_DYNAMIC:
Determine via the defined Camera planes whether or not this Spatial should be culled.
CULL_ALWAYS:
Always throw away this object and any children during draw commands.
CULL_NEVER:
Never throw away this object (always draw it)
CULL_INHERIT:
Look for a non-inherit parent and use its cull mode.
NOTE: You must set this AFTER
attaching to a parent or it will be reset with the parent's cullMode
value.

@param mode
one of CULL_DYNAMIC, CULL_ALWAYS, CULL_INHERIT or CULL_NEVER


CullState.setCullMode() reffers to face culling. (what you were searching for)

maybe refactoring these calsses to use enums would be better.

I wasnt searching for anything. I read one of the new threads about Culling and remember the problem about CullMode.



Thanks sfera, I now understand that setCullMode determines whether to cull the entire spatial (if its within the cameras view), whereas applying a Cull RenderState determines whether to cull particular faces (if their normals are in the cameras direction)



Cheers.

Is the opinion that this is confusing enough to warrant a method signature change? I.e. setFrustumCullMode?

imho yes

Its caught me out too

They just didnt want to be the first to say it!