Created
October 23, 2013 09:57
-
-
Save robbielynch/7115778 to your computer and use it in GitHub Desktop.
C++ Code to draw an isosagon using the SFML library.
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
int points = 20; | |
double totRads = 2 * 3.14159; | |
double angle = totRads / points; | |
int r = 200; | |
int pointNum = 1; | |
int originY = 300; | |
int originX = 300; | |
glBegin(GL_LINE_LOOP); | |
for(int i = 1; i <= points; i++){ | |
int x = r*cos(angle * pointNum) + originX; | |
int y = r*sin(angle * pointNum) + originY; | |
glColor3d(200,0,0); | |
glVertex2d(x, y); | |
pointNum++; | |
} | |
glEnd(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment