Magnum::ImGuiIntegration namespace

Integration with Dear ImGui.

Contents

Conversion of math classes and rendering of Dear ImGui using Magnum.

This library depends on Dear ImGui and is built if WITH_IMGUI is enabled when building Magnum Integration. To use this library with CMake, you need to copy FindImGui.cmake from the modules/ directory in Magnum Integration sources to the modules/ dir in your project and pointing CMAKE_MODULE_PATH to it (if not done already) so it is able to correctly find the ImGui library on all platforms. Then request the ImGui component of the MagnumIntegration package and link to the MagnumIntegration::ImGui target:

# Path where FindImGui.cmake can be found, adapt as needed
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH})

find_package(MagnumIntegration REQUIRED ImGui)

# ...
target_link_libraries(your-app MagnumIntegration::ImGui)

Routines for math type conversion are provided in Magnum/ImGuiIntegration/Integration.h, Magnum-based rendering backend for Dear ImGui is in the Context class. See also the ImGui example, Downloading and building integration libraries and Integration library usage with CMake.

Classes

class Context
Dear ImGui context.

Functions

void image(GL::Texture2D& texture, const Vector2& size, const Range2D& uvRange = {{}, Vector2{1.0f}}, const Color4& tintColor = Color4{1.0f}, const Color4& borderColor = {})
Image widget displaying a GL::Texture2D.
auto imageButton(GL::Texture2D& texture, const Vector2& size, const Range2D& uvRange = {{}, Vector2{1.0f}}, Int framePadding = -1, const Color4& backgroundColor = {}, const Color4& tintColor = Color4{1.0f}) -> bool
ImageButton widget displaying a GL::Texture2D.

Function documentation

void Magnum::ImGuiIntegration::image(GL::Texture2D& texture, const Vector2& size, const Range2D& uvRange = {{}, Vector2{1.0f}}, const Color4& tintColor = Color4{1.0f}, const Color4& borderColor = {})

Image widget displaying a GL::Texture2D.

Parameters
texture Texture to display
size Widget size
uvRange UV range on the texture (covers the whole texture by default)
tintColor Tint color, default 0xffffffff_rgbaf
borderColor Border color, default 0x00000000_rgbaf

bool Magnum::ImGuiIntegration::imageButton(GL::Texture2D& texture, const Vector2& size, const Range2D& uvRange = {{}, Vector2{1.0f}}, Int framePadding = -1, const Color4& backgroundColor = {}, const Color4& tintColor = Color4{1.0f})

ImageButton widget displaying a GL::Texture2D.

Parameters
texture Texture to display
size Widget size
uvRange UV range on the texture (covers the whole texture by default)
framePadding Frame padding, negative values use the default frame padding
backgroundColor Background color, default 0x00000000_rgbaf
tintColor Tint color, default 0xffffffff_rgbaf