I'm making a model class that is using Assimp in the background. I want my models' meshes to be able to have a material and an optional texture on top of that.
Right now I'm doing it like this: for each mesh, I store postion, normal, and texCoord for each vertex in that mesh. If the mesh doesn't have a texture, I just add vec2(0.0, 0.0) to the texCoord-array. I needed to add blank values for the meshes that doesn't have textures so the offset for the meshes that has textures would be correct.
At first I thought this would work. To draw the meshes I use the same shader-program for both the meshes without textures and the ones with textures. But since no texture will be bound when I render the ones without textures, it will sample tex-colors from nothing (?), and flickering occurs.
So my question is, what would be a good way to solve this? Is it possible to have two shader-programs and switch between them depending on if the model has a texture?