Horje
opengl draw semi circle c++ Code Example
opengl draw semi circle c++
//semi-circle roof
	//fix variable naming
	int centerx = 400;//x axis center
	int centery = 400;//y axis center
	int roofr = 100;//radius
	int roofd = 200;//diameter
	float PI = 3.141592653589793238f;
	float semicircleangle = PI * 1.0f;
	int steps = 100;
	glBegin(GL_TRIANGLE_FAN);

	for (int i = 0; i < steps; i++) {
		float theta = semicircleangle * float(i) / float(steps);//get the current angle
		float x = roofr * cosf(theta);//calculate the x component
		float y = roofr * sinf(theta);//calculate the y component
		glVertex2f(x + centerx, y + centery);//output vertex

	}
	glEnd();




Cpp

Related
convert char to int c++ Code Example convert char to int c++ Code Example
static Code Example static Code Example
__builtin_popcount Code Example __builtin_popcount Code Example
udo apt install dotnet-sdk-5 Code Example udo apt install dotnet-sdk-5 Code Example
gettimeofday header file Code Example gettimeofday header file Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11