Bad Apple!! but it runs on your screen
- 5 Devlogs
- 14 Total hours
Not only a new version of the Bad Apple videoclip but a complete real-time shader-powered postprocessing layer with builtin video decoding for Linux!
Not only a new version of the Bad Apple videoclip but a complete real-time shader-powered postprocessing layer with builtin video decoding for Linux!
the video is published on youtube!!!!!
Check it out: https://youtu.be/a1_1RXaRt74. Please go like it so it get viral!
I’ve improved the performance by only collecting each window information’s only when they are marked as changed, this improved performance so much that i was able to run some games while using it
Added a simple command line argument parser for quick settings and path changes
Ive also added some cool C math optimizations like approximating a division by 255 with a cool bit shift trick! (i felt like a genius programmer)
There’s a couple things that still run in the CPU that could be pretty much moved to the GPU if they cause a bottle neck, maybe in the future??
Need to make sure that new/closed or resized windows are accounted and properly updated, this is the next step, ive tried already but this adds a lot of lag and i didnt like how it was looking, but maybe now ill try again!
PD: PLEASE
go watch the final version: https://youtu.be/a1_1RXaRt74
Btw, im probably gonna be shipping shortly, maybe after next devlog?
This is the first decent version! I still need to fix a couple things but finally using your computer with this on wont give you an epileptic attack. Note that what you see in the video is very simple, this program i made is a lot more powerful (this is not only for bad apple videos but a general postprocessing realtime layer on your screen!!)
Completely moved the project from GLFW to SDL3!
Fixed the feeding loop bug: refactored the capturer so instead of taking a screenshot every frame it now loops with X11’s backend through all the windows and reconstructs the screen buffer manually (this took a lot of docs reading time), the result is really good but has limitations that i will list below
Appart from the effect you see, ive also coded 2 other shaders that also use this video
Published the github repo and added both a license and a readme file
This only works on Linux with X11 backend, if you use wayland, windows or mac this should not work at all, adding support to new platforms would be interesting, but before i need to fix the next issue
The current system that reads all windows and stitches them together to form a screen buffer doesnt take into consideration new or closed windows and doesnt update their position or resizing… this will probably be the next thing to do but ill have to check how the performances doing.
Of course i will be making a video for youtube to showcase this, this was the main goal of the project either way lmao
the demo video contains flashing colors!! 
Huge progress!!!!! i made this work finally! well not quite yet but ive finally have something to show you
Theres still some issues you can clearly see but i do know why this is happening
In order to get the screen buffer i need to use X11 (currently, maybe ill port it to use other different APIs) which means that this is pretty much like taking a screenshot every frame but very fast because its the GPU. The problem is that we are re-feeding the previous output to the new one, so it breaks the original colors over time
X11 based system to retrieve the screen’s image and pass it to the shader as another texture!
Performance was improved a bit although it generally doesnt really matter (maybe it will when using videos over 1080p, havent tried tho)
Fixed A SINGLE memory leak, woops
Port the project to SDL3, i always start my projects with GLFW and always forget how much i dislike GLFW, it has so many tools and features missing that SDL has, so ill probably port it to it, it shouldnt be very hard
I’ve been adding the basic OpenGL implementations for a very simple texture and shader “classes” (theres no such thing as a class in C of course). This works kind of like a refresher course for me as I already though I was proficent enough with opengl, maybe once i ship this i might try to re do this but using vulkan
instead.
The shader class, which reads the glsl source files (not pre-compiled) and compiles them in real time, not very fancy right now
A texture class that updates in real time to what frame was given by the video section, correctly set to linear color correction and uses rgb24
Now i will add a super simple quad implementation where the shader will render to, on top of the screen buffer
I dont think that OpenGL can get the screen buffer with the pixel colors of whats behind the screen, even when the glfw window is entirely transparent, I’ll do some more research to see what to do
I’ve thought that this program might actually be a lot more useful that what im currently making it look. In the end you can quickly change the glsl shader to have completely different results and also upload any kind of video you want…
PD: the window you see in the video is green just so you can see it at all, but in the final version it will be completely transparent
Hey!!!
I’m making this quick project that i though would be fun to try and have a bit of a rest from my main project, and i think it started nicely!
I’m making one of those fun version for the original Bad Apple! music videoclip that got viral long ago (original: https://www.youtube.com/watch?v=FtutLA63Cp8). I want it to be very original, at least I dont think it has been done already…
I cant really tell you what the video is about yet, but I can tell you that im building it with pure C and openGL…
Project setup: create a basic cmake project that uses glad and glfw to create a special window and render basic stuff on top of it
Added a video reader that gets each frame of the video at the correct time based on the time elapsed
I started this project making it run in CUDA, but I had a better idea. Then i decided to go with the graphics programming route: i thought about using vulkan but its way too hard to setup for such a small project, even worse considering im using C, not C++. I will have to learn vulkan at some point tho
note: the video is the base for the whole program