Backends: OpenGL3: fixed updating textures. (#9478, #9477, #9473, #8802)

Fixed 0ff4a8a.
This commit is contained in:
Brenton Bostick
2026-07-16 13:53:51 -04:00
committed by ocornut
parent 26b8292635
commit 61a093635c

View File

@@ -670,7 +670,8 @@ void ImGui_ImplOpenGL3_UpdateTexture(ImTextureData* tex)
// Backup GL_UNPACK state that we modify, restore on exit.
GLint last_unpack_row_length = 0; (void)last_unpack_row_length;
GLint last_unpack_alignment = 0; (void)last_unpack_alignment;
if (tex->Status == ImTextureStatus_WantCreate || tex->Status == ImTextureStatus_WantUpdates)
const bool last_unpack_state_save_and_restore = (tex->Status == ImTextureStatus_WantCreate || tex->Status == ImTextureStatus_WantUpdates);
if (last_unpack_state_save_and_restore)
{
#ifdef GL_UNPACK_ROW_LENGTH // Not on WebGL/ES
GL_CALL(glGetIntegerv(GL_UNPACK_ROW_LENGTH, &last_unpack_row_length));
@@ -744,7 +745,7 @@ void ImGui_ImplOpenGL3_UpdateTexture(ImTextureData* tex)
ImGui_ImplOpenGL3_DestroyTexture(tex);
// Restore GL_UNPACK state
if (tex->Status == ImTextureStatus_WantCreate || tex->Status == ImTextureStatus_WantUpdates)
if (last_unpack_state_save_and_restore)
{
#ifdef GL_UNPACK_ROW_LENGTH
GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH, last_unpack_row_length));