My current renderer draws forms by the position and color of their vertices. It can't handle textures yet.
struct Form
{
unsigned int Positions, Colors, Elements, Program;
};
Now I want to implement the capability of textures. Since there won't be forms without texture but colors in the final game I want to replace the color feature instead of developing a alongside feature.
So the renderer has to draw forms by the position and texture coordinate of their vertices now.
struct Form
{
unsigned int Positions, Coordinates, Elements, Texture, Program;
};
So far, so good. But without the ability to render without texture my application can't draw forms if their image file doesn't exist or can't be loaded for some reason. Therefore I want to implement a fallback to a given solid color (say pink) if the image file can't be loaded.
How can I realize this fallback without completely developing two alongside features? Is there a common approach? I wish that this could be done in a shader. Or maybe I could send a pink texture to the video card and then treat all forms as equal. Sadly I have no idea how to implement that or if is even possible.