Skip to content

Commit 80225ba

Browse files
committed
Merge branch 'docking' of github.com:ocornut/imgui into docking
2 parents f36bce3 + 63f00da commit 80225ba

32 files changed

+745
-328
lines changed

.github/workflows/build.yml

Lines changed: 66 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ jobs:
2727
- name: Install Dependencies
2828
shell: powershell
2929
run: |
30-
Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.26.3-VC.zip" -OutFile "SDL2-devel-2.26.3-VC.zip"
31-
Expand-Archive -Path SDL2-devel-2.26.3-VC.zip
32-
echo "SDL2_DIR=$(pwd)\SDL2-devel-2.26.3-VC\SDL2-2.26.3\" >>${env:GITHUB_ENV}
30+
Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.32.8-VC.zip" -OutFile "SDL2-devel-2.32.8-VC.zip"
31+
Expand-Archive -Path SDL2-devel-2.32.8-VC.zip
32+
echo "SDL2_DIR=$(pwd)\SDL2-devel-2.32.8-VC\SDL2-2.32.8\" >>${env:GITHUB_ENV}
33+
34+
Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL3-devel-3.2.18-VC.zip" -OutFile "SDL3-devel-3.2.18-VC.zip"
35+
Expand-Archive -Path SDL3-devel-3.2.18-VC.zip
36+
echo "SDL3_DIR=$(pwd)\SDL3-devel-3.2.18-VC\SDL3-3.2.18\" >>${env:GITHUB_ENV}
3337
3438
Invoke-WebRequest -Uri "https://github.com/ocornut/imgui/files/3789205/vulkan-sdk-1.1.121.2.zip" -OutFile vulkan-sdk-1.1.121.2.zip
3539
Expand-Archive -Path vulkan-sdk-1.1.121.2.zip
@@ -102,9 +106,12 @@ jobs:
102106
cl.exe /D_USRDLL /D_WINDLL /I. example_single_file.cpp /LD /FeImGui.dll /link
103107
cl.exe /DIMGUI_API=__declspec(dllimport) /I. ImGui.lib /Feexample_null.exe examples/example_null/main.cpp
104108
109+
# Win64 examples are more frequently compilted than the Win32 examples.
110+
# More of the Win32 examples requires 'workflow_run' to reduce waste.
105111
- name: Build Win32 example_glfw_opengl2
106112
shell: cmd
107113
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release'
114+
if: github.event_name == 'workflow_run'
108115

109116
- name: Build Win32 example_glfw_opengl3
110117
shell: cmd
@@ -140,72 +147,111 @@ jobs:
140147
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
141148
if: github.event_name == 'workflow_run'
142149

150+
- name: Build Win32 example_sdl3_opengl3
151+
shell: cmd
152+
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_opengl3/example_sdl3_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
153+
154+
- name: Build Win32 example_sdl3_sdlgpu3
155+
shell: cmd
156+
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlgpu3/example_sdl3_sdlgpu3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
157+
if: github.event_name == 'workflow_run'
158+
159+
- name: Build Win32 example_sdl3_sdlrenderer3
160+
shell: cmd
161+
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlrenderer3/example_sdl3_sdlrenderer3.vcxproj /p:Platform=Win32 /p:Configuration=Release'
162+
if: github.event_name == 'workflow_run'
163+
164+
- name: Build Win32 example_sdl3_vulkan
165+
shell: cmd
166+
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_vulkan/example_sdl3_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release'
167+
if: github.event_name == 'workflow_run'
168+
143169
- name: Build Win32 example_win32_directx9
144170
shell: cmd
145171
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=Win32 /p:Configuration=Release'
172+
if: github.event_name == 'workflow_run'
146173

147174
- name: Build Win32 example_win32_directx10
148175
shell: cmd
149176
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=Win32 /p:Configuration=Release'
177+
if: github.event_name == 'workflow_run'
150178

151179
- name: Build Win32 example_win32_directx11
152180
shell: cmd
153181
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release'
154182
if: github.event_name == 'workflow_run'
155183

