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:
![ishaqkassam](https://res.cloudinary.com/practicaldev/image/fetch/s--8qmG2NkX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--m9Fr41ts--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/579544/a42e752b-d748-49bd-afcb-83e16c2e99ab.jpg)
Drawing a Circle using OpenGL - glfw/glew c++
IshaqKassam ・ Nov 8 '21 ・ 1 min read
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);
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)