Skip to content

dwiggles/POV

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

POV

This is a simple Win32 project created for a YouTube video to illustrate an interesting persistence of vision effect that I first came across when messing around with simple graphics on a BBC micro back in the 80s. Repeatedly drawing random white lines on a black background in XOR (exlcusive OR) mode results in new lines appearing on a random field of black and white pixels. Although this means that the lines don't show up as lines, your eyes and brain still detect the switching of a line of pixels from one state to the other as a line appearing, just for a fraction of a second.

I wanted to mimic the big, crisp pixels of an old 8-bit computer with a low-resolution display. I tried it in Javascript and then in a UWP Windows app, but it wasn't easy to get the effect I wanted (or perhaps I just didn't find the right technique).

In Win32, it's easy - I just create a low-resolution off-screen display context (DC), draw my lines etc on that and then copy it to the main window of the app using StretchBlt which does exactly what I wanted - a perfectly enlarged copy of the smaller bitmap with perfectly crisp edges to all the enlarged pixels.

When the app starts, nothing happens. Press L to draw a single random line or M to press multiple (10) lines. Press S to start the animation of the bouncing line and the cube. Press C to toggle the cube and N to toggle the line. Press E to toggle whether the background is erased on each new frame of the animation. Press R to reset everything (stop the animation and clear the screen).

About

Draws old-school 8-bit style pixel graphics. For a YouTube video.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 73.4%
  • C# 20.8%
  • C 5.8%