Looking at it with a fresh eye I realised why it is done the way it is, so you can mark this closed. (don't code or analize code when you are tired :) )
I've heared that the if(...) is very costly in the fragment shaderand now you have this.
if (fs_in.tid > 0.0)
{
int tid = int(fs_in.tid - 0.5);
texColor = texture(textures[tid], fs_in.uv);
}
color = texColor * intensity;
You should have a static white color as an unsigned int as the default color attribute and if the Sprite is not textured you would change it in the submit method, else it is not needed because you would basically multiply the textured color with 1.
So you could have s'thing like this in the shader instead of the if(...)
Looking at it with a fresh eye I realised why it is done the way it is, so you can mark this closed. (don't code or analize code when you are tired :) )
I've heared that the if(...) is very costly in the fragment shaderand now you have this.
if (fs_in.tid > 0.0) { int tid = int(fs_in.tid - 0.5); texColor = texture(textures[tid], fs_in.uv); } color = texColor * intensity;
You should have a static white color as an unsigned int as the default color attribute and if the Sprite is not textured you would change it in the submit method, else it is not needed because you would basically multiply the textured color with 1.
So you could have s'thing like this in the shader instead of the if(...)
color = fs_in.color * texColor * intensity;