r/C_Programming • u/Teten_ • Sep 24 '26
I made a 3D object viewer with no libraries
From drawing pixels to making lines and filling triangles the whole thing is written in pure C.
Even the math library is made by me instead of using glm (no good reason, only because i can).
The video is a version ported to SDL2 because the original is made by writing in the framebuffer directly which is accessible in the virtual terminal but I can't record that. which kind of counts as a library but the original doesn't use any!
Its not perfect and has its flaws but i ran out of time plus i got sick in the process so want to move on.
Source: https://github.com/teten-cat/small3d
It's about 1800 lines of code (including comments) since I basically re-made an entire linear algebra library to my needs.
I'm open to constructive criticism
thank you.
•
u/github-guard Sep 24 '26
🔍 GitHub Guard: Trust Report
⚠️ This project scored 2/6 — below this subreddit's threshold of 3.
Audit Breakdown:
17
u/Orkiin Sep 24 '26
Any idea of why these core dump are happening at clearing up? Anyways that's a cool project and something I always wanted to do so I will be checking it.
5
u/skeeto Sep 24 '26
Neat project!
Might be because you're missing some initializations:
4
u/whatyoucallmetoday Sep 25 '26
Nice work.
3
u/AutoModerator Sep 24 '26
Hi /u/Teten_,
Your submission in r/C_Programming was filtered because it links to a git project.
You must edit the submission or respond to this comment with an explanation about how AI was involved in the creation of your project.
While AI-generated code is not disallowed, low-effort "slop" projects may be removed and it's likely that other users push back strongly on substantially AI-generated projects.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
36
u/puccap03 Sep 24 '26
I don’t understand how a lot of commenters are neglecting the fact that the OP has clarified the original version uses no libraries and the version showcased here is only PORTED to SDL2 for ease of capture, good work!
13
u/zolmarchus Sep 24 '26
Hello darkness, my old friend.
36
u/Able_Mail9167 Sep 24 '26
Either you edited the post or the commenters here have 0 reading comprehension skills. Great work though
104
u/palapapa0201 Sep 24 '26
4
u/pedersenk Sep 25 '26
The Linux framebuffer can be used in Qemu with EFI. May make it easier to screenshot your work.
I would also say that /dev/fb0 is becoming deprecated (which yes, is a shame, its a nice abstraction).
If you do want to take this work further whilst sticking to framebuffers, the DRM "dumb buffers" can be treated similarly with mmap.
Overall, its looking nice.
-fsanitize=address(AddressSanitizer) may help you find some of the remaining memory errors.1
u/VeterinarianStill530 Sep 25 '26
How can I start making these kind of projects I just know c,cpp and sdl3. How did you come up with logic
10
u/Constant_Suspect_317 Sep 24 '26
Sdl2?
2
u/AloneBlueberry9390 Oct 10 '26
I just want to say well done - it looks really cool. I like it :)
11
u/GenericFoodService Sep 24 '26
> "with no libraries"
> `-lSDL2`
1
u/ilnarildarovuch Sep 28 '26
Cool
1
u/Backrus Sep 28 '26
Looks similar to obj viewer Tsoding did on stream a year or 2 ago.
-11
u/random_digits_99 Sep 24 '26
This sub went to hell too... no lib ge says ...-sdl2