Imgui: Channels splitting - How to use it properly?

Created on 7 Jun 2019  路  7Comments  路  Source: ocornut/imgui

Version/Branch of Dear ImGui:

Version: 1.71
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_dx11.cpp + imgui_impl_win32.cpp _(or specify if using a custom engine/back-end)_
Compiler: XXX _(if the question is related to building or platform specific features)_
Operating System: Windows 10 Enterprise 1903 b18343.1

My Issue/Question:

Today I wanted to experiment a bit with ImGui's channel splitting, from what I've read, the main idea is to be able to render out-of-the-order. I am having difficulties with getting it to work. My text disappears after I merge channels when drawing something in between ChannelsSplit/ChannelsMerge calls.

When not drawing anything in between these two calls, everything is fine.

Often when drawing on multiple channels, only channel where the first drawing was made is being "rendered".

Screenshots/Video

image

Standalone, minimal, complete and verifiable example: _(see https://github.com/ocornut/imgui/issues/2261)_

/// Store a pointer to draw list to save a bit of typing
ImDrawList* draw = ImGui::GetForegroundDrawList();

/// That should create 2 channels for out-of-order drawing
draw->ChannelsSplit( 2 );

/// That should be drawn ABOVE the red (below) rectangle
draw->ChannelsSetCurrent( 1 );
draw->AddRectFilled( ImVec2( 20.0f, 20.0f ), ImVec2( 120.0f, 120.0f ), IM_COL32( 255, 255, 0, 255 ) );

/// This should be drawn BEHIND the yellow (above) rectangle
draw->ChannelsSetCurrent( 0 );
draw->AddRectFilled( ImVec2( 0.0f, 0.0f ), ImVec2( 100.0f, 100.0f ), IM_COL32( 255, 0, 0, 255 ) );

/// Merge all channels, which should put these two rectangles above each other
draw->ChannelsMerge();
drawindrawlist

All 7 comments

Please read the Issue contributing guidelines, fill in the requested info and provide the missing details.

I will reopen this once you provided the requested information.

@ocornut I updated my issue, please re-check it.

You didn't specify the version (1.71 is not out yet).
I think you pulled just after I made the change in #2591 which created a bug for 1-2 days. Because right now if I paste your code it works:

image

You didn't specify the version (1.71 is not out yet).
I think you pulled just after I made the change in #2591 which created a bug for 1-2 days. Because right now if I paste your code it works:

image

So that might have been the problem actually? My branch seems to be at commit ed79b4d22ed2b2ef08ab41be918ad1851325d3d9. Let me update the core files.

Yes, ed79b4d22ed2b2ef08ab41be918ad1851325d3d9 is exactly the time where that bug was added. Back luck!

Yes, ed79b4d is exactly the time where that bug was added. Back luck!

Yeah, updating core files actually fixed that, unlucky 馃し鈥嶁檪. Thanks for help!

Good to hear!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mnemode2 picture mnemode2  路  3Comments

bizehao picture bizehao  路  3Comments

SlNPacifist picture SlNPacifist  路  3Comments

KaungZawHtet picture KaungZawHtet  路  3Comments

inflex picture inflex  路  3Comments