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

Added colour uniform to flat shader (even when texturing is enabled) #34

Merged
merged 1 commit into from Dec 14, 2013

Conversation

Projects
None yet
2 participants
@miguelmartin75
Contributor

miguelmartin75 commented Dec 14, 2013

This allows blending to be done (with the texture and colour).

It is quite useful as with this you can change the transparency of an object quite simply*. Also, this allows re-colouring of textures to be done. e.g. if you made a coin image for your game, and wish to have different types of coins without having to re-create assets, you could just re-colour them.

*it might be wise to actually have this as a separate uniform, with the color attribute only having RGB values.


Basically a duplicate of #33, except I:

  • Added default colour to be white (with OpenGL ES it calls setColor, and on desktop it is set in the shader)
  • Updated the fork to be of the same commit you have (although I basically re-made a fork instead of updating it, oopsies, my bad there)
Added colour uniform to flat shader (event when texturing is enabled)
This enables blending and transparency
Default colour is white (and fully opaque)

@mosra mosra merged commit 0670f59 into mosra:master Dec 14, 2013

@mosra

This comment has been minimized.

Show comment
Hide comment
@mosra

mosra Dec 14, 2013

Owner

Excellent!

I don't know about performance implications when having separate uniform for RGB and alpha. It should not be an issue with ARB_enhanced_layouts, which is part of GL 4.4, but on older/mobile systems vec3 + float might not be as fast as single vec4 uniform. I'll keep it this way.

Thank you very much.

Owner

mosra commented Dec 14, 2013

Excellent!

I don't know about performance implications when having separate uniform for RGB and alpha. It should not be an issue with ARB_enhanced_layouts, which is part of GL 4.4, but on older/mobile systems vec3 + float might not be as fast as single vec4 uniform. I'll keep it this way.

Thank you very much.

@mosra mosra added this to the 2014.01 milestone Feb 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment