Click to See Complete Forum and Search --> : how to draw circles using directx9.0


yln
April 28th, 2006, 10:54 PM
hello folks,
can anyone tell me simple method to draw circles around a perticular object in the world

nolxev
April 29th, 2006, 06:45 AM
DirectX have not routine to draw circles as I know, maybe there is an utility library for that but I don't know anyone. You can implement your own a routine to draw circle with some simple math. A complete turn along the circumference is (2 * PIGRECO), so you can divide the circumference to chunks and with LINE_STRIP you can draw your circle:

#define PIGRECO 3.14159f

float radius = 1.0f;
float smoothness = 0.05f;

float center_x= 0.0f;
float center_y= 0.0f;

BEGIN_WITH_LINE_STRIP_METHOD

for(float angle= 0.0f; angle<= (2.0f * PIGRECO); angle += smoothness)
{
float x = center_x + (radius* (float)sin(angle));
float y = center_y + (radius* (float)cos(angle));

DRAW_LINE_TO_XY
}

To improve circle smoothness decrease the "smoothness" value.

golanshahar
April 29th, 2006, 04:20 PM
This article might help: Drawing with DirectDraw & GDI (http://www.codeproject.com/directx/drawing.asp?print=true)

Cheers

Rich2189
April 30th, 2006, 03:01 PM
Nice Tutorial, how would i go about drawing a few spheres then rotating them?

Mike Harnad
May 1st, 2006, 09:37 AM
Take a look at the "samples browser" that comes with DirectX. You'll find helpful samples, articles, and tutorials.