News for hackers. Stuff that matters.
Re:Graphics Programming Resources by Surac on Wednesday March 04, 2026 @01:24AM (#47243855)
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
Re:Graphics Programming Resources by socalgal2 on Wednesday March 04, 2026 @02:55AM (#47244435)
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.

Re:Graphics Programming Resources by PacificSpecific on Wednesday March 04, 2026 @05:56AM (#47245778)
Those are bad answers. Really bad.
Re:Graphics Programming Resources by socalgal2 on Friday March 06, 2026 @08:20PM (#47283353)
What part of them were bad? And where is your contribution?

Asking Gemini spit out this:

https://godbolt.org/z/fzfnY6r39 - using a brush

https://godbolt.org/z/hdKe1b71P - using triangles for miter support.

Re:Graphics Programming Resources by PacificSpecific on Saturday March 07, 2026 @10:18AM (#47288391)
It's not my responsibility to educate you. Especially if you won't take the time yourself to understand the problem.

I suggest you read through the sibling comments.

Re:Graphics Programming Resources by pjmlp on Wednesday March 04, 2026 @02:05AM (#47244123)
The bible of graphics programming, everything with software rendering,

"Computer Graphics: Principles and Practice"

https://www.informit.com/store/computer-graphics-principles-...

Yeah, it is a steep price as many academia books, maybe you can find it on a library nearby, as its first edition was in 1982.

Re:Graphics Programming Resources by jplusequalt on Wednesday March 04, 2026 @11:31AM (#47249950)
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).
Re:Graphics Programming Resources by pjmlp on Thursday March 05, 2026 @03:23AM (#47259065)
Depends on the edition, the last one is from 2013 uses C# for most of its examples.

It might not be great for 3D rendering algorithms, then again that is the hardware time that WebGL 2.0 and WebGPU are stuck with.

Re:Graphics Programming Resources by jungojango on Wednesday March 04, 2026 @03:30AM (#47244692)
Re:Graphics Programming Resources by abetusk on Wednesday March 04, 2026 @01:34AM (#47243934)
Re:Graphics Programming Resources by xyzsparetimexyz on Wednesday March 04, 2026 @02:49AM (#47244408)
Fast, thick lines, no gpu

Choose 2

Re:Graphics Programming Resources by gmiller123456 on Wednesday March 04, 2026 @11:43AM (#47250132)
"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.

Re:Graphics Programming Resources by avmich on Thursday March 05, 2026 @12:57AM (#47258053)
Fundamentally different? Don't GPUs just speed things up in hardware?
Re:Graphics Programming Resources by gmiller123456 on Sunday March 08, 2026 @10:09AM (#47297458)
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...
Re:Graphics Programming Resources by avmich on Tuesday March 10, 2026 @12:25PM (#47325395)
It's all those parts which, in the absense of GPU, would be done by CPU. No qualitative difference.
Re:Graphics Programming Resources by oumua_don17 on Wednesday March 04, 2026 @06:18PM (#47255379)
Re:Graphics Programming Resources by user____name on Friday March 06, 2026 @05:40PM (#47282104)
There's a Bresenham variant for thick lines. It's a bit hard to wrap your head around.

https://homepages.enterprise.net/murphy/thickline/index.html

http://kt8216.unixcab.org/murphy/index.html