title: Drawing big circles from scratch
body: <p>I am new to C++, but the language seems alright to me. As a learning project I have decided to make a minor 2D graphic-engine. It might seem like a hard project, but I have a good idea how to move on.</p>
  
  <p>I havn't really started yet, but I am forming things in my head at the moment, when I came across this problem:
  At some point I will have to make a function to draw circles on the screen. My approach to that right now would be something like this:</p>
  
  <pre><code>in a square with sides from (x-r) to (x+r) loop through x and y,
  if at each point, the current distance sqr(x^2+y^2) is less than or equal to r
  , then draw a pixel at that point.
  </code></pre>
  
  <p>This would work, if not, dont bother telling me, I'll figure it out. I would of cause only draw this circle if the x+r &amp; y+r is on the screen.</p>
  
  <p>The problem lies in that I will need to draw really big circles sometimes. If for example I need to draw a circle with radius 5000, the (if pixel loop calculations would need loop a total of 10000^2 times). So with a processor at 2Ghz, this single circle would only be able to render 2Ghz/(10000^2) which is ~22 times/s while taking up the whole core (believing it only takes one calculation per pixel, which is nowhere the truth).</p>
  
  <p>Which approach is the correct one now? I guess it has something to do with using the GFX for these simple calculations. If so, can I use OpenGL for C++ for this? I'd like to learn that as well :)</p>