3 ms·
One that's fun from a historical point of view was my hack for fixing palette flash. Back in the early 90s PC graphics cards typically had a "palette" of 256 co
by raylad 4y ago
One that's fun from a historical point of view was my hack for fixing palette flash. Back in the early 90s PC graphics cards typically had a "palette" of 256 colors at one time, selected from a possible 256K colors.
In theory this gave you a lot of options, but in practice, switching palettes tended to cause "palette flash" where the previous image changed color in a distracting flash.
I was doing a multimedia project that had video in it, and each CODEC had its own built in palette -- one for Cinepak, one for Indeo, etc. Then there were other palettes for the images. If you wanted to display video in a window on a page that had other graphics, you could determine the palette of the CODEC (with some effort) and then use that to dither your graphics. Theoretically they should play nice together, and it worked on some cards, but you'd still get palette flash on other mainstream graphics cards.
I tried every trick I could think of but could not eliminate the flash on every single card until I came up with this hack:
Make a video consisting of a single frame with a 1x1 black pixel, compressed in the desired CODEC, display a black screen for a moment, play that video (which was as fast as could be because it was so tiny) over the screen, then load your image and real video.
The black screen couldn't flash, and when the next screen and video (the real one we wanted to play) came up, the palette was already set correctly. And it worked on every video card.
- smcameron 4y agoOh, this reminds me of something I once did, but sort of backwards. I was working on a little hobby space game, and there was a star field. I wanted a hyperspace warp effect, like in Star Wars, so I coded something up. But there was a problem. The "stars" in the hyperspace effect were different than the "stars" in the star field. So when you engaged hyperspace, it looked like all the stars kind of "jumped", changing positions immediately before the hyperspace effect began. I "fixed" this by inserting a single frame of all white to flash the screen, and this somehow prevented people from noticing that the stars jumped.