156-
- name: Build x64 example_glfw_opengl2
184+
# Windows 64-bits
185+
- name: Build Win64 example_glfw_opengl2
157186
shell: cmd
158187
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
159188
if: github.event_name == 'workflow_run'
160189

161-
- name: Build x64 example_glfw_opengl3
190+
- name: Build Win64 example_glfw_opengl3
162191
shell: cmd
163192
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
164193

165-
- name: Build x64 example_glfw_vulkan
194+
- name: Build Win64 example_glfw_vulkan
166195
shell: cmd
167196
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
168197

169-
- name: Build x64 example_sdl2_sdlrenderer2
198+
- name: Build Win64 example_sdl2_sdlrenderer2
170199
shell: cmd
171200
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_sdlrenderer2/example_sdl2_sdlrenderer2.vcxproj /p:Platform=x64 /p:Configuration=Release'
172201
if: github.event_name == 'workflow_run'
173202

174-
- name: Build x64 example_sdl2_vulkan
203+
- name: Build Win64 example_sdl2_vulkan
175204
shell: cmd
176205
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
177206
if: github.event_name == 'workflow_run'
178207

179-
- name: Build x64 example_sdl2_opengl2
208+
- name: Build Win64 example_sdl2_opengl2
180209
shell: cmd
181210
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release'
182211
if: github.event_name == 'workflow_run'
183212

184-
- name: Build x64 example_sdl2_opengl3
213+
- name: Build Win64 example_sdl2_opengl3
185214
shell: cmd
186215
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
187216
if: github.event_name == 'workflow_run'
188217

189-
- name: Build x64 example_sdl2_directx11
218+
- name: Build Win64 example_sdl2_directx11
190219
shell: cmd
191220
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release'
192221

193-
- name: Build x64 example_win32_directx9
222+
- name: Build Win64 example_sdl3_opengl3
223+
shell: cmd
224+
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_opengl3/example_sdl3_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release'
225+
if: github.event_name == 'workflow_run'
226+
227+
- name: Build Win64 example_sdl3_sdlgpu3
228+
shell: cmd
229+
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlgpu3/example_sdl3_sdlgpu3.vcxproj /p:Platform=x64 /p:Configuration=Release'
230+
231+
- name: Build Win64 example_sdl3_sdlrenderer3
232+
shell: cmd
233+
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_sdlrenderer3/example_sdl3_sdlrenderer3.vcxproj /p:Platform=x64 /p:Configuration=Release'
234+
235+
- name: Build Win64 example_sdl3_vulkan
236+
shell: cmd
237+
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl3_vulkan/example_sdl3_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release'
238+
if: github.event_name == 'workflow_run'
239+
240+
- name: Build Win64 example_win32_directx9
194241
shell: cmd
195242
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=x64 /p:Configuration=Release'
196243
if: github.event_name == 'workflow_run'
197244

198-
- name: Build x64 example_win32_directx10
245+
- name: Build Win64 example_win32_directx10
199246
shell: cmd
200247
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=x64 /p:Configuration=Release'
201248
if: github.event_name == 'workflow_run'
202249

203-
- name: Build x64 example_win32_directx11
250+
- name: Build Win64 example_win32_directx11
204251
shell: cmd
205252
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release'
206-
if: github.event_name == 'workflow_run'
207253

208-
- name: Build x64 example_win32_directx12
254+
- name: Build Win64 example_win32_directx12
209255
shell: cmd
210256
run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx12/example_win32_directx12.vcxproj /p:Platform=x64 /p:Configuration=Release'
211257

@@ -433,7 +479,7 @@ jobs:
433479

434480
- name: Install Dependencies
435481
run: |
436-
brew install glfw3 sdl2
482+
brew install glfw3 sdl2 sdl3
437483
438484
- name: Build example_null (extra warnings, clang 64-bit)
439485
run: make -C examples/example_null WITH_EXTRA_WARNINGS=1
@@ -491,6 +537,9 @@ jobs:
491537
- name: Build example_sdl2_opengl3
492538
run: make -C examples/example_sdl2_opengl3
493539

