top | item 24998793

(no title)

ocornut | 5 years ago

> You can feel this persons frustration about all the obscure magic incantations needed to get a simple GUI and some lines on screen.

The vast majority is setting up SDL with a graphics context - anything graphics in C++ land is notoriously tedious, yes - not much of that is in control of Dear ImGui.

If you look at "Plugging Dear ImGui into SDL" there's a total of 14 lines involved in adding Dear ImGui over an existing SDL+OpenGL application, which is the precise target use of Dear Imgui.

Here are the lines:

  // Init
  IMGUI_CHECKVERSION();
  ImGui::CreateContext();
  ImGui::StyleColorsDark();
  ImGui_ImplSDL2_InitForOpenGL(window, gl_context);
  ImGui_ImplOpenGL3_Init(glsl_version.c_str());

  // Event forwarding
  ImGui_ImplSDL2_ProcessEvent(&event);

  // New frame
  ImGui_ImplOpenGL3_NewFrame();
  ImGui_ImplSDL2_NewFrame(window);
  ImGui::NewFrame();

  // Rendering
  ImGui::Render();
  ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());

  // Shutdown
  ImGui_ImplOpenGL3_Shutdown();
  ImGui_ImplSDL2_Shutdown();
  ImGui::DestroyContext();
Everything else is setup that has nothing to do with dear imgui, or excess dear imgui usage demo from that article. I'm not sure it's possible to make it any easier other that adding a wrapper across all back-ends.

Yes, setting up graphics stuff in C++ is not trivial, but that's not Dear ImGui fault.

> Only a masochist would love this - which to be fair, probably describes game developers as a group.

Yes. Game developers are people who can have GTA5 running on a PS3, a console with 256x2 MB of RAM, while web applications displaying a chat frequently use more memory than that. I guess you call it masochist, I call it being efficient and excellent.

https://www.youtube.com/watch?v=d0KJhFMnWRI

discuss

order

No comments yet.