Hacker News new | ask | show | jobs
by revvx 2606 days ago
Games (normally) re-render the whole scene every frame.

ImGUI exposes that to their API users: you have to re-render and check for clicks on every frame. The code looks like React, (but not as optimized, it re-renders every frame!), and normally you have to keep state by yourself. Code example: [1].

Retained Mode is closer to the DOM, Cocoa or WPF: you create objects and there's an abstraction between the API and the renderer: they get re-rendered every frame for you. Componentes normally have events and state by themselves. Sometimes there's a visual editor too.

The main difference is the API. One is lower level than the other. In practice, the APIs aren't that different, except when it comes to event handling.

[1] - https://docs.unity3d.com/Manual/gui-Basics.html

1 comments

> Games (normally) re-render the whole scene every frame

They don't re-upload the whole scene to the GPU every frame, they don't recreate objects all the time. Immediate mode was only used in, like, the GL 1.x times.

But I never said they did?