How can I apply shader for all screen? #2551
-
I need to apply a shader to the game screen and manipulate with the screen somehow. Like I tried to do so, but it didn't work ...
class SomeShader extends FlxShader {
@:glFragmentSource(...)
public function new() { super(); }
}
class Main extends Sprite
{
public function new()
{
super();
var game = new FlxGame(0, 0, PlayState);
game.shader = new SomeShader();
addChild(game);
}
} Advance thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
RichardBray
May 9, 2022
Replies: 1 comment 1 reply
-
Something like this: import openfl.filters.ShaderFilter;
...
class SomeShader extends FlxShader {
@:glFragmentSource(...)
public function new() { super(); }
}
class Main extends Sprite
{
public function new()
{
super();
var game = new FlxGame(0, 0, PlayState);
addChild(game);
}
}
class PlayState {
...
override function create() {
var shader = new SomeShader();
FlxG.camera.setFilters([new ShaderFilter(cast shader)]);
}
} I think there might be more in the source code of this demo -> https://haxeflixel.com/demos/BlendModeShaders/ |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
bogdan-ov
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Something like this:
I think there might be more in the source code of this demo -> https://haxeflixel.com/demos/BlendModeShaders/