Shader with and without texture

Actually for disabling textures in my fragment shader, I add this line before calculations:


if (tex_color.xyz == vec3 (.0,.0,.0))
   tex_color = vec4 (1.,1.,1.,1.);

But, of course, this is very bad and this produces the normal lighting wherever the texture fragments are all black.

I could have a lot of geometry where some of them have textures and some others don’t. And I would like not to sort them regarding they have texture or not. And in another side, switching shaders too often might not be a good idea.

How do you manage textures in your shaders ? If you sort your geometry regarding texture, why, since it can break the depth sort, and other sorts. What do you suggest me to do ?

Thanks in advance.

You could try binding a 1 * 1 pixel White texture by default unless your objects bind their own texture. That way you can use a single shaded without the fudge you are currently employing.

This looks interresting. I’ll have a look at this.

Thanks.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.