Examples: DirectX9: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects(). FreeType: Fixed suggested code to not require an initial build call.. (#2454)
diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt
index 5193b8b..e3b717d 100644
--- a/docs/CHANGELOG.txt
+++ b/docs/CHANGELOG.txt
@@ -44,6 +44,7 @@
- Examples: OpenGL: Added a dummy GL call + comments in ImGui_ImplOpenGL3_Init() to detect uninitialized
GL function loaders early, and help users understand what they are missing. (#2421)
- Examples: OpenGL3: Minor tweaks + not calling glBindBuffer more than necessary in the render loop.
+- Examples: DirectX9: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects(). (#2454)
- Examples: FreeGLUT: Made io.DeltaTime always > 0. (#2430)
diff --git a/examples/imgui_impl_dx9.cpp b/examples/imgui_impl_dx9.cpp
index c0b9c74..566ea4c 100644
--- a/examples/imgui_impl_dx9.cpp
+++ b/examples/imgui_impl_dx9.cpp
@@ -10,6 +10,7 @@
// CHANGELOG
// (minor and older changes stripped away, please see git history for details)
+// 2019-03-29: Misc: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects().
// 2019-01-16: Misc: Disabled fog before drawing UI's. Fixes issue #2288.
// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
// 2018-06-08: Misc: Extracted imgui_impl_dx9.cpp/.h away from the old combined DX9+Win32 example.
@@ -253,24 +254,9 @@
{
if (!g_pd3dDevice)
return;
- if (g_pVB)
- {
- g_pVB->Release();
- g_pVB = NULL;
- }
- if (g_pIB)
- {
- g_pIB->Release();
- g_pIB = NULL;
- }
-
- // At this point note that we set ImGui::GetIO().Fonts->TexID to be == g_FontTexture, so clear both.
- ImGuiIO& io = ImGui::GetIO();
- IM_ASSERT(g_FontTexture == io.Fonts->TexID);
- if (g_FontTexture)
- g_FontTexture->Release();
- g_FontTexture = NULL;
- io.Fonts->TexID = NULL;
+ if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
+ if (g_pIB) { g_pIB->Release(); g_pIB = NULL; }
+ if (g_FontTexture) { g_FontTexture->Release(); g_FontTexture = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.
}
void ImGui_ImplDX9_NewFrame()
diff --git a/misc/freetype/README.md b/misc/freetype/README.md
index 4c53cd9..397adec 100644
--- a/misc/freetype/README.md
+++ b/misc/freetype/README.md
@@ -43,7 +43,8 @@
if (freetype_test.UpdateRebuild())
{
// REUPLOAD FONT TEXTURE TO GPU
- // e.g ImGui_ImplOpenGL3_DestroyDeviceObjects() + ImGui_ImplOpenGL3_CreateDeviceObjects()
+ ImGui_ImplXXX_DestroyDeviceObjects();
+ ImGui_ImplXXX_CreateDeviceObjects();
}
ImGui::NewFrame();
freetype_test.ShowFreetypeOptionsWindow();
@@ -85,10 +86,10 @@
if (!WantRebuild)
return false;
ImGuiIO& io = ImGui::GetIO();
- for (int n = 0; n < io.Fonts->Fonts.Size; n++)
+ io.Fonts->TexGlyphPadding = FontsPadding;
+ for (int n = 0; n < io.Fonts->ConfigData.Size; n++)
{
- ImFontConfig* font_config = (ImFontConfig*)io.Fonts->Fonts[n]->ConfigData;
- io.Fonts->TexGlyphPadding = FontsPadding;
+ ImFontConfig* font_config = (ImFontConfig*)&io.Fonts->ConfigData[n];
font_config->RasterizerMultiply = FontsMultiply;
font_config->RasterizerFlags = (BuildMode == FontBuildMode_FreeType) ? FontsFlags : 0x00;
}