r/GraphicsProgramming • u/nichcode • Aug 23 '26
Question Style of graphics samples
Hey everyone,
I have been wondering which way is the best to showcase graphics samples. DirectX samples write their samples which calls functions and helper functions from multiple files. this approach is easy to write and extend but it makes reading the code hard. Yes most editors and IDEs help but it's still hard to seen everything at one place.
The second style is to accept some level of code duplication to make the code very easy to read and follow. I like this approach when learning a new API.
What style do you guys prefer and why.
View all comments
Show parent comment
1
u/corysama Aug 24 '26
I'm doing exactly this in a tutorial series I'm working on. Here's a preview of the first chapter: https://rentry.org/5abeqt6s
To make the docs, I write C++ programs with
/*** Block comments containing markdown ***/Then, I janked together a tiny python web server that watches my C++ source code directory. Whenever I save a file, it regexes the C++ to flip-flop the markdown blocks and the code blocks to convert the C++-containing-markdown into markdown-containing-C++. Then it serves up the markdown with https://casual-effects.com/markdeep/ injected to convert that to HTML. So, C++ to web page with hot-reloading :)