Textured Cube - a newbie question
Hi there,
The question is very simple: I want to draw a cube with 6 different textures on 6 surfaces of the cube, what is the "proper" way to design the fragment shader?
My initial thought is that: using a flag in the fragment shader, for example,
uniform int surface;
main () {
if (surface == 0) // front surface, for example
{
vec4 texColor0 = texture(frontTexture, TexCoord);
.............
}
if (surfac == 1) // back surface
{...............
}
..............
}
and when draw the cube, the 6 surfaces will be drawn separately with proper value of "surface" passed to fragment shader.
However, I do not like this idea, and wondering any other proper ways to do this??
Thanks.