Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Shader issue with Color transparency  (Read 1496 times)

0 Members and 1 Guest are viewing this topic.

Msonic

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Shader issue with Color transparency
« on: November 16, 2013, 07:46:49 am »
Hi,

I'm having some trouble with shaders and colors. See my StackOverflow question

Basically, when I have a fragment shader active, the Color field the object is not taken in consideration. I don't really know why.

I haven't found anything similar on the forum.

Any help is greatly appreciated!

fallahn

  • Hero Member
  • *****
  • Posts: 507
  • Buns.
    • View Profile
    • Trederia
Re: Shader issue with Color transparency
« Reply #1 on: November 16, 2013, 08:32:58 am »
When you use sprite.setColor() sfml is actually setting the vertex colours of the sprite. If you read the shader tutorial you'll find that by default the vertex colours are passed straight through and are available in fragment shaders via gl_Color. So in your case the transparency value can be found in gl_Color.a
« Last Edit: November 16, 2013, 08:40:57 am by fallahn »

Msonic

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Shader issue with Color transparency
« Reply #2 on: November 18, 2013, 05:11:23 pm »
Hmmm, I see. I'll try this when I get back home.

Thanks for the quick reply!