title: Is it worth to create a generic shader for handling objects with and without textures?
body: <p>I have several object to render. Some of them have textures and some of them are transparent.</p>
  
  <p>To achieve transparency, I implemented the depth peeling tecnique.</p>
  
  <p>I was wondering if I could use just a single shader (for each step, init/peel/blen/final) that handles objects with texture and objects without.</p>
  
  <p>My idea was something like that (init):</p>
  
  <pre><code>#version 330
  
  out vec4 outputColor;
  
  in vec2 oUV;
  
  uniform sampler2D texture0;
  uniform int enableTexture;
  
  uniform float alpha;
  
  vec4 ShadeFragment() {
      vec4 color;
      color.rgb = vec3(.4,.85,.0);
      color.a = alpha;
      return color;
  }
  
  void main(void)
  {
      vec4 color = ShadeFragment();
  
      color = (1 - enableTexture) * color + enableTexture * texture(texture0, oUV);
  
      outputColor = vec4(color.rgb * color.a, 1.0 - color.a);
  }
  </code></pre>
  
  <p>If enableTexture is 1 I grab the result from the texture, if it is 0 I dont evaluate it at all. I wrote that in order to avoid branching.</p>
  
  <p>Is it worth/has sense an approach like this?</p>