Skip to content

How can I apply shader for all screen? #2551

Answered by RichardBray
bogdan-ov asked this question in Q&A
Discussion options

You must be logged in to vote

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/

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bogdan-ov
Comment options

Answer selected by bogdan-ov
# for free to join this conversation on GitHub. Already have an account? # to comment
Category
Q&A
Labels
None yet
2 participants