Open antim0118 opened 6 months ago
I did some investigation. This bug happens after calling SDL_RenderFillRect. It looks normal when I call SDL_RenderGeometry before SDL_RenderFillRect.
Also, I cannot apply textures, it also break the colors.
Code snippet:
SDL_Vertex vertex_0 = { {100, 100}, {255, 0, 0, 255}, {1, 1} };
SDL_Vertex vertex_1 = { {200, 100}, {0, 255, 0, 255}, {1, 1} };
SDL_Vertex vertex_2 = { {200, 200}, {0, 0, 255, 255}, {1, 1} };
SDL_Vertex vertex_3 = { {100, 200}, {0, 0, 255, 255}, {1, 1} };
SDL_Vertex vertices[] = { vertex_0,vertex_1,vertex_2,vertex_3 };
int indices[] = { 0, 1, 2, 2, 3, 0 };
SDL_RenderGeometry(renderer, mTexture, vertices, 4, indices, 6);
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:
Result: