carlmw/SolariBoard — pull request #6 by grzes (2012-08-13 19:02:34+00:00)
Title: Shader rendering

Hi Carl :)

You probably shouldn't really pull that as I rewrote pretty much everything from scratch.
There probably wasn't much point in doing it, since it was already "fast enough", but I wanted to see if a pure shader version was possible. Turns out it was!

So in that branch there's no animation on the javascript side, only a single timer variable passed to the gpu on each frame draw.

This should be more independent from js performance and quicker (or depending on your gpu hardware - a lot quicker). While quicker maybe wasn't worth it it does allow drawing more characters on screen!

I tried to put in a lot of comments if you want to see how it's done, and of course ask me if something isn't clear! There a subtle motion blur effect which you can switch for a flashier fake one or an even faster simple blur here (src/renderer.js#L102).

The shaders could probably still use some optimization and now that the characters are so small we could do with a smaller chars texture (also making it a power of 2 in size would allow mipmaps and removing a lot of logic from the shader.

The biggest drawback of this thing is that there's not success/failure flaps anymore, but it would probably
be easy to add coloring to the sprites (since they're white to begin with).

I've set up a demo on http://grzes.idl.pl/solari/

I think I need to find a job :)