I am a total newbie, 1 week in, so please ignore the lack of knowledge. I am trying to draw the letter N made out of either lines, polygons or triangles. I didnt want to do the easy 3 straight lines, so i am instead attempting to do it more fancy. So i decided to try polygons, but the problem is my N doesnt look very good and the code is problably all wrong. I would be so greatful if anyone could take a look at my code and advise or help me in making improvements to both the code and the letter N. Thanks
#include "stdafx.h"
#include "glut.h"
#include <stdlib.h>
void init(void)
{
glClearColor (0.0, 0.0, 0.85, 0.0);
glMatrixMode (GL_PROJECTION); //Viewport
gluOrtho2D( 0.0,400.0,0.0,400.0); //Viewport, i.e., camera position.
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glLineWidth (3.0);
glVertex2f(50.0, 50.0);
glVertex2f(50.0, 325.0);
glColor3f (1.0, 0.0, 0.0);
glVertex2f(50.0, 50.0);
glVertex2f(85.0, 50.0);
glColor3f (2.0, 0.0, 0.0);
glVertex2f(85.0, 50.0);
glVertex2f(85.0, 135.0);
glColor3f (3.0, 0.0, 0.0);
glVertex2f(85.0, 135.0);
glVertex2f(50.0, 325.0);
glColor3f (4.0, 0.0, 0.0);
glEnd();
glColor3f (0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex2f(100.0, 50.0);
glVertex2f(50.0, 325.0);
glColor3f (1.0, 0.0, 0.0);
glVertex2f(50.0, 325.0);
glVertex2f(145.0, 50.0);
glColor3f (2.0, 0.0, 0.0);
glVertex2f(145.0, 50.0);
glVertex2f(100.0, 50.0);
glEnd();
glColor3f (0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex2f(145.0, 50.0);
glVertex2f(145.0, 325.0);
glColor3f (3.0, 0.0, 0.0);
glVertex2f(145.0, 325.0);
glVertex2f(145.0, 325.0);
glColor3f (2.0, 0.0, 0.0);
glVertex2f(145.0, 325.0);
glVertex2f(105.0, 166.0);
glColor3f (1.0, 0.0, 0.0);
glVertex2f(105.0, 166.0);
glVertex2f(145.0, 50.0);
glEnd();
glFlush ();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (700, 400);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}