Skip to content

Conversation

@defaultgnome
Copy link
Contributor

To make the viewport_enable ConfigFlag work we should call a updatePlatformWindows and renderPlatformWindowsDefaultper ImGui documentation.

zgui.io.setConfigFlags(.{
    .viewport_enable = true,
});

// ... later in the main loop
{ // Enable Multi-Viewports
    const ctx = glfw.getCurrentContext(); // this is need for opengl3 see https://github.com/ocornut/imgui/blob/docking/examples/example_glfw_opengl3/main.cpp
    zgui.updatePlatformWindows();
    zgui.renderPlatformWindowsDefault();
    glfw.makeContextCurrent(ctx);
}

I tested it on my project that use zopengl and zglfw.

Resolves #29

to make .viewport_enable ConfigFlag work
those functions should be called after draw call of main viewport
Copy link
Member

@hazeycode hazeycode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ❤️

@hazeycode hazeycode merged commit ce43561 into zig-gamedev:main Mar 11, 2025
3 checks passed
ckrowland pushed a commit to ckrowland/zgui that referenced this pull request Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

viewport_enable does not work, missing functions call

2 participants