Drawing application


I’m trying to do a drawing application with OF, so when you move your mouse it should look like you are painting on the screen.
I’m trying to start off by doing this with a polyline in hopes it will at least look like a pen drawing. so far it’s one straight line that follows your mouse but it does not curve. I’ve also been using ofpath but not sure which one is better for what I want to do.I’m hoping someone can point me in the right direction. Thanks

ofPolyline myline;  
    myline.bezierTo(mouseX,mouseY, mouseX,mouseY,mouseX, mouseY);  

The start and end vectors are mouse positions.

I think the first thing you will need to do is to store mouse positions to have a last mouse position and the current mouse position. Like these you can calculate mouse directions and velocity. Now in the piece of code you post only use current position.

And then you will have to play to archive a nice rendering. Look in forum these is a topic many people had look. Here one old post talking about paint brush: http://forum.openframeworks.cc/t/how-to-create-a-painting-brush/3144/0

Dedre you may also check this repository.


I think it´s from a Workshop Zach Lieberman gave at Eyeo 2012 about creating drawing apps with openFrameworks. It has really nice progressive examples, from basic an more complex ones. I found the examples really useful.



Oh great! thanks:)