Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragment shader color. #14

Open
Cyraxx13 opened this issue Apr 8, 2015 · 3 comments
Open

Fragment shader color. #14

Cyraxx13 opened this issue Apr 8, 2015 · 3 comments

Comments

@Cyraxx13
Copy link

Cyraxx13 commented Apr 8, 2015

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;

@ViktorPopp
Copy link

Isn't this a bit outdated?

@pengyz
Copy link

pengyz commented Aug 11, 2024 via email

@ViktorPopp
Copy link

Why is this chinese?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants