Open TezzoeR opened 5 years ago
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?
Happened to me when I didn't call the ImGuiRenderer.Update(...)
function. Example: this.ImGuiRenderer.Update(1f / 60f, snapshot);
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();
}
Same problem as Kein, I am unable to a font with nearly exactly the same steps.
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)
Im using the ImGui.net in vb.net and if i try to draw the imgui i get this error