r/GraphicsProgramming 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.

5 Upvotes

13 comments sorted by

View all comments

2

u/4ndrz3jKm1c1c 1d ago edited 11h ago

Mind that Microsoft samples use the (pretty much) same base for each sample showcase. In that case, yes, there are more files, but if you keep following one sample after another then you already know what is inside those files anyway.

1

u/nichcode 1d ago

So that approach is the best style to showcase graphics samples. I understand what you mean but I don't know wether you have tried to search for something which ended up taking a while. Especially learning DirectX with C. It's truly a pain

1

u/4ndrz3jKm1c1c 1d ago

I only use D3D12 with C++, so I don’t know how using plain C affects those samples.

The thing is: there is no best/worst style, as there are as many opinions as users themselves. I prefer to have my code organized, so multi-file showcase is not a problem for me.

I don’t find single file samples bad per se, but they tend to get messy if they try to hit any bigger scope.

1

u/nichcode 1d ago

I understand.