#include <GL/gl.h>
#include <GL/glut.h>
static GLdouble points[]={
0.25,0.25,0.0,
0.75,0.25,0.0,
0.75,0.75,0.0,
0.25,0.75,0.0};
void display(void){
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_DOUBLE,0,points);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0,0.0,1.0);
glBegin(GL_POLYGON);
glArrayElement(1);
glArrayElement(2);
glArrayElement(3);
glArrayElement(4);
glEnd();
glFlush();
}
void init(void){
glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_FLAT);
}
int main(int argc,char **argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(250,250);
glutInitWindowPosition(100,100);
glutCreateWindow("Melancoly");
init();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1.0,0.0,1.0,-1.0,1.0);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
Just another beginner question it comes out almost as a square, but has a triangle attached to the bottom.