Open
Description
As far as I can understand, SDL_RenderGeometry / SDL_RenderGeometryRaw is supposed to color vertices as a gradient, however in both cases only the last color is used.
Code snippet:
//blue triangle
SDL_Vertex vertex_1 = { {100, 100}, {255, 0, 0, 255}, {1, 1} };
SDL_Vertex vertex_2 = { {200, 100}, {0, 255, 0, 255}, {1, 1} };
SDL_Vertex vertex_3 = { {200, 200}, {0, 0, 255, 255}, {1, 1} }; // <- this color is being used (blue)
SDL_Vertex vertices[] = { vertex_1,vertex_2,vertex_3 };
SDL_RenderGeometry(renderer, NULL, vertices, 3, NULL, 0);
//pink triangle
float xy[6] = { 200, 100, 400, 200, 200, 200 };
SDL_Color colors[3] = {
{255, 0, 0, 255},
{255, 255, 0, 255},
{255, 0, 255, 255} // <- this color is being used (pink)
};
float uv[6] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f };
SDL_RenderGeometryRaw(renderer, NULL, xy, 8, colors, 4, uv, 8, 3, NULL, 1, 1);
Metadata
Metadata
Assignees
Labels
No labels