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

Author Topic: Combining two or more shaders?  (Read 2134 times)

0 Members and 1 Guest are viewing this topic.

Xorlium

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Combining two or more shaders?
« on: November 24, 2010, 07:14:03 pm »
Hi,

Is it possible to apply two different shaders to the same sprite/image?

Something like App.Draw(Draw(mySprite, shaderA), shaderB); (I know that's not proper c++ notation)

Thanks,
Xorlium

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: Combining two or more shaders?
« Reply #1 on: November 24, 2010, 08:20:25 pm »
Quote from: "Xorlium"
Hi,

Is it possible to apply two different shaders to the same sprite/image?

Something like App.Draw(Draw(mySprite, shaderA), shaderB); (I know that's not proper c++ notation)

Thanks,
Xorlium


Well don't know if it would be the best but you could first draw the sprite to a RenderImage with the first shader and then draw the content of the RenderImage to the originally intended render target with the second shader.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Combining two or more shaders?
« Reply #2 on: November 24, 2010, 08:35:09 pm »
This is indeed the best solution. There's no way to execute more than one shader in the same rendering pass.
Laurent Gomila - SFML developer