From 5cca4686e252df99ca11a9fe3da3e3bb383ac918 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Thu, 12 Mar 2015 20:27:53 +0100 Subject: [PATCH 1/2] NVG now uses same viewId as imgui. --- examples/common/imgui/imgui.cpp | 1 + examples/common/nanovg/nanovg.h | 1 + examples/common/nanovg/nanovg_bgfx.cpp | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/examples/common/imgui/imgui.cpp b/examples/common/imgui/imgui.cpp index cdd918c0f..a2f572022 100644 --- a/examples/common/imgui/imgui.cpp +++ b/examples/common/imgui/imgui.cpp @@ -813,6 +813,7 @@ struct Imgui void beginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, uint16_t _width, uint16_t _height, char _inputChar, uint8_t _view) { IMGUI_beginFrame(_mx, _my, _button, _width, _height, _inputChar, _view); + nvgViewId(m_nvg, _view); m_view = _view; m_viewWidth = _width; diff --git a/examples/common/nanovg/nanovg.h b/examples/common/nanovg/nanovg.h index 4ff96151d..8709db210 100644 --- a/examples/common/nanovg/nanovg.h +++ b/examples/common/nanovg/nanovg.h @@ -599,6 +599,7 @@ struct NVGparams { typedef struct NVGparams NVGparams; NVGcontext* nvgCreate(int edgeaa, unsigned char viewid); +void nvgViewId(struct NVGcontext* ctx, unsigned char viewid); void nvgDelete(struct NVGcontext* ctx); // Contructor and destructor, called by the render back-end. diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index 40a1fbe84..6be7bbf90 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -1051,6 +1051,13 @@ error: return NULL; } +void nvgViewId(struct NVGcontext* ctx, unsigned char viewid) +{ + struct NVGparams* params = nvgInternalParams(ctx); + struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr; + gl->viewid = uint8_t(viewid); +} + void nvgDelete(struct NVGcontext* ctx) { nvgDeleteInternal(ctx); From a7dc166ed17a21f283bac4a144c591ef464575fc Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Thu, 12 Mar 2015 20:34:19 +0100 Subject: [PATCH 2/2] Don't show imgui test window all the time. --- examples/common/imgui/ocornut_imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/common/imgui/ocornut_imgui.cpp b/examples/common/imgui/ocornut_imgui.cpp index 62cb1c87a..19726040b 100644 --- a/examples/common/imgui/ocornut_imgui.cpp +++ b/examples/common/imgui/ocornut_imgui.cpp @@ -165,7 +165,7 @@ struct OcornutImguiContext ImGui::NewFrame(); - ImGui::ShowTestWindow(); + //ImGui::ShowTestWindow(); //Debug only. } void endFrame()