Sign in to follow this  
ponei

Rendering Trouble

Recommended Posts

Hello everyone, i'm new to DirectX and i'm having a damn problem! When I fill the vertex buffer with these vertices the triangle isn't rendered:
    VERTEX vertices[] =  
    {  
        {D3DXVECTOR3( 0.5f, -0.5f, 0.0f )},  
        {D3DXVECTOR3( 0.0f, 0.5f, 0.0f )},  
        {D3DXVECTOR3( -0.5f, -0.5f, 0.0f )},  
    };
BUT when i change the order of the vertices the triangle is rendered!
    VERTEX vertices[] = 
    { 
        {D3DXVECTOR3( 0.0f, 0.5f, 0.0f )}, 
        {D3DXVECTOR3( 0.5f, -0.5f, 0.0f )}, 
        {D3DXVECTOR3( -0.5f, -0.5f, 0.0f )}, 
    };
Is there any order to add the vertices to the vertex buffer? This is pretty wierd! Thanks in advance. []'s

Share this post


Link to post
Share on other sites
By default directx uses clockwise winding ordering (D3DRS_CULLMODE = CCW) which means the back face of triangle is culled away. If you want to use counter-clockwise ordering you have to set D3DRS_CULLMODE render state to CW.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this