Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: no idea how to create round 2d objects using vertices

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2012
    Location
    Luxemburg
    Posts
    1

    no idea how to create round 2d objects using vertices

    Like the title is telling...
    I have no idea how to create that, can someone please help me or send a link where I can find this informations please, thank´s

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,135
    Circles? Ellipses? You need two things, a mathematical description of your problem, i.e. how can a circle be defined mathematically, and some algorithm to generate vertices. For a filled circle, in contrast to a circle only rendered as a a number if line segments, you'll need a center vertex and some vertices at distance r (where r is the radius of the circle). Then you simply define a series of triangles which describe the form of the circle. The more triangles you generate, the better the approximation of the circle.

    Check out http://en.wikipedia.org/wiki/Circle and there especially the parametric form of a circle. Since you're in 2D you'll have it especially easy.

  3. #3
    Junior Member Regular Contributor Kopelrativ's Avatar
    Join Date
    Apr 2011
    Posts
    214
    There may be an easy solution in 2d, which is using a quad where you use a texture that is a picture of a circle, and transparent elsewhere.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •