Drawing lines with the webcam

These days I”ve been playing with the computer vision add-on, trying to understand how it works.
I followed the tutorial that can be found on the openFrameworks wiki called Color Traking (http://wiki.openframeworks.cc/index.php?title=Color_Tracking), and after pasting the code into openFrameworks and testing that everything was working fine, I thought that I will try to do a draw tool using a led and the webcam.

First I did a small drawing program, which draws lines using the mouse.

Learning openFrameworks. Simple Drawing tool from berio on Vimeo.

Then I mixed the drawing tool that I had done and I did the drawing tool using a LED.

Learning openFrameworks. Drawing with a LED from berio on Vimeo.

I set up some keys from the keyboard for hidden the video and for allowing draw. So key v is a switch for showing the video, and key d is a switch for leting draw.

What I want to do next is making shapes with the LED pointer and manages these shapes individually, so for example, I can move them independently through the screen. In order to doing that, I will have to deal with classes and arrays, something that I tried to do before with openFrameworks and I didn”t succeed. Despite I know and understand how classes work in processing, so far I haven”t figured out how to manage them in c++. If anyone knows a good tutorial about classes and .h and .cpp files, I will really appreciate the help.

I will post the code tomorrow.