8-bit fun

I decided to go back to school… no not a real school, you know the OLD school. I generally want to attempt to learn graphics programming, eventually leading up to building a 3d graphics engine. Yep you read that right, 3D. But that is a long time coming. Right now it’s back to basics.

With the help of Mr. Stephen Stair, I got a 32 bit buffer working in GDI. This is just to get to the screen, later on all of this should be portable to other api’s and platforms, as it’s going to be all software. Then now that I can write pixels into it, i created some functions to work with a video buffer for a 640×480 window/screen. By create a palette that has 3 seperate r,g,b elements, all I need to do is to reference the color index in the 8-bit buffer, which is then copied to the 32bit buffer. Now all I need to do is use the 8 bit buffer as I would have in dos. Bingo! instant 8 bit palletized graphics.

Here’s a screenshot of it in action. This represents each of the 256 colors in my default palette. I created the palette in code. The only thing that’s really off to me is the “brown” colors (at the bottom), they look more like some screwed up flesh tones. As straight brown is sort of tough to get correct, at least for me. In any case this will do as I progress.

256 colors baby!

While you may not really care, to see it at it’s full size right click and select view image. (I’m using firefox, so it may be different in other browsers).

Keith

Comments are closed.