Skip to content
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

Fix vertex/index buffer offset handling in sample programs, fix modals in XNA #294

Merged
merged 1 commit into from
Mar 17, 2022
Merged

Conversation

oledfish
Copy link
Contributor

Recently the rendering logic in ImGui was modified making it so that the approach of manually calculating idx_offset would produce incorrect results, instead having to rely on the provided IdxOffset property from the draw commands.

This issue is referenced in:

A fix for OpenGL2 is shown in ocornut/imgui#4845 (comment). This also modifies the vertex buffer offset in a similar way, as referenced in #244.

Modal windows don't work in XNA-derived frameworks and will immediately crash the application. This happens because opening a modal window can issue draw commands with an element count of 0, and a check in the DrawIndexedPrimitives function throws an exception in these situations. This is fixed by simply ignoring those commands and continuing to the next one in the list.

This isn't limited to modals, however, as referenced in ocornut/imgui#4857, draw calls from draw lists can cause this to happen as well. The same fix for the Metal backend is used here.

These changes have only been tested in Monogame, but they should work in FNA all the same.

@oledfish oledfish changed the title Fix vertex/buffer offset handling in sample programs, fix modals in XNA Fix vertex/index buffer offset handling in sample programs, fix modals in XNA Jan 18, 2022
@zaafar
Copy link
Collaborator

zaafar commented Jan 19, 2022

zaafar added a commit to zaafar/ClickableTransparentOverlay that referenced this pull request Jan 22, 2022
@mellinoe
Copy link
Collaborator

Looks good, thanks @oledfish !

@mellinoe mellinoe merged commit e416f8c into ImGuiNET:master Mar 17, 2022
Veslo5 added a commit to Veslo5/MonoGame.ImGui.Net6 that referenced this pull request Nov 11, 2022
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.

3 participants