DEV Community


Posted on

Drawing a Semi-Circle using OpenGL - glfw/glew c++

In this article, we are going to draw a semi-circle using OpenGL, glfw - c++.

I'll be referring back to the previous tutorial: link here:

Before going in to the details, locate the first line in the drawCircle function and remove the * 2 so that you have this:

float theta = 3.1415926 / float(num_segments);
Enter fullscreen mode Exit fullscreen mode

In mathematics, a full circle, having 360 degrees, can be represented in Radian measure as 2 PI. Simple logic then tells us that 180 degrees is simply PI. Hence, in the code, to convert the full circle into a semi circle, all we did was to remove the * 2.

Reading more on Radian measure and deeper concepts might help, but I hope this simplistic explanation helped.

Happy coding!

Top comments (0)