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

Author Topic: Multi pass drawing  (Read 1303 times)

0 Members and 1 Guest are viewing this topic.

Visor

  • Newbie
  • *
  • Posts: 21
    • View Profile
Multi pass drawing
« on: April 14, 2017, 05:01:50 pm »
Hello,

I'm trying to do a multi pass drawing (e.g environment, character, particles), but I can't figure out how to draw sf::RenderTexture to another sf::RenderTexture with a sf::Blend style.

I guess my logic is wrong... How should I draw my drawables to multiples buffers with transparent background, and then draw all this buffers to a sf::RenderTexture with blend style ?

I actually draw all my drawables to the related sf::RenderTexture, and then try to combine all thoses render texture with blend style in one to apply a shader on it.
« Last Edit: April 14, 2017, 05:12:57 pm by Bloo »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
Re: Multi pass drawing
« Reply #1 on: April 14, 2017, 11:21:14 pm »
You use a sprite (or a quad), get the texture reference from the render texture that you want to draw, pass it to the sprite (or quad) and render it to the other render texture.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Visor

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Multi pass drawing
« Reply #2 on: April 15, 2017, 11:07:44 pm »
Yes, it works !
In my case there are too much render to texture, and draw them to another one is really too expensive in resources (it's starting lagging).

Thank you !
« Last Edit: April 16, 2017, 01:07:49 am by Bloo »

 

anything