This is the only change we need to make to the code given in Lesson2b. Altering the
colour component of the vertex, Direct3D takes care of the rest.
//Here we have the vertices for our triangle, followed by those for our square.
//These coordinates are in model space, with 0,0,0 being at their center.
//To show how to blend colours we'll set each of the vertices in the triangle
//to be a different colour.
//To show flat colouring, the square will be drawn blue.
my_vertex g_vertices[] ={
{ 0.0f, 1.0f, 0.0f, 0x00FF0000 }, // x, y, z, color
{ 1.0f, -1.0f, 0.0f, 0x0000FF00 },
{ -1.0f, -1.0f, 0.0f, 0x000000FF },
{ -1.0f, -1.0f, 0.0f, 0x000000FF },
{ -1.0f, 1.0f, 0.0f, 0x000000FF },
{ 1.0f, -1.0f, 0.0f, 0x000000FF },
{ 1.0f, 1.0f, 0.0f, 0x000000FF }
};
|