Valerius Petrini's
I write about programming topics that interest me, like graphics, low-level systems, and web development.
If you've ever worked in a C codebase, you've probably been frustrated with the lack of tooling that is available to you, especially compared to more modern languages like TypeScript. The truth is, C does have capable tooling support, but they aren't as well-known as other tools are, and most don't come automatically out of the box. This article aims to show you how to set up three C tools to improve code quality and your editor experience: clangd, clang-tidy, and cppcheck.Read More
In `OpenGL`, you're bound to come across normals, which are vectors that define how light reflects off of an object. Normals are usually defined per-vertex or per-face in 3D models, but **normal maps** are used to simulate small details on surfaces by giving each *pixel* a normal vector. While normal maps are commonly used in graphics applications like `OpenGL`, the details behind how it works is often hidden behind shader logic that transforms the normal vectors from texture space to the coordinate space for lighting calculations. This article aims to explain what normals are, how they are calculated, and how normal maps are generated.Read More
When starting up a new `C++` project, you might run a command using your compiler like `g++ main.cpp -o main` to compile your program into an executable. However, as your project grows and includes more source files, libraries, and dependencies, managing compilation from the command line can become tedious and prone to errors.Read More
If you've ever wanted to build your own **shell** (the program that lets you interact with your operating system using commands like `git`, `ls`, or `node`) in Linux using C, you'll quickly come across the function `fork()`. In Linux, `fork()` is what allows a shell to create new processes for the commands you run. It's how shells can execute programs without freezing or crashing themselves, and it's the foundation of multitasking in Unix systems.Read More
Over the past year I've been working on my own programming language, *Jakarta*, a compiled language that I needed to build a compiler for. If you're unfamiliar with compilers, think of them as the thing that converts your programming language's code (in this case `.jak` files) into machine code that your computer can then run.Read More