Examples: Not clearing input data/tex data in atlas (will be required for dynamic atlas anyway). Effectively fix resizing in DX examples.

+ Standardized comments.
This commit is contained in:
ocornut
2015-11-29 14:54:05 +00:00
parent 6269859315
commit 6cee2fca94
9 changed files with 39 additions and 58 deletions

View File

@ -692,12 +692,15 @@ static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
void ImGui_ImplIOS_CreateFontsTexture()
{
// Build texture atlas
ImGuiIO& io = ImGui::GetIO();
unsigned char* pixels;
int width, height;
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits for OpenGL3 demo because it is more likely to be compatible with user's existing shader.
// Upload texture to graphics system
GLint last_texture;
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
glGenTextures(1, &g_FontTexture);
glBindTexture(GL_TEXTURE_2D, g_FontTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@ -706,10 +709,9 @@ void ImGui_ImplIOS_CreateFontsTexture()
// Store our identifier
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
// Cleanup (don't clear the input data if you want to append new fonts later)
io.Fonts->ClearInputData();
io.Fonts->ClearTexData();
// Restore state
glBindTexture(GL_TEXTURE_2D, last_texture);
}
bool ImGui_ImplIOS_CreateDeviceObjects()
@ -767,7 +769,6 @@ bool ImGui_ImplIOS_CreateDeviceObjects()
}
#endif
glAttachShader(g_ShaderHandle, g_VertHandle);
glAttachShader(g_ShaderHandle, g_FragHandle);
glLinkProgram(g_ShaderHandle);