Created
September 25, 2012 15:40
-
-
Save kenpower/3782654 to your computer and use it in GitHub Desktop.
Drawing regular polygons in OpenGL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const double PI=3.14159265358979323846; | |
double r=100; | |
int sides=10; | |
glBegin(GL_LINE_STRIP); | |
for(int i=0;i<sides;i++){ | |
double angle=i*2*PI/sides; | |
glVertex2d(400+r*cos(angle),300+r*sin(angle)); | |
} | |
glEnd(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment