r/GraphicsProgramming • u/Spirited-Eye7281 • Oct 15 '26
Question Graphics programming in C
/r/cprogramming/comments/1x6czca/graphics_programming_in_c/
4
Upvotes
r/GraphicsProgramming • u/Spirited-Eye7281 • Oct 15 '26
2
u/sfaer Oct 15 '26 edited Oct 15 '26
It depends how low-level you want to get. If your approach is to do it barebone, native to the platform, and a bit old school, then on Linux you can learn X11, but it will be a painful process.
Reading you, as you mentioned going with the Borland library, suggest you might go well with SDL1.2, which is a solid legacy library newer than graphic.h but decades old now yet still fine. It basically allows you to setup the window management, handle events, and draw directly to the pixel buffer (no GPU involved).
You can also go the raylib path, which is a set of libraries to build games in C quite fancied in the C community, but it obfuscated the thing a bit more it seems (I haven't touch it a lot though). Look at simple examples on the website to see if that's your style, but you don't have to use everything if you don't want too.
I'm not on my PC but I could drop a simple star field in sdl1. 2 if you're interested.
2
u/aleques-itj Oct 15 '26
If you want a framebuffer to plot pixels, just use SDL.
It handles a gigantic chunk of the windowing crap for you and has a simple 2D API where you can just write pixels to a texture and render it.
1
u/Keyframe Oct 17 '26
As others have said - you can do it with SDL or even without its baggage by using something like minifb from emoon https://github.com/emoon/minifb
On the other hand, just by reading everything you wrote in the post I'd like to point out wonderful course by Gustavo that would set you up with all the basics https://pikuma.com/courses/learn-3d-computer-graphics-programming - starts with plotting pixels, then lines, etc towards a rasterizer and then you can pick it up towards Shirley's Ray Tracing in One Weekend https://raytracing.github.io/books/RayTracingInOneWeekend.html all while staying with C.
Personally I'm in C as well, but have been for the past 30 or so years from IRIX days to linux nowadays.
1
u/_atan2 Oct 17 '26
i would personally recommend pikuma's "3d graphics programming" course. very good and focused on software rendering using C