Examples: DirectX9: Fixed erroneous assert in ImGui_ImplDX9_InvalidateDeviceObjects(). FreeType: Fixed suggested code to not require an initial build call.. (#2454)
This commit is contained in:
parent
163779da51
commit
e21bbee311
@ -44,6 +44,7 @@ Other Changes:
|
||||
- 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)
|
||||
|
||||
|
||||
|
@ -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 @@ void ImGui_ImplDX9_InvalidateDeviceObjects()
|
||||
{
|
||||
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()
|
||||
|
@ -43,7 +43,8 @@ while (true)
|
||||
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 @@ struct FreeTypeTest
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user