draw ofPolyline to ofPixels without an fbo

hi everyone,

I have a challenge – I’m doing some openCV stuff on a background thread and need to get the contents of a polyline into pixels. I can’t use an FBO because GL crashes off of the main thread.

Does anyone know how to do this? Maybe Cairo renderer? I’ve never used it before…

you can use cairo, better to use an ofPath than ofPolyline since cairo will do a better interpolation:

ofPath path;  
ofPtr<ofCairoRenderer> renderer(new ofCairoRenderer);  
ofPtr<ofGLRenderer> glRenderer(new ofGLRenderer);  
ofPixels pixels  

then draw the path in draw as usual and at the end of the draw method or when you are done drawing to pixels:

ofPixels pixels = renderer->getImageSurfacePixels();  
renderer->close(); //optionally if you are done but you can also reuse it if you want to draw something else  

you could also use a renderer collection to combine the glRenderer and the cairo one and render to the screen and pixels simultaneously