Rendering Trouble

Started by
1 comment, last by ponei 13 years, 11 months ago
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
Advertisement
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.
Thank you SIIYA. The problem was exactly what you've said. Much thanks.

This topic is closed to new replies.

Advertisement