Playing with basic pixel setting in SDL. Changing how the color values iterate produces strange patterns.
In each image, every time a pixel is set the color value (which is to be assigned to the next pixel) increases. The cyclic patterns are made out of the color values changing and rolling over when they over-flow their containers. All the images other than the first two are made by also iterating the actual iteration value applied to the color value each time a pixel is to be set. Different values of what can be considered a kind of "second-order" iteration value result in wildly different patterns.
Click thumbnail gif to see full-size version. They are big files for gifs (~40 mb), however, and may take some time to load completely.
The patterns are best viewed rendered in real-time. Windows Executable Download: waveTV.zip. Up and Down arrows can be used to cycle through the 8 channels. Code also viewable here.
In Channel 0, the color integer is set to i, which increases by 1 every time a pixel is set. Based on its location on the screen, each pixel gets assigned a larger value of i each time it gets revisted (the pixel value increases by 1 in the vertical direction and continues in the next column.) Eventually the value of i get too high for the pixel data structure and the color rolls over into the lower values, which appear to be bluish/darker. The pixel color format for the SDL surface here is the 24-bit RGB888 format. The flash when the whole screen turns from orange/yellow back to bluish happens when the value hits just over 16,700,000—which is about the maximum value for 24 bits. The chunky vertical stripes across the screen happen every time the value has increased by 65,535, which is the maximum value for 16 bits. Hence the first 16 bits of the color integer (B at the lowest and then G) get full and show the spectrum from blue to green. Any values above 65,535 start incrementing the 8 R bits as well, but only once every 65,535 increments—i.e., the end of every chunky vertical stripe shows when the R byte has gone up by 1. As the program sets every single pixel every single draw cycle and increments the color value each time a pixel is set, the entire screen appears to turn redder as the value approaches 16,777,215 (or a color value of 255,255,255 for the final pixel), after which the pixel value returns to 0. This results in a "wave" effect.
Channel 1 is essentially the same as Channel 0 but with a increment of 1000 instead of 1. This changes the behavior of the pattern to something different but still periodic and with appearance of motion.
Channel 2 introduces a new variable j. i is incremented by j every time a pixel is set, while j is incremented by 1. Channel 2 is pretty out-there. The pattern emerges, somehow, from this rule.
Channels 3,4,5,6, and 7 are just like Channel 2 but with different "second-order" increment values for j.
Channel Rules:
Channel 0 rule: i = i + 1
Channel 1 rule: i = i + 1000
Channel 2 rule: i = i + j, j = j + 1
Channel 3 rule: i = i + j, j = j + 1500
Channel 4 rule: i = i + j, j = j + 88
Channel 5 rule: i = i + j, j = j + 2800
Channel 6 rule: i = i + j, j = j + 3232
Channel 7 rule: i = i + j, j = j + 6464