How to keep texture when changing color effect.

stevepetoskeystevepetoskey Posts: 3Member

So when ever I change color using:
Func fragment() {
COLOR = vec4(1.0,0,0,0);
}
It gets rid of the texture that the sprite had, is there any way to make it add a color effect instead of set the color?


Tags :

Best Answer

  • SIsilicon28SIsilicon28 Posts: 715
    Accepted Answer

    Yes.

    COLOR = texture(TEXTURE, SCREEN_UV) * vec4(1.0, 0, 0, 1.0);
    

    The reason why you only see a solid color is because you're only assigning a constant color to it.

Answers

  • SIsilicon28SIsilicon28 Posts: 715Moderator
    Accepted Answer

    Yes.

    COLOR = texture(TEXTURE, SCREEN_UV) * vec4(1.0, 0, 0, 1.0);
    

    The reason why you only see a solid color is because you're only assigning a constant color to it.

  • stevepetoskeystevepetoskey Posts: 3Member

    Thank you

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file