On 6/15/2010 2:07 AM, Theo Ribeiro wrote:
Hi Tom!
Thank you for your reply. I can see now tons of tutorials and examples around
on 2D shapes. I guess I was just using the wrong keywords for my searches.
Kinda embarassing... sorry about that.
Anyway, I managed to create some 2d objects but I'm still struggling with
creating a 2D circle for my halo. I could draw it by adding a lot of points to
an array and then drawing using the LINE_LOOP primitive. The only problem is
that even though I'm using a simple circle equation (x^2 + y^2 = radius^2) and
adding a LOT of points, the circle is still a little squared. Also, I'm worried
about the cost of solving the math involved.
Do you think of a better way to draw it?
It's always been hard to draw a nice circle using line segments :-) On
today's graphics cards, though, I wouldn't sweat using even several
hundred vertices for a circle, if you need them. The GPU should still
be able to tear through it pretty quickly.
As far as the math goes, you only need to construct the circle at
startup time. Just create an osg::Geometry containing the vertices and
LINE_LOOP primitive set, and keep it around (using a ref_ptr) until you
need it. You can even attach it in multiple places in the scene graph
if you need more than one halo on the screen at the same time.
--"J"
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org