A minimal example of a screensaver program that can be used by xscreensaver. Utilizes GLX, xlib and vroot.h by Andreas Stolcke to set up root window, then blinks colours in a loop via OpenGL calls. Rest is up to you.
Blog post:
https://dbeef.lol/2018/12/26/writing-x11-screensaver-with-c-opengl/