| @@ -361,7 +361,6 @@ struct BefacoSlidePot : SVGSlider { | |||||
| struct PJ301MPort : SVGPort { | struct PJ301MPort : SVGPort { | ||||
| PJ301MPort() { | PJ301MPort() { | ||||
| padding = Vec(1, 1); | |||||
| background->svg = SVG::load("res/ComponentLibrary/PJ301M.svg"); | background->svg = SVG::load("res/ComponentLibrary/PJ301M.svg"); | ||||
| background->wrap(); | background->wrap(); | ||||
| box.size = background->box.size; | box.size = background->box.size; | ||||
| @@ -370,7 +369,6 @@ struct PJ301MPort : SVGPort { | |||||
| struct PJ3410Port : SVGPort { | struct PJ3410Port : SVGPort { | ||||
| PJ3410Port() { | PJ3410Port() { | ||||
| padding = Vec(1, 1); | |||||
| background->svg = SVG::load("res/ComponentLibrary/PJ3410.svg"); | background->svg = SVG::load("res/ComponentLibrary/PJ3410.svg"); | ||||
| background->wrap(); | background->wrap(); | ||||
| box.size = background->box.size; | box.size = background->box.size; | ||||
| @@ -379,7 +377,6 @@ struct PJ3410Port : SVGPort { | |||||
| struct CL1362Port : SVGPort { | struct CL1362Port : SVGPort { | ||||
| CL1362Port() { | CL1362Port() { | ||||
| padding = Vec(1, 1); | |||||
| background->svg = SVG::load("res/ComponentLibrary/CL1362.svg"); | background->svg = SVG::load("res/ComponentLibrary/CL1362.svg"); | ||||
| background->wrap(); | background->wrap(); | ||||
| box.size = background->box.size; | box.size = background->box.size; | ||||
| @@ -199,7 +199,6 @@ struct FramebufferWidget : virtual Widget { | |||||
| /** A margin in pixels around the children in the framebuffer | /** A margin in pixels around the children in the framebuffer | ||||
| This prevents cutting the rendered SVG off on the box edges. | This prevents cutting the rendered SVG off on the box edges. | ||||
| */ | */ | ||||
| Vec padding; | |||||
| float oversample = 2.0; | float oversample = 2.0; | ||||
| /** The root object in the framebuffer scene | /** The root object in the framebuffer scene | ||||
| The FramebufferWidget owns the pointer | The FramebufferWidget owns the pointer | ||||
| @@ -5,8 +5,6 @@ namespace rack { | |||||
| SVGKnob::SVGKnob() { | SVGKnob::SVGKnob() { | ||||
| padding = Vec(1, 1); | |||||
| tw = new TransformWidget(); | tw = new TransformWidget(); | ||||
| addChild(tw); | addChild(tw); | ||||
| @@ -5,8 +5,6 @@ namespace rack { | |||||
| SVGPort::SVGPort() { | SVGPort::SVGPort() { | ||||
| padding = Vec(1, 1); | |||||
| background = new SVGWidget(); | background = new SVGWidget(); | ||||
| addChild(background); | addChild(background); | ||||
| } | } | ||||
| @@ -5,8 +5,6 @@ namespace rack { | |||||
| SVGScrew::SVGScrew() { | SVGScrew::SVGScrew() { | ||||
| padding = Vec(1, 1); | |||||
| sw = new SVGWidget(); | sw = new SVGWidget(); | ||||
| addChild(sw); | addChild(sw); | ||||
| } | } | ||||
| @@ -5,8 +5,6 @@ namespace rack { | |||||
| SVGSwitch::SVGSwitch() { | SVGSwitch::SVGSwitch() { | ||||
| padding = Vec(1, 1); | |||||
| sw = new SVGWidget(); | sw = new SVGWidget(); | ||||
| addChild(sw); | addChild(sw); | ||||
| } | } | ||||
| @@ -215,8 +215,9 @@ void guiInit() { | |||||
| // glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); | // glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); | ||||
| // glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); | // glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); | ||||
| glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); | glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); | ||||
| glfwWindowHint(GLFW_DOUBLEBUFFER, GLFW_TRUE); | |||||
| std::string title = gApplicationName + " " + gApplicationVersion; | std::string title = gApplicationName + " " + gApplicationVersion; | ||||
| gWindow = glfwCreateWindow(1000, 750, title.c_str(), NULL, NULL); | |||||
| gWindow = glfwCreateWindow(640, 480, title.c_str(), NULL, NULL); | |||||
| if (!gWindow) { | if (!gWindow) { | ||||
| osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Cannot open window with OpenGL 2.0 renderer. Does your graphics card support OpenGL 2.0? If so, are the latest drivers installed?"); | osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK, "Cannot open window with OpenGL 2.0 renderer. Does your graphics card support OpenGL 2.0? If so, are the latest drivers installed?"); | ||||
| exit(1); | exit(1); | ||||
| @@ -38,8 +38,8 @@ void FramebufferWidget::step() { | |||||
| // Render the scene to the framebuffer if dirty | // Render the scene to the framebuffer if dirty | ||||
| if (dirty) { | if (dirty) { | ||||
| internal->box.pos = padding.neg(); | |||||
| internal->box.size = box.size.plus(padding.mult(2)); | |||||
| internal->box.pos = Vec(0, 0); | |||||
| internal->box.size = box.size; | |||||
| internal->box.size = Vec(ceilf(internal->box.size.x), ceilf(internal->box.size.y)); | internal->box.size = Vec(ceilf(internal->box.size.x), ceilf(internal->box.size.y)); | ||||
| Vec fbSize = internal->box.size.mult(gPixelRatio * oversample); | Vec fbSize = internal->box.size.mult(gPixelRatio * oversample); | ||||
| // assert(fbSize.isFinite()); | // assert(fbSize.isFinite()); | ||||
| @@ -50,14 +50,6 @@ void FramebufferWidget::step() { | |||||
| // Delete old one first to free up GPU memory | // Delete old one first to free up GPU memory | ||||
| internal->setFramebuffer(NULL); | internal->setFramebuffer(NULL); | ||||
| NVGLUframebuffer *fb = nvgluCreateFramebuffer(gVg, fbSize.x, fbSize.y, NVG_IMAGE_REPEATX | NVG_IMAGE_REPEATY); | NVGLUframebuffer *fb = nvgluCreateFramebuffer(gVg, fbSize.x, fbSize.y, NVG_IMAGE_REPEATX | NVG_IMAGE_REPEATY); | ||||
| if (!fb) { | |||||
| char buf[1024]; | |||||
| snprintf(buf, sizeof(buf), "%f %f, %f %f; %f %f; %p\n", internal->box.pos.x, internal->box.pos.y, internal->box.size.x, internal->box.size.y, fbSize.x, fbSize.y, fb); | |||||
| if (!osdialog_message(OSDIALOG_ERROR, OSDIALOG_OK_CANCEL, buf)) | |||||
| exit(0); | |||||
| } | |||||
| if (!fb) | if (!fb) | ||||
| return; | return; | ||||
| internal->setFramebuffer(fb); | internal->setFramebuffer(fb); | ||||
| @@ -66,10 +58,9 @@ void FramebufferWidget::step() { | |||||
| glViewport(0.0, 0.0, fbSize.x, fbSize.y); | glViewport(0.0, 0.0, fbSize.x, fbSize.y); | ||||
| glClearColor(0.0, 0.0, 0.0, 0.0); | glClearColor(0.0, 0.0, 0.0, 0.0); | ||||
| glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | ||||
| nvgBeginFrame(gVg, fbSize.x, fbSize.y, gPixelRatio); | |||||
| nvgBeginFrame(gVg, fbSize.x, fbSize.y, gPixelRatio * oversample); | |||||
| nvgScale(gVg, gPixelRatio * oversample, gPixelRatio * oversample); | nvgScale(gVg, gPixelRatio * oversample, gPixelRatio * oversample); | ||||
| nvgTranslate(gVg, padding.x, padding.y); | |||||
| Widget::draw(gVg); | Widget::draw(gVg); | ||||
| nvgEndFrame(gVg); | nvgEndFrame(gVg); | ||||