I do not write Rust. I have left c++ cause of the feature creep of the last years that made it even harder to read c++. Reading code is so important. Make language not unfriendly for readers and value the time people put into learning a language. I have seen many c++ programmers leaving cause they feel its an other language now
I always wanted to use docker. Installed it and every time there was a feature i needed not included. Perhaps its because tried to use a technologie not commonly used
I was luck to learn asm on a very simple 8 bit CPU (6502). It had a very limited register set (3) and instruction count. I think if you realy like to dive into the ASM topic try to find a small easy CPU model and use a emulator to run your code
I had hoped for some more basic stuff. I struggle for 2 months now to implement a fast line draw with width for a embeed cpu. It only has a framebuffer no gpu
This book is quite old. I would argue that Realtime Rendering 4th edition is the better book. Bonus points if you pair it with some online resources to get a deeper understanding of the topics (but the textbook contains follow up material for all discussed topics).
"Basic" is a relative term. Modern graphics GPUs do not work the same way memory mapped graphics do, and working with them is different at a fundamental level.
You are probably better off searching for old graphics programming books from the 90s. The code they have likely won't work, the the algorithms should be what you're looking for, and shouldn't be hard to adapt.
No. With the old style you had to draw every pixel, and you'd have to develop primitives for drawing a point, a line, or a triangle. With a GPU you essentially give the GPU a bunch of data and tell it to draw points, lines, or triangles for you. You then create "shaders" which are functions that the GPU calls to ask where to position a vertex, or what color to make a pixel, with some "magic" that passes data between the two. It's best understood by looking at the code for the almighty gradient triangle: https://webgpufundamentals.org/webgpu/lessons/webgpu-inter-s...
It's non-trival though not that hard. Have you asked an LLM?
It depends on your needs
* You can compute a rectangle by expanding a line purpendicular to its direction
The problem with this is you'll get gaps between 2 lines if they are supposed to be connected. You can solve that by trying to connect the corners if the rectangles. Once you do this though you're no longer drawing rectangles. You might have to make a simple triangle rasterizer. Or a scanline rasterizer
* You can "drag a brush". You compute a single line, then at each pixel, draw a sprite/circle/rectangle around that pixel. That's slow because you'll draw every pixel more than once but it will work and might be fast enough
This has the issue with the ends will be different unless your brush is round. If that's ok then it works.
All of these are something you can ask Gemini, ChatGPT, Claude, and they'll spit out an exmaple in the language of your choice.
reply