Fix vertex/index buffer offset handling in sample programs, fix modals in XNA #294
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.