Settings

Theme

500 Lines or Less A 3D Modeller

aosabook.org

103 points by myth_drannon · 22 comments

Reader

8 threads
forgotpwd16

The entire "Architecture of Open Source Applications" is amazing, and among those "500 Lines or Less" is imo the most enjoyable. Many, that can perhaps be considered fundamental (e.g. databases, crawler, etc), projects from plan to implementation, Most in Python, but also CLisp, Clojure, JS, Julia.

omoikane

The code appears to be here (about ~903 lines):

https://github.com/aosabook/500lines/tree/master/modeller/co...

  • mathisfun123

    "one bite everyone knows the rules"

    • drsalt

      is that a saying? what does it mean

      • mathisfun123

        Just Google it you'll see

        • drsalt

          i duckduckgo'd it and nothing came up

          • mathisfun123

            Just Google it you'll see

          • 7bees

            Not sure why the other guy is trying to be so cute about this, but I gather:

            * It's a catch-phrase related to a guy from Barstool Sports that reviews pizza places, on a YouTube channel called One Bite Pizza Reviews

            * The idea is that you take one bite and review the pizza, and this is a "rule"

            * The catch-phrase is used ironically; you may say it and then take multiple bites

            * The guy you're replying to apparently thinks this is similar to "500 lines or less" being more than 500 lines, but can't just say this with words

            https://www.reddit.com/r/barstoolsports/comments/6szlym/one_...

            • mathisfun123

              > Not sure why the other guy is trying to be so cute

              I'm not trying to be cute, I'm trying to remind people in 2026 that we have the technology to answer dumbass questions on your own.

knollimar

Using a big library like OpenGL and then playing code golf seems at ends. Cool writeup but these always confuse me

  • yorwba

    The point of the "500 lines" book is to make programs small enough to be understood: https://aosabook.org/en/500L/introduction.html

    It's not about golfing as much functionality as possible into those lines, at the cost of rendering it incomprehensible.

  • forgotpwd16

    There isn't much attempt at code golf really, and OpenGL is a standard graphics API. Plus project is a 3D modeller, not renderer.

  • ablob

    so printf("%i", 42) is fine and dandy golfing, but glTriangle(x, y, z) is too much? The next thing you're gonna tell me is that a true golfer manually invokes syscalls.

  • swiftcoder

    OpenGL has a tiny API surface compared to the other 3D APIs. Of course, that means it has a painfully complicated state machine hiding under the hood...

jasonjmcghee

Another great read is Daniel Hooper’s write up on his SDF 3D modeler ShapeUp.

https://news.ycombinator.com/item?id=40239164

It’s about 2k lines and was built in a week… but it uses raylib which is a fundamentally different task, but i still find it interesting.

Krei-se

Beware brave traveler, this great read will make you think oh that's not so hard!

In the jungle of 3000+ lines spaghetti renderer-code you will be tangled in RenderTargets and concatenated ShaderCode with your boots in quicksands of BindGroups.

Only the noble get to see the light after fixing their struct alignment traps!! 10/10 though, can recommend to get caught up

  • vconnor

    You didn’t even read the article to notice they went for old-style fixed function OpenGL, you know, the one that doesn’t have shader or bind groups or render targets?

    What is the point of your sarcastic comment then?

nnevatie

Is this released in 2026? It looks like it came from 20 years ago, to be quite honest.

bentt

We must preserve pages and projects like this. In 5 years this will look like hand editing x86 ASM to most programmers.

italiansolider

Based legacy Open-GL enjoyer.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection