1 //SimpleTest1.cpp: Defines the entry point of the console application. 2 //3 4#include"stdafx.h"5#include <gl/glut.h>6#include <iostream>7 using namespacestd;8 voidDrawtriggle ()9 {TenGlpointsize ( -); OneGLCOLOR4F (1.0,0.0,0.0,0.6); AGLCOLOR4F (0.5,0.8,0,0.6); - Glbegin (gl_points); -glvertex3f (0.0,0.0,0.0); theglvertex3f (0.9,0.0,0.0); -glvertex3f (0.9,0.9,0.0); -glvertex3f (0.0,0.9,0.0); - glend (); +GLCOLOR4F (0.3,0,1,0.6); - Glbegin (gl_points); +glvertex3f (-0.9,0.9,0.0); A glend (); atGLCOLOR4F (1,0,0.1,0.6); - Glbegin (gl_points); -glvertex3f (-0.9,0.0,0.0); -glvertex3f (-0.9,-0.9,0.0); - glend (); -GLCOLOR4F (1,0,0.5,0.1); in Glbegin (gl_points); -glvertex3f (0.9,-0.9,0.0); toglvertex3f (0.0,-0.9,0.0); + glend (); - Glflush (); the } * $ voidInit ()Panax Notoginseng { -Glclearcolor (1.0,1.0,1.0,0.0); theGlutinitwindowposition ( -, -); +Glutinitwindowsize ( -, -); AGlutcreatewindow ("simpletest window"); theGlulookat (0.0,0.0,-1.0,0.0,0.0,-0.0,- -,0.0,0.0); +Glutdisplayfunc (&drawtriggle); - } $ int_tmain (intARGC, _tchar*argv[]) $ { -Glutinit (&ARGC, (Char**) argv); - Glutinitdisplaymode (GLUT_RGBA); the init (); -std::cout<<"Out:enter main Loop"<<Std::endl;;Wuyi Glutmainloop (); the return 0; -}
Use OpenGL to draw 9 points to understand the meaning of each parameter