Archived

This topic is now archived and is closed to further replies.

nPawn

Making a square visible from the front and back

Recommended Posts

I''m currently making a square with four points, then putting a wall texture on it, I move the wall to the left side and it looks great, i move the same wall over to the right side, and a lot of the square appears to be missing, i assume it''s the backside that''s now showing and somehow isn''t being textured properly now? Here''s a screenshot of it, including the code that makes the walls square:

Share this post


Link to post
Share on other sites
Yah, the wall is visible when i go on the other side of it. I just read this in the SDK docs, about trianglestrips (which is what i''m using):

D3DPT_TRIANGLESTRIP
Renders the vertices as a triangle strip. The backface-culling flag is automatically flipped on even-numbered triangles.

the problem is, how do i turn that backface culling off for just this wall structure? It doesn''t point me in a direction on how to do that?

Share this post


Link to post
Share on other sites
You can turn off or reverse the culling mode by specifying:

m_pd3dDevice->SetRenderState(D3DRS_CULLMODE, mode);

Where mode is one of:

D3DCULL_NONE //No culling, all triangles rendered
D3DCULL_CW //Clockwise
D3DCULL_CCW //Counter Clockwise

I suspect you would find your problem fixed if you turned off culling, but you might not like the results (except maybe for debugging purposes) because of the performance hit. A better solution would be to adjust the order in which you are specifying your vertices so that they match the current culling mode.

Share this post


Link to post
Share on other sites