I'm working on DirectX and I have a function that gives a predefined array of custom vertices, it is
CUSTOMVERTEX* createSampleTriangle()
{
CUSTOMVERTEX verts[] =
{
{320.0f, 50.0f, 0.5f, 1.0f, D3DCOLOR_ARGB (0, 255, 0, 0), },
{250.0f, 400.0f, 0.5f, 1.0f, D3DCOLOR_ARGB (0, 0, 255, 0), },
{50.0f, 400.0f, 0.5f, 1.0f, D3DCOLOR_ARGB (0, 0, 0, 255), }
};
return verts;
}
Now, I pick up the result like this:
CUSTOMVERTEX *v = createSampleTriangle();
but as I do line by line debugging I see only one vertex under v, even though verts shows 3 vertices under it. The program doesn't crash, but then again DirectX just doesn't render when something goes wrong, it just skips the function.
any idea why this happens? Does the function not return a pointer with allocated memory that is after that handled by v?