I’m iteratively drawing lines in
ofApp::draw() inside an fbo!
What would be a good strategy to export the final drawing to a SVG?
Here’s what I’ve tried so far, but only the background gets exported:
Is this even possible?
fbo is raster (pixels) – are you trying to save vector data (with svg)?
you can always do this:
to save an fbo to an image.
Hm, that’s unfortunate… I’d like an SVG for my pen plotter.
Since, you already helped with my previous issue, you may remember that I need fbo for the display/drawing to turn out right, because of the GPU issue.
Could I for instance store geometry objects parallel to the drawing procedure and save those to SVG at the end?
What should I use instead of
ofLine(..) , which has been depreciated, to create line objects?
Can I use ‘ofBeginSaveScreenAsSVG(“test.svg”);’ with a C++ vector of line types, or even iteratively, meaning adding line by line during the drawing procedure? Or does this require things to be drawn to work (i.e.
Thanks again, @zach! And thanks for openFrameworks also!!
Happy to report that I finally came up with a solution myself.
The problem of the depreciated
ofLine(), I solved by creating my own line structure that has its own draw function, where it uses
ofDrawLine(). This weirdly enough even solves the GPU issue, where the first few frames were not drawn without the use of FBO.
The SVG export now works with
ofEndSaveScreenAsSVG(). What I do is save my line objects in
ofApp::update(), once they are created, inside a C++ vector.
ofApp::draw() method, I only iterate through that vector and call the
draw() method of each line object, which displays the lines. The SVG export can also be triggered here by pressing a key on the keyboard.
Works like a charm!