Skip to main content
gamedev.net
🔒 Locked

Culling?

Started by solinent Jun 2, 2006 at 9:30 PM 3 replies 500+ views
Original Post
solinent
solinent
Ok, I must explain, I'm new to DirectX entirely. I'm following a tutorial, and I'm paticularily stuck. I'm following the excercize at the end, and it tells me to do something. I know the problem, but don't know the code. The problem is culling, that the other side of the shape isn't rendered (even though I want it to be). So, how do I set culling on (d3d_set_culling isn't defined?). I'm new to DirectX and C++ (though I know syntax, I have never "actually" programmed in c++)
don
don
This disables culling entirely:

IDirect3DDevice9::SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);


Look in the SDK docs for "D3DCULL"


dominicoder
dominicoder
Sounds like you're trying to disable backface culling. If this is the case you can just do

device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

assuming "device" is a valid DirectX device.
solinent
solinent
Thanks alot Idramire, it worked perfectly. I believe culling is a good thing, but at least now I can turn it off.

However, how would I disable it temporarily, or for certain Primitives.

Thanks! I hope I can learn it and put it to use someday :)
Sr_Guapo
Sr_Guapo
Quote:
Original post by solinent
However, how would I disable it temporarily, or for certain Primitives.


Just set that property right before you render the affected triangles and turn it back on for the rest.

// Object 1: render back facesdevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);obj1.Draw();// Object 2: don't render back facesdevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);obj2.Draw();
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.