1
\$\begingroup\$

i need some help with mine vertexes. when i long story short when i implemented mine class for projection matrix. i got a shape that is not cube that i had. I have googled little bit and i find it out that i gor backface culling. but i do not understand how to fix it. i tried everything.

bool CreateVertexBuffer(ID3D11Device* device, VertexBufferD3D11* vertex)
{
        float A = 1.0f; 

    SimpleVertex square[] =
    {   
        //FRONT
        { {-A, A, A}, {0, 0, 1}, {0.25, 0.33} },        // A  A ----- B 
        { {A, A, A}, {0, 0, 1}, {0.5, 0.33}},           // B  |       |  
        { {-A, -A, A}, {0, 0, 1}, {0.25,0.66}},         // C  |       |  
        { {A, -A, A}, {0, 0, 1}, {0.5, 0.66}},          // D  C ----- D
        //BACK
        { {-A, A,-A}, {0, 0, 1}, {0.75, 0.66}},
        { {A, A, -A}, {0, 0, 1}, {1, 0.66}},
        { {-A, -A, -A}, {0, 0, 1}, {0.75, 0.34}},
        { {A, -A, -A}, {0, 0, 1}, {1, 0.34}},
        //EXTRA
        //_______________________________
        { {A, A, -A}, {0, 0, 1}, {1, 0.66}},
        { {A, A, -A}, {0, 0, 1}, {1, 0.66}},
        //_______________________________
        ////RIGHT SIDE
        { {A, -A, A}, {1, 0, 0}, {0.5, 0.33}},
        //EXTRA
        //_______________________________
        { {A, -A, A}, {1, 0, 0}, {0.5, 0.33}},
        { {A, -A, A}, {1, 0, 0}, {0.5, 0.33}},
        //_______________________________
        { {A, A, A}, {1, 0, 0}, {0.75, 0.33}},
        { {A, -A, -A}, {1, 0, 0}, {0.5, 0.66}},
        { {A, A, -A}, {1, 0, 0}, {0.75, 0.66}},
        //EXTRA
        //_______________________________
        { {A, A, -A}, {1, 0, 0}, {0.75, 0.66}},
        { {A, A, -A}, {1, 0, 0}, {0.75, 0.66}},
        //_______________________________
        ////LEFT SIDE
        { {-A, -A, A}, {-1, 0, 0}, {0, 0.33}},
        //EXTRA
        //_______________________________
        { {-A, -A, A}, {-1, 0, 0}, {0, 0.33}},
        { {-A, -A, A}, {-1, 0, 0}, {0, 0.33}},
        //_______________________________
        { {-A, A, A}, {-1, 0, 0}, {0.25, 0.33}},
        { {-A, -A, -A}, {-1, 0, 0}, {0, 0.66}},
        { {-A, A, -A}, {-1, 0, 0}, {0.25, 0.66}},
        //EXTRA
        //_______________________________
        { {-A, A, A}, {-1, 0, 0}, {0.25, 0.66}},
        { {-A, A, A}, {-1, 0, 0}, {0.25, 0.66}},
        //_______________________________ 
        ////BOTTOM
        { {-A, -A, A}, {-1, 0, 0}, {0, 0}},         
        { {A, -A, A}, {-1, 0, 0}, {1, 0}},          
        { {-A, -A, -A}, {-1, 0, 0}, {0, 1}},            
        { {A, -A, -A}, {-1, 0, 0}, {1, 1}},
        ////TOP
        { {-A, A, -A}, {0, 1, 0}, {0, 0}},
        { {A, A, -A}, {0, 1, 0}, {1, 0}},
        { {-A, A, A}, {0, 1, 0}, {0, 1}},
        { {A, A, A}, {0, 1, 0}, {1, 1}},

    };
  
    HRESULT hr = vertex->Initialize(device, sizeof(square), 24, square);
    return !FAILED(hr);
}
```
\$\endgroup\$
2
  • 1
    \$\begingroup\$ What are "mine vertexes"? Please try to use proper spelling to make your post easier to understand. It would also help if you posted screenshots of what you want and what you've actually got. \$\endgroup\$
    – Kevin
    Commented Feb 25 at 6:43
  • \$\begingroup\$ If you can't see your cube because of backface calling, that most likely means your vertices are oriented in such a way that your box renders "Inside out". Do you get any result in your render? \$\endgroup\$ Commented Mar 19 at 17:03

0

You must log in to answer this question.

Browse other questions tagged .