HaxePunk / post-process

[Deprecated] Post processing using GLSL in HaxePunk
MIT License
13 stars 3 forks source link

Shaders on drawTiles (or individual DisplayObjects) #4

Open jon914 opened 10 years ago

jon914 commented 10 years ago

In a rough sense, what would be involved in supporting shaders on drawTiles()?

Would it require a totally different approach (modifying OpenFL/Lime) or could it somehow be worked into this hands-off approach?

0proto commented 10 years ago

As far as i know move to shaders (GLSL, you mean?) will, first of all, make the openfl flash target broken, because flash should use the different shader approach (AGAL?) via stage3d. So, yes, it involves the global changes in OpenFL. BTW i've seen bunch of projects which were working on it, for instance https://github.com/wighawag/openfl-stage3d.

jon914 commented 10 years ago

I'm fine with this not working on Flash. This would be primarily targeted towards standalone games and mobile to a lesser extent.

MattTuttle commented 10 years ago

As far as I can tell it will require modifications to Lime. See my last response in this topic. http://forum.haxepunk.com/index.php?topic=656.msg2589#msg2589

0proto commented 10 years ago

Actually there are plans for user-programmable shaders in Lime roadmap - https://github.com/openfl/lime/wiki/Roadmap. So, i guess its a matter of time to get our hands dirty with GLSL stuff :)

jon914 commented 10 years ago

@MattTuttle - Thanks for linking to that post.

From what I understand, the issue is that with HaxePunk, you're rendering everything to a single surface, so there's no way today to inject OpenGL calls in between because everything's rendered all in one go. You'd need to "flush" (instruct the game to immediately draw) the batched graphics calls to be able to then capture the image data and apply shaders to them. That makes sense.

Suppose that what I'm doing is based on the DisplayList, using individual Sprites (one per "actor"), but I'm still drawing those Sprites using drawTiles. Does that still require a similar approach? I guess what I really want to know is whether I can somehow "capture" a Sprite's image data in render(), so I can apply a shader to it individually.