540+
- name: Build example_sdl3_opengl3
541+
run: make -C examples/example_sdl3_opengl3
542+
494543
- name: Build example_apple_metal
495544
run: xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_macos
496545

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ examples/example_sdl2_opengl2/example_sdl2_opengl2
6868
examples/example_sdl2_opengl3/example_sdl2_opengl3
6969
examples/example_sdl2_sdlrenderer2/example_sdl2_sdlrenderer2
7070
examples/example_sdl2_vulkan/example_sdl2_vulkan
71+
examples/example_sdl3_metal/example_sdl3_metal
7172
examples/example_sdl3_opengl3/example_sdl3_opengl3
7273
examples/example_sdl3_sdlgpu3/example_sdl3_sdlgpu3
7374
examples/example_sdl3_sdlrenderer3/example_sdl3_sdlrenderer3

backends/imgui_impl_allegro5.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,8 @@ void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data)
161161
ImGui_ImplAllegro5_SetupRenderState(draw_data);
162162

163163
// Render command lists
164-
for (int n = 0; n < draw_data->CmdListsCount; n++)
164+
for (const ImDrawList* draw_list : draw_data->CmdLists)
165165
{
166-
const ImDrawList* draw_list = draw_data->CmdLists[n];
167-
168166
ImVector<ImDrawVertAllegro>& vertices = bd->BufVertices;
169167
#if ALLEGRO_HAS_DRAW_INDEXED_PRIM
170168
vertices.resize(draw_list->VtxBuffer.Size);

backends/imgui_impl_dx10.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,8 @@ void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data)
206206
ImDrawIdx* idx_dst = nullptr;
207207
bd->pVB->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&vtx_dst);
208208
bd->pIB->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&idx_dst);
209-
for (int n = 0; n < draw_data->CmdListsCount; n++)
209+
for (const ImDrawList* draw_list : draw_data->CmdLists)
210210
{
211-
const ImDrawList* draw_list = draw_data->CmdLists[n];
212211
memcpy(vtx_dst, draw_list->VtxBuffer.Data, draw_list->VtxBuffer.Size * sizeof(ImDrawVert));
213212
memcpy(idx_dst, draw_list->IdxBuffer.Data, draw_list->IdxBuffer.Size * sizeof(ImDrawIdx));
214213
vtx_dst += draw_list->VtxBuffer.Size;
@@ -274,9 +273,8 @@ void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data)
274273
int global_idx_offset = 0;
275274
ImVec2 clip_off = draw_data->DisplayPos;
276275
ImVec2 clip_scale = draw_data->FramebufferScale;
277-
for (int n = 0; n < draw_data->CmdListsCount; n++)
276+
for (const ImDrawList* draw_list : draw_data->CmdLists)
278277
{
279-
const ImDrawList* draw_list = draw_data->CmdLists[n];
280278
for (int cmd_i = 0; cmd_i < draw_list->CmdBuffer.Size; cmd_i++)
281279
{
282280
const ImDrawCmd* pcmd = &draw_list->CmdBuffer[cmd_i];

backends/imgui_impl_dx11.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,8 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
216216
return;
217217
ImDrawVert* vtx_dst = (ImDrawVert*)vtx_resource.pData;
218218
ImDrawIdx* idx_dst = (ImDrawIdx*)idx_resource.pData;
219-
for (int n = 0; n < draw_data->CmdListsCount; n++)
219+
for (const ImDrawList* draw_list : draw_data->CmdLists)
220220
{
221-
const ImDrawList* draw_list = draw_data->CmdLists[n];
222221
memcpy(vtx_dst, draw_list->VtxBuffer.Data, draw_list->VtxBuffer.Size * sizeof(ImDrawVert));
223222
memcpy(idx_dst, draw_list->IdxBuffer.Data, draw_list->IdxBuffer.Size * sizeof(ImDrawIdx));
224223
vtx_dst += draw_list->VtxBuffer.Size;
@@ -290,9 +289,8 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
290289
int global_vtx_offset = 0;
291290
ImVec2 clip_off = draw_data->DisplayPos;
292291
ImVec2 clip_scale = draw_data->FramebufferScale;
293-
for (int n = 0; n < draw_data->CmdListsCount; n++)
292+
for (const ImDrawList* draw_list : draw_data->CmdLists)
294293
{
295-
const ImDrawList* draw_list = draw_data->CmdLists[n];
296294
for (int cmd_i = 0; cmd_i < draw_list->CmdBuffer.Size; cmd_i++)
297295
{
298296
const ImDrawCmd* pcmd = &draw_list->CmdBuffer[cmd_i];

backends/imgui_impl_dx12.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,8 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
339339
return;
340340
ImDrawVert* vtx_dst = (ImDrawVert*)vtx_resource;
341341
ImDrawIdx* idx_dst = (ImDrawIdx*)idx_resource;
342-
for (int n = 0; n < draw_data->CmdListsCount; n++)
342+
for (const ImDrawList* draw_list : draw_data->CmdLists)
343343
{
344-
const ImDrawList* draw_list = draw_data->CmdLists[n];
345344
memcpy(vtx_dst, draw_list->VtxBuffer.Data, draw_list->VtxBuffer.Size * sizeof(ImDrawVert));
346345
memcpy(idx_dst, draw_list->IdxBuffer.Data, draw_list->IdxBuffer.Size * sizeof(ImDrawIdx));
347346
vtx_dst += draw_list->VtxBuffer.Size;
@@ -372,9 +371,8 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
372371
int global_idx_offset = 0;
373372
ImVec2 clip_off = draw_data->DisplayPos;
374373
ImVec2 clip_scale = draw_data->FramebufferScale;
375-
for (int n = 0; n < draw_data->CmdListsCount; n++)
374+
for (const ImDrawList* draw_list : draw_data->CmdLists)
376375
{
377-
const ImDrawList* draw_list = draw_data->CmdLists[n];
378376
for (int cmd_i = 0; cmd_i < draw_list->CmdBuffer.Size; cmd_i++)
379377
{
380378
const ImDrawCmd* pcmd = &draw_list->CmdBuffer[cmd_i];

backends/imgui_impl_dx9.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,8 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
236236
// FIXME-OPT: This is a minor waste of resource, the ideal is to use imconfig.h and
237237
// 1) to avoid repacking colors: #define IMGUI_USE_BGRA_PACKED_COLOR
238238
// 2) to avoid repacking vertices: #define IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT struct ImDrawVert { ImVec2 pos; float z; ImU32 col; ImVec2 uv; }
239-
for (int n = 0; n < draw_data->CmdListsCount; n++)
239+
for (const ImDrawList* draw_list : draw_data->CmdLists)
240240
{
241-
const ImDrawList* draw_list = draw_data->CmdLists[n];
242241
const ImDrawVert* vtx_src = draw_list->VtxBuffer.Data;
243242
for (int i = 0; i < draw_list->VtxBuffer.Size; i++)
244243
{
@@ -268,9 +267,8 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
268267
int global_vtx_offset = 0;
269268
int global_idx_offset = 0;
270269
ImVec2 clip_off = draw_data->DisplayPos;
271-
for (int n = 0; n < draw_data->CmdListsCount; n++)
270+
for (const ImDrawList* draw_list : draw_data->CmdLists)
272271
{
273-
const ImDrawList* draw_list = draw_data->CmdLists[n];
274272
for (int cmd_i = 0; cmd_i < draw_list->CmdBuffer.Size; cmd_i++)
275273
{
276274
const ImDrawCmd* pcmd = &draw_list->CmdBuffer[cmd_i];

backends/imgui_impl_metal.mm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void ImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data, id<MTLCommandBuffer>
235235
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
236236
int fb_width = (int)(draw_data->DisplaySize.x * draw_data->FramebufferScale.x);
237237
int fb_height = (int)(draw_data->DisplaySize.y * draw_data->FramebufferScale.y);
238-
if (fb_width <= 0 || fb_height <= 0 || draw_data->CmdListsCount == 0)
238+
if (fb_width <= 0 || fb_height <= 0 || draw_data->CmdLists.Size == 0)
239239
return;
240240

241241
// Catch up with texture updates. Most of the times, the list will have 1 element with an OK status, aka nothing to do.
@@ -271,10 +271,8 @@ void ImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data, id<MTLCommandBuffer>
271271
// Render command lists
272272
size_t vertexBufferOffset = 0;
273273
size_t indexBufferOffset = 0;
274-
for (int n = 0; n < draw_data->CmdListsCount; n++)
274+
for (const ImDrawList* draw_list : draw_data->CmdLists)
275275
{
276-
const ImDrawList* draw_list = draw_data->CmdLists[n];
277-
278276
memcpy((char*)vertexBuffer.buffer.contents + vertexBufferOffset, draw_list->VtxBuffer.Data, (size_t)draw_list->VtxBuffer.Size * sizeof(ImDrawVert));
279277
memcpy((char*)indexBuffer.buffer.contents + indexBufferOffset, draw_list->IdxBuffer.Data, (size_t)draw_list->IdxBuffer.Size * sizeof(ImDrawIdx));
280278

backends/imgui_impl_opengl2.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
// CHANGELOG
2828
// (minor and older changes stripped away, please see git history for details)
2929
// 2025-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
30+
// 2025-07-15: OpenGL: Set GL_UNPACK_ALIGNMENT to 1 before updating textures. (#8802)
3031
// 2025-06-11: OpenGL: Added support for ImGuiBackendFlags_RendererHasTextures, for dynamic font atlas. Removed ImGui_ImplOpenGL2_CreateFontsTexture() and ImGui_ImplOpenGL2_DestroyFontsTexture().
3132
// 2024-10-07: OpenGL: Changed default texture sampler to Clamp instead of Repeat/Wrap.
3233
// 2024-06-28: OpenGL: ImGui_ImplOpenGL2_NewFrame() recreates font texture if it has been destroyed by ImGui_ImplOpenGL2_DestroyFontsTexture(). (#7748)
@@ -218,9 +219,8 @@ void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
218219
ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
219220

220221
// Render command lists
221-
for (int n = 0; n < draw_data->CmdListsCount; n++)
222+
for (const ImDrawList* draw_list : draw_data->CmdLists)
222223
{
223-
const ImDrawList* draw_list = draw_data->CmdLists[n];
224224
const ImDrawVert* vtx_buffer = draw_list->VtxBuffer.Data;
225225
const ImDrawIdx* idx_buffer = draw_list->IdxBuffer.Data;
226226
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + offsetof(ImDrawVert, pos)));
@@ -296,6 +296,7 @@ void ImGui_ImplOpenGL2_UpdateTexture(ImTextureData* tex)
296296
GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP));
297297
GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP));
298298
GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH, 0));
299+
GL_CALL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
299300
GL_CALL(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex->Width, tex->Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels));
300301

301302
// Store identifiers
@@ -315,6 +316,7 @@ void ImGui_ImplOpenGL2_UpdateTexture(ImTextureData* tex)
315316
GLuint gl_tex_id = (GLuint)(intptr_t)tex->TexID;
316317
GL_CALL(glBindTexture(GL_TEXTURE_2D, gl_tex_id));
317318
GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH, tex->Width));
319+
GL_CALL(glPixelStorei(GL_UNPACK_ALIGNMENT, 1));
318320
for (ImTextureRect& r : tex->Updates)
319321
GL_CALL(glTexSubImage2D(GL_TEXTURE_2D, 0, r.x, r.y, r.w, r.h, GL_RGBA, GL_UNSIGNED_BYTE, tex->GetPixelsAt(r.x, r.y)));
320322
GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH, 0));

0 commit comments

Comments
 (0)