summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2020-01-22 16:07:55 +0100
committerAndre Weissflog <floooh@gmail.com>2020-01-22 16:07:55 +0100
commitc54fdf95159e5ae63a21a79f46b4365ce4e2644a (patch)
treec19c9f2c186878c1350d02d63100ea6848336058
parentd7b77c751f6887803dc4efbd3206b09bd94cad1f (diff)
sokol_imgui.h: reapply state after calling ImGui user draw callback
-rw-r--r--util/sokol_imgui.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/sokol_imgui.h b/util/sokol_imgui.h
index 675c51ae..908e4633 100644
--- a/util/sokol_imgui.h
+++ b/util/sokol_imgui.h
@@ -1056,6 +1056,11 @@ SOKOL_API_IMPL void simgui_render(void) {
ImDrawCmd* pcmd = &cl->CmdBuffer.Data[cmd_index];
if (pcmd->UserCallback) {
pcmd->UserCallback(cl, pcmd);
+ // need to re-apply all state after calling a user callback
+ sg_apply_viewport(0, 0, fb_width, fb_height, true);
+ sg_apply_pipeline(_simgui.pip);
+ sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, &vs_params, sizeof(vs_params));
+ sg_apply_bindings(&bind);
}
else {
if ((tex_id != pcmd->TextureId) || (vtx_offset != pcmd->VtxOffset)) {