Reputation: 161
I'm currently writing a program that involves graphics. After some thought I decided to write directly to the frame buffer on /dev/fb0 and the code is working great but the writing speed is slow. It takes 0.161s to write a blank screen (0.213s is the program with the fb0 writing and 0.052s is the program without writing to fb) which means 6fps without any 3d rendering. Is there a way to write faster to a file like the /dev/fb0 on C? I'm currently using fb = freopen("/dev/fb0","w",stdout);
to open the file and the regular printf
to write to the file, also the display is 320x240.
Thanks :)
Upvotes: 2
Views: 2132
Reputation: 15134
You can map the framebuffer device into memory using mmap()
and blit to and from it with memcpy()
or pointers. Unless you are running X windows, in which case you need to go through an API such as X11, OpenGL or SDL.
Upvotes: 2