Pen Tool With Thickness

Started by
2 comments, last by SuperVGA 12 years, 9 months ago
Hi I am trying to create a "pen tool" like simulation with opengl. I am rendering each point as a circle with a certain radius. It look decent when the user is drawing with a slow speed.

However when the user move the mouse really fast, there would be gaps in between each drawn circle. Is there way to avoid this problem??

Off the top my head, I would think of joining up adjacent points with a line. However I was wondering if this would lead to blocky lines??

regards
Advertisement
Think about it as lines to begin with. The mouse moves from A to B in a single frame, and you want to draw this line, as it represents where the mouse just moved.
Now, normalize a "stepping/direction" unit vector from the line between A and B, and multiply it by a suitable step size.
Then plot a new circle every step along that vector from A, and stop stepping when B has been passed (when distance AB has been travelled).
If the step size is small, the line will appear as just that; a line with rounded edges (while taking longer to draw). Higher step sizes give the line a more jagged look.
It's faster to draw a rectangle (two triangles ;) )connecting the circles at A and B, -and it will always look nice.
a line segment = rectangle + circles at the end

a line segment = rectangle + circles at the end

-Or semicircles if you really intend to save overdraw! tongue.gif

This topic is closed to new replies.

Advertisement