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

Author Topic: How do i modify the alpha of a textured vertex entity sf::Quad?  (Read 5026 times)

0 Members and 1 Guest are viewing this topic.

nathanmyersc

  • Newbie
  • *
  • Posts: 11
    • View Profile
How do i modify the alpha of a textured vertex entity sf::Quad?
« on: October 07, 2021, 02:09:21 pm »
How do i make it so the vertex color is only applied to non 0 alpha pixels?
Because when i have the vertex quad textured and i want to fade it out.
I modify all the vertex's color parameter for alpha. But this makes all the pixels
within the quad the same alpha. regardless if some where transparent in the first place.
How do i solve this?
« Last Edit: October 07, 2021, 07:39:26 pm by nathanmyersc »

fallahn

  • Hero Member
  • *****
  • Posts: 507
  • Buns.
    • View Profile
    • Trederia
Re: How do i modify the alpha of a textured vertex entity sf::Quad?
« Reply #1 on: October 09, 2021, 11:28:17 am »
This should actually behave as you expect - the vertex colours are multiplied (after being normalised) with the texture colours. So a vertex alpha of 0.5 (127) should make a texture colour alpha 0.5 (if it started  as 1 aka 255), 0.25 if it was 0.5 and so on. If the alpha of the texture is already 0 it should remain so (0 * 0.5 == 0).

Are you using the correct blend mode, which should be sf::BlendAlpha?

Sharing some of your code might also help