1 // SimpleTest1.cpp : 定义控制台应用程序的入口点。
2 //
3
4 #include "stdafx.h"
5 #include<gl/glut.h>
6 #include<iostream>
7 using namespace std;
8 void DrawTriggle()
9 {
10 glPointSize(20);
11 glColor4f(1.0,0.0,0.0,0.6);
12 glColor4f(0.5,0.8,0,0.6);
13 glBegin(GL_POINTS);
14 glVertex3f(0.0,0.0,0.0);
15 glVertex3f(0.9,0.0,0.0);
16 glVertex3f(0.9,0.9,0.0);
17 glVertex3f(0.0,0.9,0.0);
18 glEnd();
19 glColor4f(0.3,0,1,0.6);
20 glBegin(GL_POINTS);
21 glVertex3f(-0.9,0.9,0.0);
22 glEnd();
23 glColor4f(1,0,0.1,0.6);
24 glBegin(GL_POINTS);
25 glVertex3f(-0.9,0.0,0.0);
26 glVertex3f(-0.9,-0.9,0.0);
27 glEnd();
28 glColor4f(1,0,0.5,0.1);
29 glBegin(GL_POINTS);
30 glVertex3f(0.9,-0.9,0.0);
31 glVertex3f(0.0,-0.9,0.0);
32 glEnd();
33 glFlush();
34 }
35
36 void init()
37 {
38 glClearColor(1.0,1.0,1.0,0.0);
39 glutInitWindowPosition(300,300);
40 glutInitWindowSize(800,800);
41 glutCreateWindow("simpletest window");
42 gluLookAt(0.0,0.0,-1.0,0.0,0.0,-0.0,-100,0.0,0.0);
43 glutDisplayFunc(&DrawTriggle);
44 }
45 int _tmain(int argc, _TCHAR* argv[])
46 {
47 glutInit(&argc,(char**)argv);
48 glutInitDisplayMode(GLUT_RGBA );
49 init();
50 std::cout<<"out: enter main loop"<<std::endl;;
51 glutMainLoop();
52 return 0;
53 }