pradeep_cherian

08-18-2005, 05:29 AM

Hi all,

How can i draw a circle centered at (x,y,z)

The following piece of code can be used to draw circle centered at (x,y)

const float DEG2RAD = 3.14159/180;

glBegin (GL_LINE_LOOP);

float r = 10;

int i=0;

while i less than 360

{

float degInRad = 2 * i * DEG2RAD;

glVertex2f(x + cos(degInRad) * r,y + sin (degInRad) * r);

i++;

}

glEnd();

What are the changes that i need to make inorder to draw the circle centered at (x,y,z)?

I dont want to use glRotate or glTranslate fuctions.

Please suggest a solution..

thanks

Pradeep

How can i draw a circle centered at (x,y,z)

The following piece of code can be used to draw circle centered at (x,y)

const float DEG2RAD = 3.14159/180;

glBegin (GL_LINE_LOOP);

float r = 10;

int i=0;

while i less than 360

{

float degInRad = 2 * i * DEG2RAD;

glVertex2f(x + cos(degInRad) * r,y + sin (degInRad) * r);

i++;

}

glEnd();

What are the changes that i need to make inorder to draw the circle centered at (x,y,z)?

I dont want to use glRotate or glTranslate fuctions.

Please suggest a solution..

thanks

Pradeep