-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modal does not render correctly when using multiple begin
#36
Comments
Thanks for reporting. I will check. |
Applied the following fix (chapter 15, ImDrawData imDrawData = ImGui.getDrawData();
int numCmdLists = imDrawData.getCmdListsCount();
int offsetIdx = 0;
int offsetVtx = 0;
for (int i = 0; i < numCmdLists; i++) {
int cmdBufferSize = imDrawData.getCmdListCmdBufferSize(i);
for (int j = 0; j < cmdBufferSize; j++) {
imDrawData.getCmdListCmdBufferClipRect(i, j, imVec4);
rect.offset(it -> it.x((int) Math.max(imVec4.x, 0)).y((int) Math.max(imVec4.y, 1)));
rect.extent(it -> it.width((int) (imVec4.z - imVec4.x)).height((int) (imVec4.w - imVec4.y)));
vkCmdSetScissor(cmdHandle, 0, rect);
int numElements = imDrawData.getCmdListCmdBufferElemCount(i, j);
vkCmdDrawIndexed(cmdHandle, numElements, 1,
offsetIdx + imDrawData.getCmdListCmdBufferIdxOffset(i, j),
offsetVtx + imDrawData.getCmdListCmdBufferVtxOffset(i, j), 0);
}
offsetIdx += imDrawData.getCmdListIdxBufferSize(i);
offsetVtx += imDrawData.getCmdListVtxBufferSize(i);
} It sees that modal popups are shown ok. However, when showing a model window, a transparency is applied to the whole render area, any idea if this is normal? |
Off the top of my head that looks correct. Can you post a screenshot of what you are seeing. I have a 9 hour layover in Anchorage later today 😭 and will have lots of time to look at it. (Yes, that is 9 hours of being stuck in the airport...) |
Yep, that looks correct for what a popup modal should do (graying out the background). Is there some other behavior you were expecting, or something that does not look correct? |
Nope. Not sure if graying out the background was correct or not. Ok, Fixed then. I will review the text and update next chapters. Thanks! |
Describe the bug
When using multiple windows, i.e.
ImGui.begin...
the offsets for rendering are incorrect and cause modals to not have the correct background, the background faded color becomes the windows foreground.To Reproduce
Chapter 15, create multiple ImGui windows in the gui render.
Create a popup modal.
Expected behavior
The popup modal should render correctly.
See ocornut/imgui#4845 for more information.
I have a modified snippet from a vulkan test rendering engine I wrote that shows a working implementation using imgui offsets from the render data, I have modified it to be similar to the implementation here for ease of implementation.
The text was updated successfully, but these errors were encountered: