I have a function like the following:
void Direct3DRenderer::CreatePrimitive(char *name, Direct3DHelper::VERTEX vertices[])
{
LPDIRECT3DVERTEXBUFFER9 vertex_buf;
d3d_dev->CreateVertexBuffer(4 * sizeof(Direct3DHelper::VERTEX), 0, Direct3DHelper::FVF, D3DPOOL_MANAGED, &vertex_buf, NULL);
VOID *pVoid;
vertex_buf->Lock(0, 0, (void**)&pVoid, 0);
memcpy(pVoid, vertices, sizeof(vertices));
vertex_buf->Unlock();
primitiveMap[name] = vertex_buf;
}
For some reason that sizeof(vertices) is not giving me the right value, or something. This is what I'm inputting:
Direct3DHelper::VERTEX verticesA[] =
{
{ 0, 0, 0, 1, D3DCOLOR_XRGB(255, 0, 0) },
{ 10, 0, 0, 1, D3DCOLOR_XRGB(0, 255, 0) },
{ 0, 10, 0, 1, D3DCOLOR_XRGB(255, 255, 0) },
{ 10, 10, 0, 1, D3DCOLOR_XRGB(0, 0, 255) }
};
If I don't pass it into the function and just replace all the "vertices" with "verticesA," it works... Please help.