Skip to content

Instantly share code, notes, and snippets.

@DubThink
Created July 14, 2022 09:19
Show Gist options
  • Save DubThink/5b2666776ae587ea0d8ae46c6ca72972 to your computer and use it in GitHub Desktop.
Save DubThink/5b2666776ae587ea0d8ae46c6ca72972 to your computer and use it in GitHub Desktop.
Repros Monogame.Imgui.Renderer crash from imgui generating empty draw commands
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Monogame.Imgui.Renderer;
using ImGuiNET;
public class TestImguiCrash : Game
{
private GraphicsDeviceManager _graphics;
private ImGuiRenderer _imGUIRenderer;
public TestImguiCrash()
{
_graphics = new GraphicsDeviceManager(this);
IsMouseVisible = true;
Window.AllowUserResizing = true;
}
protected override void Initialize()
{
_imGUIRenderer = new ImGuiRenderer(this);
_imGUIRenderer.RebuildFontAtlas();
}
protected override void Draw(GameTime gameTime)
{
_graphics.GraphicsDevice.Clear(Color.Coral);
_imGUIRenderer.BeforeLayout(gameTime);
ImGui.ShowDemoWindow();
_imGUIRenderer.AfterLayout();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment