From 47ce8272ab0b7a168e89d3db3940c808a3124ee9 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 16 Apr 2019 00:24:28 -0400 Subject: [PATCH] Initialize OpenGL context before calling scene->draw(). --- include/engine/ParamQuantity.hpp | 4 ++-- src/window.cpp | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/engine/ParamQuantity.hpp b/include/engine/ParamQuantity.hpp index b1af56d6..0e5c80bc 100644 --- a/include/engine/ParamQuantity.hpp +++ b/include/engine/ParamQuantity.hpp @@ -27,8 +27,8 @@ struct ParamQuantity : Quantity { */ std::string label; /** The numerical unit of measurement appended to the value. - Units that are words should have a space to separate the numerical value from the number (e.g. " semitones", " octaves"). - Unit abbreviations and symbols should have no space (e.g. "V", "ms", "%", "º"). + Unit words and abbreviations should have a space to separate the numerical value from the number (e.g. " semitones", " V", " ms"). + Unit symbols should have no space (e.g. "%", "º"). */ std::string unit; /** Set to 0 for linear, positive for exponential, negative for logarithmic. */ diff --git a/src/window.cpp b/src/window.cpp index eabf7024..4a2365f2 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -354,27 +354,29 @@ void Window::run() { // DEBUG("%f %f %d %d", pixelRatio, windowRatio, fbWidth, winWidth); // Resize scene - APP->event->rootWidget->box.size = math::Vec(fbWidth, fbHeight).div(pixelRatio); + APP->scene->box.size = math::Vec(fbWidth, fbHeight).div(pixelRatio); // Step scene - APP->event->rootWidget->step(); + APP->scene->step(); // Render scene bool visible = glfwGetWindowAttrib(win, GLFW_VISIBLE) && !glfwGetWindowAttrib(win, GLFW_ICONIFIED); if (visible) { + glViewport(0, 0, fbWidth, fbHeight); + glClearColor(0.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + // Update and render nvgBeginFrame(vg, fbWidth, fbHeight, pixelRatio); nvgReset(vg); nvgScale(vg, pixelRatio, pixelRatio); + // Draw scene widget::Widget::DrawArgs args; args.vg = vg; - args.clipBox = APP->event->rootWidget->box.zeroPos(); - APP->event->rootWidget->draw(args); + args.clipBox = APP->scene->box.zeroPos(); + APP->scene->draw(args); - glViewport(0, 0, fbWidth, fbHeight); - glClearColor(0.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); nvgEndFrame(vg); glfwSwapBuffers(win);