It’s fun experimenting around with ideas that strike you at random times. Someone, somewhere might get some use out of this topic, whereas most of us surely will be at least a bit amused by it. As for me, well, I’d like to make the first post! (And obviously, I did.)
So here’s my experiment for the day:
Fake lighting in 2D games.
I took my 2D OpenGL template (utilizing Guy Perfect’s lovely CometGL class–“an abstraction of normal OpenGL calls,” as he put it) and added a texture to it. The texture, in MS Paint, appears to simply be pure black; however, it is a 32-bit bitmap. My program loads 32-bit bitmap files and treats the reserved bits as alpha, whereas other programs ignore the additional bits. So what I did for the lighting is make a fuzzy, blurry circle shape in Photoshop, saved it as a bitmap, and used a new program I made earlier today to merge that with the 24-bit RGB file. Then in the experiment program, a background is drawn, then a bouncing square, then four barely-transparent black rectangles, and then the new texture. It looks pretty sweet, if you ask me. VB coders, feel free to download the source code. Oh, and by the way, it has sound and some random music whose download location I don’t recall.
EXE
Source code
If the links don’t work, it’s Geocities’ fault, but you should be able to get to the files by pasting the link in your address bar.
Oh, and here’s a screenshot. Note that I was running it through Remote Desktop at the time, so the frame rate it shows is awful compared to what you should get. With my integrated graphics card, I could easily manage >375 frames per second when I removed the limiter. (FPSC = frames per second calculated; FPSD = frames per second drawn. I set it up so that it can’t skip more than one frame at a time even if it’s running really slow.)
Copy-and-paste of a post I made later:
I’ve updated my source code to load a room I made in a hex editor (yeah, I seriously did it by hand–I also made some mistakes, it seems). Also, if anyone looked at or messed with the source code… Change the line “StretchAmnt = 1” to change the size of everything but the window itself.
New links:
EXE
VB6 Source