Hi i am new here and i am having trouble trying to draw the letter A shape. I have vertices but i can not figure where they go. Here is my code…
#include “glew.h”
#include “freeglut.h”
#include “glext.h”
#pragma comment(lib, “glew32.lib”)
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
static int isWire = 0; // Is wireframe?
// Drawing routine.
void drawScene(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 0.0, 0.0);
// Draw a polygon with specified vertices.
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//if (isWire) glPolygonMode(GL_FRONT, GL_LINE); else glPolygonMode(GL_FRONT, GL_FILL);
glBegin(GL_TRIANGLE_STRIP);
glVertex3f(10.0, 20.0, 0.0);
glVertex3f(18.0, 36.0, 0.0);
//glVertex3f(14.0, 20.0, 0.0);
//glVertex3f(12.0, 24.0, 0.0);
//glVertex3f(16.0, 24.0, 0.0);
//glVertex3f(14.0, 28.0, 0.0);
//glVertex3f(18.0, 28.0, 0.0);
//glVertex3f(20.0, 32.0, 0.0);
//glVertex3f(16.0, 32.0, 0.0);
//glVertex3f(24.0, 32.0, 0.0);
//glVertex3f(22.0, 36.0, 0.0);
//glVertex3f(20.0, 32.0, 0.0);
//glVertex3f(26.0, 28.0, 0.0);
//glVertex3f(22.0, 28.0, 0.0);
//glVertex3f(28.0, 24.0, 0.0);
//glVertex3f(24.0, 24.0, 0.0);
//glVertex3f(30.0, 20.0, 0.0);
//glVertex3f(26.0, 20.0, 0.0);
glEnd();
glFlush();
}
// Initialization routine.
void setup(void)
{
glClearColor(1.0, 1.0, 1.0, 0.0);
}
// OpenGL window reshape routine.
void resize(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 100.0, 0.0, 100.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
// Keyboard input processing routine.
/void keyInput(unsigned char key, int x, int y)
{
switch (key)
{
case 27:
exit(0);
break;
default:
break;
}
}/
// Keyboard input processing routine.
void keyInput(unsigned char key, int x, int y)
{
switch (key)
{
case ’ ':
if (isWire == 0) isWire = 1;
else isWire = 0;
glutPostRedisplay();
break;
case 27:
exit(0);
break;
default:
break;
}
}
// Routine to output interaction instructions to the C++ window.
void printInteraction(void)
{
cout << “Interaction:” << endl;
cout << “Press the space bar to toggle between wirefrime and filled for the lower annulus.” << endl;
}
// Main routine.
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitContextVersion(3, 3);
glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutInitWindowSize(500, 500);
glutInitWindowPosition(100, 100);
glutCreateWindow("square.cpp");
glutDisplayFunc(drawScene);
glutReshapeFunc(resize);
glutKeyboardFunc(keyInput);
glewExperimental = GL_TRUE;
glewInit();
setup();
glutMainLoop();
}