Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 1.83 KB

README.md

File metadata and controls

14 lines (10 loc) · 1.83 KB

Using ImGui in a DirectX 11 Geometric Tools Engine window

This repository contains Microsoft Visual Studio 2022 code for a library wich provides a (somewhat) convenient interface for using ImGui 1.87 in a DirectX11 window created by Geometric Tools Engine version 6.3. It also includes an example usage, specifically the BlendedTerrainWindow3 demo from GTE:

image

Using the ImGuiGTE library in an existing GTE window mainly involves these changes:

  1. Instead of calling TheWindowSystem.MessagePump to handle the Windows message loop, use ImGuiMessagePump with the same arguments (or make the equivalent changes if you have your own custom message loop).
  2. Instead of deriving your GTE window class from gte::Window3, derive from ImGuiWindow3.
  3. When rendering your GTE window (done in BlendedTerrainWindow3::OnIdle in this example), add your ImGui window by calling StartImGuiFrame() after clearing your render buffers, issuing the ImGui commands for your UI, then call RenderImGui() before calling mEngine->DisplayColorBuffer().

There are a couple of issues that should be addressed before using any of this code in a real project:

  1. Several files included in the ImGuiGTE library are copied directly from the ImGui examples and backend directories. There is probably a better way to structure this.
  2. The paths to the GTE library projects are hard-coded in the solution to D:\GeometricTools\GTE (where they were located on my machine). You will need to manually add the GTE library projects to your own solution and update the references to them in your project.