MMSGURU's Techno Blog | home | subscribe | contact | admin |
Wednesday, September 8th  
Couple of efficient 2D graphix algorithms
When searching for the most efficient way to draw primitives on OpenGL ES I found the following two extremely elegant.

Circle / Circle Arc

Drawing a circle and a circle arc is usually done using the standard algorithm we learned from school. Well, as usual, that is not the most efficient way to do it.

Have a look at this page for a much more efficient implementation and its very easy to understand explanation:
An Efficient Way to Draw Approximate Circles in OpenGL (mirrored version)
Please note that this page is a mirrored version of the Google cached version of SiegeLord's Abode original page / article. A few days ago that page went down, hence I decided to mirror it as I found it really usefull. The original URL was: http://slabode.exofire.net/circle_draw.shtml - if that page ever comes back up again (you should try that right now), please send me a note!

Curved Line (aka Bezier Curve aka Spline)

This one isn't usually something you learn at school but later at university. Well, I have to confess I never really grasped the common bezier algorithm during my studies at university, hence I usually copy-pasted it from other sources. Until yesterday, that is. A really good coder I met ages ago on some demo parties has released his implementation into public back in '99 but I didn't visit his site for about the same duration.
The implementation is so simple, one really has to be mentally challenged to not understand it. So have a look at Nils Pipenbrinck's well documented way of drawing a cubic bezier curve:
http://www.cubic.org/docs/bezier.htm

May 2nd, 2009 - 03:21 am | permalink