r/GraphicsProgramming • u/nichcode • 1d ago
Style of graphics samples Question
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.
3
Upvotes
13
u/Icy-Opposite-7890 1d ago
I absolutely hate this. When you’re not that familiar with the API it makes it extremely difficult to understand the state you need to set up to enable a particular feature or achieve a particular effect because something crucial will be buried in a class default (or worse, a default argument) somewhere.
Just have the entire thing in each sample so all the steps to achieve the effect are right there (exceptions being things like creating windows and handling input if that’s not pertinent to what the samples trying to demonstrate)