imgui_impl_sdlrenderer.cpp (imgui-1.86) | : | imgui_impl_sdlrenderer.cpp (imgui-1.87) | ||
---|---|---|---|---|
skipping to change at line 213 | skipping to change at line 213 | |||
{ | { | |||
ImGuiIO& io = ImGui::GetIO(); | ImGuiIO& io = ImGui::GetIO(); | |||
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData(); | ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData(); | |||
// Build texture atlas | // Build texture atlas | |||
unsigned char* pixels; | unsigned char* pixels; | |||
int width, height; | int width, height; | |||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32 -bit (75% of the memory is wasted, but default font is so small) because it is m ore likely to be compatible with user's existing shaders. If your ImTextureId re present a higher-level concept than just a GL texture id, consider calling GetTe xDataAsAlpha8() instead to save on GPU memory. | io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32 -bit (75% of the memory is wasted, but default font is so small) because it is m ore likely to be compatible with user's existing shaders. If your ImTextureId re present a higher-level concept than just a GL texture id, consider calling GetTe xDataAsAlpha8() instead to save on GPU memory. | |||
// Upload texture to graphics system | // Upload texture to graphics system | |||
bd->FontTexture = SDL_CreateTexture(bd->SDLRenderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STATIC, width, height); | bd->FontTexture = SDL_CreateTexture(bd->SDLRenderer, SDL_PIXELFORMAT_ABGR888 8, SDL_TEXTUREACCESS_STATIC, width, height); | |||
if (bd->FontTexture == NULL) | if (bd->FontTexture == NULL) | |||
{ | { | |||
SDL_Log("error creating texture"); | SDL_Log("error creating texture"); | |||
return false; | return false; | |||
} | } | |||
SDL_UpdateTexture(bd->FontTexture, NULL, pixels, 4 * width); | SDL_UpdateTexture(bd->FontTexture, NULL, pixels, 4 * width); | |||
SDL_SetTextureBlendMode(bd->FontTexture, SDL_BLENDMODE_BLEND); | SDL_SetTextureBlendMode(bd->FontTexture, SDL_BLENDMODE_BLEND); | |||
// Store our identifier | // Store our identifier | |||
io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->FontTexture); | io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->FontTexture); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |