#include "glut.h"
void myDisplay(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0f, 1.0f, 0.0f);
glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
glBegin(GL_TRIANGLES);
glColor4f(1.0f, 0.0f, 0.0f,0.0f); glVertex2f(-1.0f, 0.0f);
glColor4f(1.5f, 1.0f, 0.0f,0.0f); glVertex2f(0.0f, 1.0f);
glColor4f(0.0f, 1.0f, 0.0f,0.0f); glVertex2f(1.0f, 0.0f);
glColor4f(0.0f, 0.0f, 0.0f,1.0f); glVertex2f(0.0f, 0.0f);
glEnd();
glPointSize(4);
glBegin(GL_POINTS);
glColor4f(1.0f, 0.0f, 0.0f,0.0f); glVertex2f(-0.2f, -0.2f);
glColor4f(0.0f, 1.0f, 0.0f,0.0f); glVertex2f(0.0f, 0.0f);
glColor4f(0.0f, 0.0f, 1.0f,0.0f); glVertex2f(0.2f, 0.2f);
glColor4f(0.0f, 0.0f, 0.0f,1.0f); glVertex2f(-0.2f, 0.2f);
glEnd();
glFlush();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(100, 100);
glutInitWindowSize(400, 400);
glutCreateWindow("Hello World!");
glutDisplayFunc(&myDisplay);
glutMainLoop();
return 0;
}