Drawing a cirle

This is a discussion on Drawing a cirle within the Game Programming forums, part of the General Programming Boards category; I was wondering if anyone had some code to draw a circle in DirectX 9? I searched on google for ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    288

    Drawing a cirle

    I was wondering if anyone had some code to draw a circle in DirectX 9?

    I searched on google for a while, and all i could find was a function to draw a sphere

    Any help would be appreciated..

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Triangle Fans make this very easy. If you are not familiar with how they work, read the following link:

    http://msdn.microsoft.com/archive/de...ianglefans.asp

    It should be pretty obvious that you can just create points using sine and consine to make your circle. The more points you have the more the quality will improve. Remeber about the quality / performance trade off. The center of the triangle fan is your circle center. Hope this helps you.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    You should also note to that multiple layers of downward pointing triangle fans produce very nice models for pine trees. The triangle fans will be extremely fast since only one vertex per tri is needed.

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    288
    thanks, ill try that out tonight, but i was wondering, can you set a texture for a circle? and how?

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Do you mean texture the triangle fan representing the circle? Or do you mean use a texture of a circle. If you are talking about the latter, then look into billboarding and set the texture you want as the billboards texture with alpha transparency.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  6. #6
    Registered User
    Join Date
    Aug 2003
    Posts
    288
    well, basically, im trying to make a 3d clock... so i was wondering, would it be better to use a textured quad or a textured circle for the clockface?

  7. #7
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Textured quad.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Drawing HBITMAP into CWnd, Acquired from "screenshot"
    By DeusAduro in forum Windows Programming
    Replies: 6
    Last Post: 07-02-2009, 03:41 PM
  2. Slow drawing code
    By tjpanda in forum Windows Programming
    Replies: 5
    Last Post: 05-09-2008, 05:09 PM
  3. Line Drawing Algorithm
    By Axpen in forum Game Programming
    Replies: 15
    Last Post: 08-01-2005, 06:30 PM
  4. How to do double buffing with win32 drawing?
    By Josh Kasten in forum Windows Programming
    Replies: 2
    Last Post: 03-26-2004, 11:02 PM
  5. drawing minimaps and radar screens.
    By Eber Kain in forum Game Programming
    Replies: 4
    Last Post: 03-08-2002, 10:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21