I saw a post on Buzz with some dude playing around with HTML5's canvas tag. And I noticed he was accessing the pixel data just like I used to do on my 80286's VGA card! AWESOME!
So I quickly coded up some color bars for old times sake.

Neato.
It's kinda lame that Javascript has no means of quickly duplicating arrays of objects, so the only way to handle virtual frames is to use extra canvas objects and push/pull the buffer data to/from them.
Then I went for some classic shade bobs.

Chrome's Javascript interpreter is lightning fast. Unfortunately Firefox's is slower and has mixed behavior depending on versions. For example, some versions of Firefox handle the pixel data as unsigned char's correctly, and incrementing a red value that's 255 will set it to zero. Other versions handle pixel data as integers (even though the allowed range is only 0-255) and decrementing a pixel that is 0 will cause it to become -1. Chrome handles the data as 0-255, but doesn't allow rotational incrementation without using a modulus on it so incrementing a value that's 255 simply stays at 255.
Finally I whipped up some multicolor plasma.

This effect was a lot easier than on MCGA mode 0x13, since we're not limited to 256 colors, but to a full 24 bit pallette (plus another 8bits of alpha channel data). I don't have to combine sine tables in one pixel, just in different color channels.
The only reason I ever learned to program was to make my computer make pretty things. I'm so happy! And since I'm not on a 12.5mhz CPU anymore, I don't have to do things like inline assembler or pre-computed trig tables. JOY!
I got my 286 back! Now to ditch enough work to code up a Mandelbrot roto-zoom...
--
Dave Maez
Helping to code a better tomorrow.
Dave Maez
Helping to code a better tomorrow.
No comments:
Post a Comment