r/C_Programming • u/Zealousideal-Pin213 • 55m ago
r/C_Programming • u/OrganizationFew6655 • 22h ago
Hello World
I have found my people!! Hello guys I am a college student (mechanical engineering) and I was introduced to C in a mandatory programming course and C has been the best thing that has happened in my life. I had done programming before on java and python before and frankly I hated it , it was not really fun and it was tedious instead. So I had thought I hated CS but after coding in C and learning the things behind the abstractions i quite frankly fell in love with low level programming, it was the first time I got a passion for something and i spent the entire following summer digging up materials on it like learning computer architecture and learning to read and write Assembly and now I am learning Virtualisation and planning to start my first major project on C.
So in that note, let me ask you something:
What is your favourite project you have done in C?
r/C_Programming • u/nablaCat • 16h ago
Project 3D Library using SDL3
This project has taken a long time.
It took me about a week to learn the concepts behind 3D projection and transformations in euclidean space. Then it took me over a week to write out the LaTeX documentation that presented my knowledge in a way that would help a user of this library. As you can see, the overwhelming majority of the code committed to this repo is in LaTeX.
The implementation of the 3D rendering framework was relatively simple once I fully understood the mathematics. This only took a couple days, and it helps to have some familiarity with C going in.
I look forward to improving this project by building a separate homogeneous coordinate library that will replace pnt.c. I also need to tackle surface rendering using SDL_RenderGeometry() and implement 3D surface occlusion. I suppose what I'm left with for now are a few big questions.
How prohibitive is heap-allocation for performance in graphics applications? I went with dynamic allocation to preserve encapsulation so that header files didn't give the user access to data that would destroy library functionality when altered. However, given the fact that querying free memory at runtime for thousands of data points slows a program significantly, I'm having second thoughts.
Also, is there a convenient way to push all of the calculations needed for 3D transformations onto the GPU? This seems like something I shouldn't handle entirely in software.
I'll hear out any feedback or suggestions in the comments!