drawing circle in VGA mode

This is a discussion on drawing circle in VGA mode within the C Programming forums, part of the General Programming Boards category; oke heres the code that defines the circle Code: int circle(int color,int centerx,int centery,int r) { int x,y; float a; ...

  1. #1
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109

    drawing circle in VGA mode

    oke heres the code that defines the circle
    Code:
    int circle(int color,int centerx,int centery,int r)
    {
    	int x,y;
    	float a;
    	float pi=3.1415927;
    	for(a=0;a<2*pi;a=a+pi/180){
    															x=cos(a)*r+centerx;
    															y=sin(a)*r+centery;
    															setpix(color,x,y);
    															}
    
    	return 0;
    	}
    and this is the code that draws 100 circles in different colours
    Code:
    time_t t;
      srand((unsigned) time_t(&t));
      for(i=0;i<100;i++){
    						  color=rand()%15;
    						  circle(color,160,100,100-i);
    						  
    						  }
    now my problem is that this is going very ...and i mean very slow
    i dont think my comp is the problem but rather the code that eats memory....
    Any suggestions on how to make this go faster???

  2. #2
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    thx ill do the two pi thing so the comp doenst need to calculate that much and ill check the manual ....
    and sry about the tabs it kinda got messed up during the "pasting proces" i guess

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Drawing circle into a bitmap file
    By brokensail in forum C++ Programming
    Replies: 2
    Last Post: 10-30-2006, 01:26 AM
  2. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  3. Drawing a circle using glut...
    By bennyho03 in forum C Programming
    Replies: 6
    Last Post: 10-18-2004, 11:06 AM
  4. Dev-C++ VGA mode problems...
    By Ace Bowers in forum C++ Programming
    Replies: 9
    Last Post: 07-17-2003, 10:39 AM
  5. Drawing a circle in a video captured frame
    By skyhigh in forum C Programming
    Replies: 2
    Last Post: 12-05-2001, 01:00 AM

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