🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

draw a 4 leaved rose

Started by
2 comments, last by pbivens67 3 years, 1 month ago

I am trying to draw a 4 leaved rose using opengl and polar coordinates, I am able to draw a circle using sin and cos.

	glPushMatrix();
	glColor3f(0.0f, 1.0f, 1.0f);
	glBegin(GL_POINTS);
	float r = 10.0f;
	for (float q = 0.0f; q <= 6.28f; q += 0.01f)
	{
		float r1 = r*cos(2 * q);
		float r2 = r*sin(2 * q);
		glVertex3f(r1, r2, 0.0f);
	}
	glEnd();
	glPopMatrix();
Advertisement

It's hard to resist your programming exercises…

float rLeaf = r*sin(2 * q);
float r1 = rLeaf*cos(q);
float r2 = rLeaf*sin(q);

Works by putting a wave onto the circle, which gives simple precudral lobes. But more a simple flower than a rose.

wow that worked, thank you so much

This topic is closed to new replies.

Advertisement