- Jun 15, 2001
- 35,382
- 2,501
- 126
Hey all.
I'm trying to make a triangle with random vertices appear on the screen using DX8.1 It's just an exercise, so please don't give me other ways to make triangles. I need it to work with this function.
Anyway, it works well if I do something like this:
-
CUSTOMVERTEX triangleVertices[] =
{
{320.0f, 120.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(x,y,z),},
{420.0f, 320.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(z,y,x),},
{12.0f, 320.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(y,x,z),},
};
-
However, it draws nothing if I do this:
-
CUSTOMVERTEX triangleVertices[] =
{
{320.0f, 120.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(x,y,z),},
{420.0f, 320.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(z,y,x),},
{e, 320.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(y,x,z),},
};
-
Where e is a float, given a random value between 0 and 1289.0.
What am I doing incorrectly?
I'm trying to make a triangle with random vertices appear on the screen using DX8.1 It's just an exercise, so please don't give me other ways to make triangles. I need it to work with this function.
Anyway, it works well if I do something like this:
-
CUSTOMVERTEX triangleVertices[] =
{
{320.0f, 120.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(x,y,z),},
{420.0f, 320.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(z,y,x),},
{12.0f, 320.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(y,x,z),},
};
-
However, it draws nothing if I do this:
-
CUSTOMVERTEX triangleVertices[] =
{
{320.0f, 120.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(x,y,z),},
{420.0f, 320.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(z,y,x),},
{e, 320.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(y,x,z),},
};
-
Where e is a float, given a random value between 0 and 1289.0.
What am I doing incorrectly?
