8 ms·
Note to authors: please define your terms when you first use them, or provide links to the definitions. Of course I know what a GUI is. I've been building them
by Stratoscope 8y ago
Note to authors: please define your terms when you first use them, or provide links to the definitions.
Of course I know what a GUI is. I've been building them for decades, and building tools that other developers have used to build GUIs. (I was one of the authors of the "visual" part of Visual Basic.)
But I have never before seen the terms "immediate mode GUI" or "retained mode GUI". And I'm pretty sure there are many developers like me who will have no idea what you're talking about. It takes only a moment to add a quick definition or a link the first time you mention a specialized term, and your readers will definitely appreciate it. Thanks!
(Edited to remove fluff and make the essential point more clear.)
- kyberias 8y agoI first learned about those terms in early DirectX releases (circa 1998). Are there some earlier usages?
- cmroanirgo 8y agoIt's where it first came to prominence. The earliest D3D api was immediate mode (meaning, bare metal, talking directly via an api to the hardware). Retained mode is about retaining statefulness and some better abstractions to the underlying needs of the hardware (eg automatic texture resampling, etc). Considering it's an NVidia guy talking: he's been around for a while.
- pavlov 8y agoA minor detail, but the very first version of Direct3D was a retained mode API. In 1995 Microsoft acquired a company called RenderMorphics and turned their Reality Lab [1] API into "Direct3D". The first two versions to ship from Microsoft had both retained and immediate mode APIs, but they dropped the RenderMorphics-based API due to lack of adoption. [1] https://en.wikipedia.org/wiki/Reality_Lab https://en.wikipedia.org/wiki/Reality_Lab
- Stratoscope 8y agoInteresting, thanks! That would explain why I and probably many other readers, who have built plenty of GUIs but have not worked specifically with APIs like DirectX, would not be familiar with the term.
- rzzzt 8y agoYou probably won't be surprised that OpenGL's classic programming mode is also called immediate mode :) glBegin(GL_TRIANGLES); glVertex3f(...); glVertex3f(...); glVertex3f(...); glEnd();
- taneq 8y agoRetained Mode Direct3D is the first and only place I've really heard that term used. After D3D stopped offering Retained Mode I haven't heard anyone use it except for a couple of articles about "immediate mode GUIs". Last time I saw one of those I had to look it up.
- tellak 8y agoThe terms are in common use since the 80s at least (no, Microsoft did not invent these terms with D3D). You can prove this in google scholar. In fact for 3D rendering, retained mode was touted as a the new way forward, there was even a standard predating OpenGL called PHIGS, a retained mode system.. OpenGL was the worse is better (also PHIGS had many limitations basically limiting its use to CAD) backlash promoting its immediate mode in the early 90s.
- tlrobinson 8y agoOn the other hand, it also only takes a moment to look up immediate mode and retained mode on Wikipedia.
- Stratoscope 8y agoYes, of course that is true. It doesn't change the fact that it is considered a common courtesy, and a sign of quality writing, to define any unusual terms like this when you first mention them. It's the same principle as writing readable, self explanatory code. You write your article once, but you hope that many thousands of of people, with all different levels of experience, will read it. If you can take a few minutes to save thousands of readers a minute or two each, that is a big win. If you really want to do it right, you can link to those Wikipedia articles when you introduce the terms. After all, your reader may be on a mobile device on the bus, where it is easier to tap a link than to copy and paste or retype the term to find out what it means.
- kkarakk 8y agowould've taken the author a moment to link to those exact terms too. it takes away from the flow of the article...
- majewsky 8y agoThis is something that you do while editing, not while you're writing the initial draft. (Here's hoping that everyone actually edits their blog post before posting.)
- MikeTheGreat 8y agoI agree that it's important for people to be independent about locating and ingesting information. I also think that it's good to include a quick definition, particularly for stuff that's really specific (indeed - while looking for a definition I found a blog post that starts with "If you don't already know what Immediate Mode GUIs are then please stop now"). I did a Google search but there weren't any clear definitions on the first page or so. I did search for the Wikipedia article and here's what I got: "Immediate Mode GUI is a GUI where the event processing is directly controlled by the user. The key is the aspect of retained (RMGUI) vs non-retained UI (IMGUI). In the latter, the user code is holding on its own natural data, in the former it is stored in the GUI system, often hidden from the user code. The immediate mode GUI widget toolkits are more direct and thus less complex, thus they are a good choice for those who want a simple but easily changeable and extendable GUI toolkit, they are usually generic, open source and cross-platform. The original Immediate Mode GUI toolkit was imgui[1] which is based on OpenGL. The idea was popularized by Casey Muratori. There are others such as nuklear[2] with backends for several graphics libraries, kiss_sdl[3] for SDL (Simple DirectMedia Layer) or dear imgui[4] written in C++ (here the jvm port[5])." First, the quality of this writing isn't great, to the point where it makes it harder to read. I think that the above definition makes sense if you already know what Immediate Mode is, but it was pretty opaque on my first read (partly because I misunderstood "user" in the first sentence to mean "the customer sitting in front of the computer and using your IMGUI program", instead of "other code that uses the IMGUI"). The definition now makes sense to me after reading other posts here explaining that this was a Direct3D thing. So yeah - I can see the arguments that we're not the target audience (and I understand that the person who posted this to HN probably isn't the author), but I think that Stratoscope's point that articles posted to the general HN audience would benefit from short, clear definitions (or links to definitions) in the articles is spot-on. Also, props to Stratoscope for their calm, constructive replies in the face of a lot of disagreement! If we all did this (and I include myself here for sure) the Internet would be a better place.
- chii 8y agoimmediate mode and retained mode are technical jargons sure, but this article is written with a technical audience in mind. It's not like the author has invented the term, nor are the terms used here esoteric at all. Defining it just adds noise tbh.
- Stratoscope 8y agoIf an author thinks that defining something inline will add clutter, the simple solution is to link the term to an article that defines it. We may be a technical audience here on HN, but I wager that the vast majority of HN readers have never heard these terms before, just as I never had. Based on what kyberias said in a sibling comment, it sounds like these terms will be familiar to those who have written DirectX and perhaps other GPU code, but for the rest of us they are esoteric terms. It is so easy to add a link when you first mention a term like this. Why not do that?
- chii 8y agoadding a link is very different to adding a definition. The web is made of links, and linking to the wikipedia article (or other sources) is not only recommended, but encouraged.
- jakobegger 8y agoThe article goes on to explain the difference between immediate mode and retained mode in detail after the first example. A link would just distract the reader (the reader would then leave the site to learn about the terms, then come back, only to have them explained again).
- JetSetWilly 8y agoWhy are you assuming that HN is the intended audience? Just because some random person posted the article here does not mean you are the intended audience of the author. It seems quite presumptious to criticise on that basis.
- Stratoscope 8y ago
- westoncb 8y agoDo you know who his intended audience is? Just because his article got posted here doesn't mean he was writing it for the general HN audience. Most likely he's writing it for an audience that knows very well the difference between immediate/retained modes. I mean, he's writing it on a blog that's all about graphics programming, game engines, etc. So it would be a bad move for him to define terms common to that field in every article. Given that, this critique is misplaced.
- vinceguidry 8y agoI remember an article on the woodworking technique of riving that made it to HN front page, the comments took the author to task for implying riving was invented by Vikings because the article was written for Viking enthusiasts on a Viking enthusiast website. Like, c'mon guys.
- tgb 8y agoI don't know, he actually spends half the article explaining the difference between the two. It's just not clear he's going to do that until you get that far. So I think it's strange to suggest that his audience already knows the difference.
- vardump 8y agoWell, if you didn't know about other libraries, such as ImGui previously, you're not really in the target audience. The terminology he uses is in common use.
- ncr100 8y agoGoogle is your friend: http://lmgtfy.com/?q=immediate+mode+gui http://lmgtfy.com/?q=immediate+mode+gui
- jakobegger 8y agoIf you read beyond the first paragraph, you'd learn what the author means by those terms. The article starts with an example, and then goes on to explain the difference between immediate mode GUI and retained mode GUI is. It is well written and easy to understand article. What you are asking for is a TLDR at the top of the article. Sure, that would be nice, but on the other hand I don't see anything wrong with writing a blog post that requires reading more than 50 words to fully understand the topic.
- Stratoscope 8y ago> If you read beyond the first paragraph, you'd learn what the author means by those terms. Ha, you got me there! (I know the HN guidelines recommend to not suggest that someone hasn't read the article, but in this case I'm fair game.) When I first skimmed the article, I only had a few minutes between tasks at home, so I didn't catch all the details. But since my initial comment stirred up some controversy, I figured I'd better take a closer read. (Well, still kind of halfway skimming since it is getting rather late here.) In the next to the last paragraph was the clue that made it connect for me: "The OnGUI of Unity Engine actually uses IMGUI mode." Aha! So this "immediate mode GUI" business is like OnGUI? Where you draw everything from scratch on every frame, instead of the engine remembering stuff for you? That's when it all made sense, since I had done a bunch of Unity work 4-5 years ago and some of it involved OnGUI(). 60654's comment led me to the current OnGUI documentation [1], where they even call it "Immediate Mode GUI (IMGUI)". I'm pretty sure they didn't use the IMGUI terminology when I was working in Unity, it was just OnGui() with no other special name. Otherwise I would have remembered "immediate mode". But it's possible that my memory is not as good as I hope it is! https://docs.unity3d.com/Manual/GUIScriptingGuide.html https://docs.unity3d.com/Manual/GUIScriptingGuide.html
- opan 8y agoAgreed. Better to bore people with brief review than alienate a wider audience. I've had people say to me "I know that" angrily when I'm mid-explanation of a concept, but it's better to be thorough. This habit comes in handy in forums or in a room with more than two people. In both scenarios, lurkers/eavesdroppers then get background info and don't walk away misinformed.
- sbr464 8y agoI didn’t know also, but typing immediate mode.. basically autofills and shows the resulting definition on an iPhone without evening pressing enter. At this point I’m not sure which is more tiring, the lack of an intro/definition, or the expected top comment about the omission. I think, as professionals we can be less hard on each other, especially since we are all too aware of the difficulty in taking time out to write a blog/article.
- Stratoscope 8y agoThat's a fair comment, and you are definitely right about the difficulty of finding time to write a blog post! Please understand that I was not intending to be hard on the author or criticize them. I am offering some writing advice that I hope could be useful for anyone writing technical articles like this. Of course that may just be arrogance on my part. ;-)
- deleted 8y ago[deleted]
- tokyodude 8y agoWhat a rude comment. It's not a specialized term. It's a common term. Immediate mode GUI as a concept is well known. Tens of thousands of programmers use Immediate Mode GUIs. There are several well known Immediate Mode GUI libraries used by tens of thousands of projects. When I don't know a term I google it. I don't assume the entire world revolves around me and that it's the author job to make their article more verbose because everyone reading it might not know every term. Here's are galleries of some from one of the more popular libraries https://github.com/ocornut/imgui/issues/2265 https://github.com/ocornut/imgui/issues/2265 https://github.com/ocornut/imgui/issues/1902 https://github.com/ocornut/imgui/issues/1902 https://github.com/ocornut/imgui/issues/1607 https://github.com/ocornut/imgui/issues/1607 https://github.com/ocornut/imgui/issues/1269 https://github.com/ocornut/imgui/issues/1269
- Stratoscope 8y agoWhoa, thanks for those links. This image from the 2265 issue is especially pretty: https://user-images.githubusercontent.com/16171743/50758310-1f231a80-1262-11e9-8065-3199292ff9f1.jpg https://user-images.githubusercontent.com/16171743/50758310-... p.s. I did get a chuckle from your deleted comment that suggested I was living in a cave. After the heat wave we've had here the last couple of days, I wish I were living in a nice cool cave! ;-)
- cbm-vic-20 8y agoWow. That looks a lot like the EVE Online UI: http://i.imgur.com/EM12xXZ.png http://i.imgur.com/EM12xXZ.png
- donaltroddyn 8y agoI don't think it's rude at all. I did Google "immediate mode GUI" after reading the first paragraph, because I also didn't know what it meant. The first three results were a Wikipedia snippet which didn't help my understanding at all, a Gist that begins with "Before you continue, if you don't know what IMGUI is don't bother reading this", and then third result was this HN comments section. I would argue that "immediate mode GUI" is an extremely specialised term.
- chrisseaton 8y ago> I was one of the authors of the "visual" part of Visual Basic. You must have understood the difference between the VB shape control and the VB drawing commands then, if you wrote these things? The shape controls were retained and the drawing commands immediate. You could move the shape controls around, but not the drawn shapes after they've been drawn. The double buffer option on forms (can’t remember the name) was a workaround for a limitation of the immediate drawing commands, where they disappeared when the window was covered and revealed. Even the Win32 API documentation uses the terms https://docs.microsoft.com/en-us/windows/desktop/learnwin32/retained-mode-versus-immediate-mode https://docs.microsoft.com/en-us/windows/desktop/learnwin32/.... Presumably you used that documentation to build VB? What term did you use back then if not immediate and retained?
- Stratoscope 8y agoAh, my friend, are you seriously quizzing me on code I wrote 30 years ago and haven't revisited since? But you ask an honest question, so I will give you an honest answer: I have no clue! We didn't have any terminology like immediate or retained. What we did have was the early Windows API with update regions and WM_PAINT. There was no desktop compositing, so if a window was partially or fully covered and then uncovered, the newly-uncovered area would be invalidated and the window proc would receive a WM_PAINT message to notify it to repaint that area. Could that be related to what you're referring to? I should explain that our team didn't write all of the "visual" part of VB. We built a product called Ruby (no relation to the programming language) that was originally going to be a user-customizable desktop for Windows 3.0, replacing ProgMan and FileMan. After we turned it over to Microsoft, they decided to combine Ruby with Basic to make a full programming environment, and of course they made many changes and additions along the way. There are many fun stories I could tell from that era, like the true origin of the term "fire an event", but I'm afraid none of them will involve immediate or retained mode GUIs... :-) Update after seeing your subsequent edit: > Even the Win32 API documentation uses the terms https://docs.microsoft.com/en-us/windows/desktop/learnwin32/retained-mode-versus-immediate-mode https://docs.microsoft.com/en-us/windows/desktop/learnwin32/... Presumably you used that documentation to build VB? (and from the link) > Graphics APIs can be divided into retained-mode APIs and immediate-mode APIs. Direct2D is an immediate-mode API. Windows Presentation Foundation (WPF) is an example of a retained-mode API. No, we did not use that documentation. There was no such thing as Win32 at the time, and certainly no Direct2D or WPF. How could we have used Win32 docs? We were just 16-bit Windows programmers, we weren't time travelers!
- coldtea 8y ago>But I have never before seen the terms "immediate mode GUI" or "retained mode GUI". And I'm pretty sure there are many developers like me who will have no idea what you're talking about. Well, developers who write their own GUI toolkits (what the article is about), probably know retained vs immediate mode. Those are two very basic distinctions when it comes to GUIs. Retained mode is the average GUI toolkit you probably know (Swing, GTK, Cocoa, etc). Immediate mode is where the GUI is draw directly frame by frame by the application. In retained mode you deal with buttons, windows, panels, checkbox objects, textboxes, etc, arranged in a tree-like structure. In immediate mode you deal with painting commands (of course you usually will abstract them to a higher level too). You want a button? You draw a square and the label in it, and depending on the user input (e.g. clicking at the moment or not), you might draw it depressed.
- mpweiher 8y ago> Retained mode is the average GUI toolkit you probably know (Swing, GTK, Cocoa, etc) Not quite. Certainly Cocoa, and probably the others as well, are mixed mode. An NSView has a drawRect:: method that draws that particular view in "immediate mode", with drawing commands of the underlying procedural graphics API (essentially Quartz/CoreGraphics). If you want pure immediate mode, you create a single NSView and just draw everything. If you want pure retained mode, you exclusively use predefined widgets, which hide the "immediate mode" drawing that they do. Or you mix and match as you see fit.
- coldtea 8y ago>An NSView has a drawRect:: method that draws that particular view in "immediate mode", with drawing commands of the underlying procedural graphics API (essentially Quartz/CoreGraphics). Yes, but that's the case for almost all retained mode GUI toolkits (they provide something akin to that), and it's used as a last resort (when you need a custom look or to implement your own widget, or complicated UI for something like plotting or a piano keyboard, etc). Regular use of the APIs in Cocoa (and what all books advice) is retained mode style, using pre-made widgets with the Interface Builder and so on. Not "drawRect".
- jbverschoor 8y agoPlease use this comment on __projects__. Which fail to include a proper readme or exaplainer instead of a blog article geared towards gfx/game programming
- ncr100 8y agoWhy not Google the term, it's a term of art and widely used.
- specialist 8y agoI also had no idea what "immediate mode GUI" meant. Granted, it's been while since I've done any non-browser UI work. Browsing the Dear ImGui project, it looks pretty cool. https://github.com/ocornut/imgui/wiki https://github.com/ocornut/imgui/wiki From the hip, I'd say one big difference is the API for modals is blocking (waiting for user input), vs callback. That's pretty cool. I don't yet know how non-modal is handled. Edit: Ah, it looks like return values are also wired up directly, vs the indirection of an event model or listeners. Clever. -- At this time, I don't think comparisons (in this thread) to OpenGL's immediate ("interactive") vs retained ("batched") modes are relevant.