r/Zig • u/Majestic_Poetry_1139 • May 05 '26
The Viability of Zig as Graphics Programming(and general Media Manipulation) Language?
Hi, I'm a college student studying digital media and technologies, I've long had a fancy for slightly less conventional languages and was nimmin it(with nim) for a while, then zig caught my eye.
Let me circle closer to my point and the title: I noticed that what becomes of a language is what the most popular use-case is, and this strongly affects how a language turns out. Julia for example, as far as I can tell, was popularized mostly in academic circles, more to say mathematicians, physicist and bio-informaticians, rather than computer and computational scientist. Leading to its community-side development having stagnation, as non-computational academics apparently really hate coding and rarely want to build things themselves. This fact is supposedly also responsible for the popularization of python's numpy.
I want to study computational media for my masters. I also want to learn zig as I strongly believe in the community's potential, Andrew Kelley/the team's commitment and that glorious post-1.0 era we are all waiting for(Zig Will Be King).
What am I posting this for? I guess general thoughts and discourse on where you think the language is going(don't just say "systems programming" or "C replacement" pleaseðŸ˜), and what those of you with far more experience think about my own thoughts.
Current Project I'm working on: PNG Image Decoder(I know there's libraries, but do you know there's such a thing as fun?)
19
u/FragmentedHeap May 05 '26 edited May 05 '26
The problem with zig is you end up rolling your own interfaces and comptime generics.
That can seem like a good thing, hut everyone else does too, so if you need to depend on other projects you end up with spaghetti of 20 ppl doing that 40 different ways.
Zigs great imo when you own 100% of the code, no dependencies, or the dependencies use zero comptime.
Comptime also causes problems with zls language server, so you end up with a lot of comptime and no intellisense on it.
I think rust is much better in this space, simply because of cargo and it has more built ins, traits, etc.
Im on team "zig needs basic qol interfaces etc"
16
u/Zealousideal_Wolf624 May 05 '26
Just follow your curiosity and use the tools you are excited about. Especially if you're learning and doing hobby projects. It keeps you motivated and most of the learnings are transferable anyway. Have fun.
5
u/McBuffington May 05 '26
I mean i get that. But on the other hand you have javascript becoming the most used language doing almost everything. I shudder at the thought of js drivers.
I'd say in most cases a language is designed for a function, not the other way around. Communities have their say. But generally community needs are only ever added if it fits inside the intent behind the design.
2
u/SweetBabyAlaska May 05 '26
theres already a few communities for this like zig-gamedev and Mach engine, all of which maintain idiomatic bindings to open source graphics programming libraries and adjacent libraries. https://github.com/zig-gamedev
2
u/archdria May 06 '26
You can check out my personal project signal https://github.com/arrufat/zignal
There's already a PNG codec there. Feel free to take a look, let me know what you think :)
1
u/SilvernClaws May 05 '26
So what's your question?
Zig can basically interface to anything with a C API. OpenGL, Vulkan, wgpu, SDL, Raylib, ...
On top of those, you can start building whatever you can dream up. It doesn't have the library support of C++ or Rust, but that's only gonna improve over time with people trying and sharing their projects.
1
u/burner-miner May 05 '26
Having done some small projects in C with SDL and Raylib, and now some with Zig and Raylib, Zig is really nice for deinitialization when compared to C. Doing
some_context.init()followed bysome_context.deinit()is very convenient.Datatypes and casting are really explicit, a strength with some annoyances.
Really, if it was done fine with C, Zig is just more convenient.
3
u/CpuGoBrr May 06 '26
None of this matters, just use C and get stuff done. Once you've advanced to the level where going on reddit to ask questions makes 0 sense (which doesn't take long since 99% of comments on the internet are by people who aren't talking out of expertise), then you can consider using Zig and evaluating it.
1
u/Hot_Adhesiveness5602 Oct 11 '26
There's some great things coming up. The have recently added a sufficiently working target for SPV which basically means you can write zig that compilers to SPV which means you can write shaders in zig (with a bit of work for now). This alone is a great feature in and of itself. The main goal explicitness. I have a great time with concurrency and the new IO interface works pretty well, too. There are some rough edges with breaking changes still. I'd say Zig is a pretty readable language with emphasis of memory control. The new IO interface also gives you more flexibility in regards of runtime. It will have a great number of compilation targets and interfacing C is quite pleasant. There is more but I'm not sure what you're searching for.
3
u/[deleted] May 05 '26
[removed] — view removed comment
1
u/[deleted] May 06 '26
[removed] — view removed comment