VCV Rack API v2
Loading...
Searching...
No Matches
FramebufferWidget.hpp
Go to the documentation of this file.
1#pragma once
2#include <widget/Widget.hpp>
3
4
5namespace rack {
6namespace widget {
7
8
13 struct Internal;
14 Internal* internal;
15
16 bool dirty = true;
17 bool bypassed = false;
18 float oversample = 1.0;
24 math::Vec viewportMargin = math::Vec(INFINITY, INFINITY);
25
29 void setDirty(bool dirty = true);
31 NVGLUframebuffer* getFramebuffer();
34
35 void step() override;
38 void draw(const DrawArgs& args) override;
42 void render(math::Vec scale = math::Vec(1, 1), math::Vec offsetF = math::Vec(0, 0), math::Rect clipBox = math::Rect::inf());
45 virtual void drawFramebuffer();
46
47 void onDirty(const DirtyEvent& e) override;
48 void onContextCreate(const ContextCreateEvent& e) override;
49 void onContextDestroy(const ContextDestroyEvent& e) override;
50};
51
52
53} // namespace widget
54} // namespace rack
Root namespace for the Rack API.
Definition AudioDisplay.hpp:9
2-dimensional rectangle for graphics.
Definition math.hpp:301
static Rect inf()
Returns the infinite Rect.
Definition math.hpp:319
2-dimensional vector of floats, representing a point on the plane for graphics.
Definition math.hpp:189
Caches its children's draw() result to a framebuffer image.
Definition FramebufferWidget.hpp:12
void onContextCreate(const ContextCreateEvent &e) override
virtual void drawFramebuffer()
Initializes the current GL context and draws children to it.
NVGLUframebuffer * getFramebuffer()
void render(math::Vec scale=math::Vec(1, 1), math::Vec offsetF=math::Vec(0, 0), math::Rect clipBox=math::Rect::inf())
Re-renders the framebuffer, re-creating it if necessary.
bool bypassed
Definition FramebufferWidget.hpp:17
Internal * internal
Definition FramebufferWidget.hpp:14
void setDirty(bool dirty=true)
Requests to re-render children to the framebuffer on the next draw().
math::Vec viewportMargin
If finite, the maximum size of the framebuffer is the viewport expanded by this margin.
Definition FramebufferWidget.hpp:24
bool dirty
Definition FramebufferWidget.hpp:16
void step() override
Advances the module by one frame.
void onContextDestroy(const ContextDestroyEvent &e) override
void onDirty(const DirtyEvent &e) override
bool dirtyOnSubpixelChange
Redraw when the world offset of the FramebufferWidget changes its fractional value.
Definition FramebufferWidget.hpp:20
void draw(const DrawArgs &args) override
Draws the framebuffer to the NanoVG scene, re-rendering it if necessary.
float oversample
Definition FramebufferWidget.hpp:18
Occurs after the Window (including OpenGL and NanoVG contexts) are created.
Definition Widget.hpp:501
Occurs before the Window (including OpenGL and NanoVG contexts) are destroyed.
Definition Widget.hpp:511
Occurs when the pixel buffer of this module must be refreshed.
Definition Widget.hpp:457
Definition Widget.hpp:141
A node in the 2D scene graph.
Definition Widget.hpp:21