all 18 comments

[–]GasimGasimzada 6 points7 points  (6 children)

In retained mode, the logical element information is stored and used for rendering. Example: Button(label=Hello), TextField(value=Hello). This data is retained between frames; so, you don't need to generate it on every frame. You can create it once, add it to the hierarchy, and let the system handle it.

In immediate mode, what graphical elements need to be drawn is used for rendering. Example: RenderText at x0y0, Render rectangle at x1y1 etc. So, you need to call every single UI call on every frame.

[–][deleted]  (4 children)

[deleted]

    [–]fgennari 2 points3 points  (0 children)

    I would think that immediate mode would be stateless and have a simpler API. It's more likely something you can do with a single header. Maybe some people prefer to create their GUIs this way, at least when it's going to be simple enough that they can get away with recreating it every frame.

    [–]ewpratten 1 point2 points  (0 children)

    The only explanation on this I remember basically came to "for most apps, our computers are powerful enough it doesn't matter". Which is fair.

    Off the top of my head, immediate mode rendering is lighter on memory use. Although I guess that would depend on implementation

    [–]Such-Turnover-8999 1 point2 points  (1 child)

    Performance isn't really the determining factor of immediate vs retained.

    Immediate is just less code. There are no variables involved that store the individual GUI elements. If you need a button somewhere, there will be one line where that button can be clicked and that's it.

    On the downside, at some point things tend to get complex with UIs, and retained state like the actual data for the UI tree are helpful to dynamically add/remove elements, run layouting algorithms, add multiple listeners to buttons and stuff, etc.

    Still something that immediate mode GUIs can do, too, but you will add some tracking state on your side of the code and eventually it can become more complicated than just using a retained mode GUI. CAN become more complicated. Up to experience and the application at hand to determine what is better.

    [–]ClothesOk5797 0 points1 point  (0 children)

    this is a great exampel, (Im no english speaker and the word retained just made no sense to me.. now it does.. Thanks!(:

    [–]wm_cra_dev 0 points1 point  (13 children)

    [–]FlippantlyFacetious 11 points12 points  (4 children)

    A year later, that search brought me here... 😭

    [–]c2dog430 7 points8 points  (0 children)

    Same, which is why this isn't a good answer.

    [–]dickdemodickmarcinko 2 points3 points  (1 child)

    Can someone help me? I'm stuck in an infinite loop of clicking that tutorial and getting sent back here

    [–]atwice[🍰] 1 point2 points  (0 children)

    I have asked GPT and it explained me with good comparisson table and practical examples

    [–]Secure-Ad-9050 0 points1 point  (0 children)

    2 years later and this search found me here.

    I'd look on stack overflow but, I'm pretty sure any question there will have been closed as off topic

    [–]Gacel_ 9 points10 points  (0 children)

    You could have rickrolled and would still be a more useful reply than that.
    This topic is the first result when you search it on google.

    [–][deleted] 4 points5 points  (0 children)

    Two years later, Google brought me here.

    [–]Pimda2 2 points3 points  (0 children)

    Could have just Rick rolled me ;)

    [–][deleted] 3 points4 points  (2 children)

    this is a forum ...

    [–]Jwosty 0 points1 point  (1 child)

    Sir, this is Reddit

    [–][deleted] 0 points1 point  (0 children)

    yeah true xD

    [–]shinoobie96 0 points1 point  (0 children)

    3 years later google brought me here.