ImGui.NET icon indicating copy to clipboard operation
ImGui.NET copied to clipboard

Access violation

Open TezzoeR opened this issue 6 years ago • 5 comments

Im using the ImGui.net in vb.net and if i try to draw the imgui i get this error Screenshot_1

TezzoeR avatar Jun 12 '19 13:06 TezzoeR

Hi @TezzoeR, it's likely that you're calling some of the functions out of order. Can you double check that you are doing things the same way that the example project is, for example?

mellinoe avatar Jun 17 '19 19:06 mellinoe

Happened to me when I didn't call the ImGuiRenderer.Update(...) function. Example: this.ImGuiRenderer.Update(1f / 60f, snapshot);

itayronen avatar Aug 07 '19 19:08 itayronen

Getting the same issue when trying to change the font, using sample project:

 private static unsafe void ChangeFont()
{
	var x = ImGui.GetIO();
	var nativeConfig = ImGuiNative.ImFontConfig_ImFontConfig();
	var config = new ImFontConfigPtr(nativeConfig);
	config.SizePixels = 22f;
	config.OversampleH = config.OversampleV = 1;
	config.PixelSnapH = true;
	_segoe = x.Fonts.AddFontFromFileTTF("segoeui.ttf", 22f, config);
	config.Destroy();
}

ChangeFont();


while (_window.Exists)
{
	//...
	_controller.Update(1f / 60f, snapshot); // newFrame called here

	ImGui.PushFont(_segoe);
	SubmitUI();
	ImGui.PopFont();
}

Kein avatar Sep 07 '19 23:09 Kein

Same problem as Kein, I am unable to a font with nearly exactly the same steps.

oxysoft avatar Nov 16 '19 08:11 oxysoft

Using LuaJIT-imgui bindings, after render

	ig.GetIO().Fonts:Clear()
	ig.lib.ImGui_ImplOpenGL3_DestroyFontsTexture()
	local theFONT
	local fnt_cfg = ig.ImFontConfig()
	fnt_cfg.PixelSnapH = true
	--fnt_cfg.OversampleH = 1
	theFONT= ig.GetIO().Fonts:AddFontFromFileTTF(font, fontsize, fnt_cfg,nil) 
	assert(theFONT ~= nil)
	ig.lib.ImGui_ImplOpenGL3_CreateFontsTexture()
	ig.GetIO().FontDefault = theFONT

The part missing above is ig.lib.ImGui_ImplOpenGL3_DestroyFontsTexture() and ig.lib.ImGui_ImplOpenGL3_CreateFontsTexture() Several issues in this repo are related to Font loading!!

All the above described must be done after Render (not between NewFrame and Render)

sonoro1234 avatar Nov 18 '19 09:11 sonoro1234