• Advertisement
Sign in to follow this  

openGL-Draw Circle??

This topic is 3767 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

openGL - I try to code the effect that when I click mouse, it create 3 circle, which the center of 3 circles is the position of mouse click. But I code it, it draw 3 circle but it has a line run through 3 circle. But I draw just 1 circle then there is no line run through. I dont understand how is it this happen? Help please here is the picture http://img.photobucket.com/albums/v59/Rinoaheartilly/battleship.gif Here is how I draw the 3 circle the u[][] tell me how to shift the circle


                       glBegin(GL_LINE_LOOP);
				int i;
				glColor3f(1.0, 0.5, 0.7);
				for(i=0; i<360; i++){
					glVertex2f(circle1[0] + u[circleVisited[row][col]][0] + 0.2, 
						circle1[1] + u[circleVisited[row][col]][1] + 0.2);
				}
				//glColor3f(0.0, 0.9, 0.3);
				//for(i=0; i<360; i++){
				//	glVertex2f(circle2[0] + u[circleVisited[row][col]][0] + 0.2, 
				//	circle2[1] + u[circleVisited[row][col]][1] + 0.2);
				//}
				glColor3f(1.0, 0.5, 0.0);
				for(i=0; i<360; i++){
					glVertex2f(circle3[0] + u[circleVisited[row][col]][0] + 0.2, 
						circle3[1] + u[circleVisited[row][col]][1] + 0.2);
				}
			glEnd();

void drawCircle1(){
	int i;
	for(i=0; i<360; i++){
		float deg = i*DEG2RAD;
		circle1[0] = cos(deg)*radius1; 
		circle1[1] = sin(deg)*radius1;
	}
}
[Edited by - KingdomHeart on October 28, 2007 6:29:59 PM]

Share this post


Link to post
Share on other sites
Advertisement
I may be slightly wrong only just picking up OpenGL but if I understand correctly when using GL_LINE_LOOP the first point and last point will be connected together. See if drawing each circle separately (as in 3 glBegin() glEnd()) will solve the problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement