局部坐标系-----
世界坐标系--
投影坐标系---(通过假想摄像机的位置和方向进行)
规范化坐标系----(坐标范围从-1到1 或者 从0到1,清除显示设备上观察边界之外的图形部分)
设备坐标系-----(图形扫描转换到光栅化系统的刷新缓存中进行显示)
GL:Graphic Library。
函数库:gl,glu,glut(包含了gl.h和glu.h的引用),
#include <iostream>
#include<stdio.h>
#include<OpenGL/OpenGL.h>
#include<GLUT/GLUT.h>
//图形几何描述代码
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25,0.25,0.0);
glVertex3f(0.75,0.25,0.0);
glVertex3f(0.75,0.75,0.0);
glVertex3f(0.25,0.75,0.0);
glEnd();
glFlush();
}
//设置初始化和有关的一次性设定参数
void init(void)
{
glClearColor(0.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0,1.0,0.0,1.0, -1.0,1.0);
}
int main(int argc,char * argv[]) {
// insert code here...
std::cout <<"Hello, World!\n";
glutInit(&argc, argue);//init GLUT.
glutInitDisplayMode(GLUT_SINGLE |GLUT_RGB);
glutInitWindowSize(250,250);//Init Window .
glutInitWindowPosition(100,100);
glutCreateWindow("hello");
init();
glutDisplayFunc(display);//window show content by display function.
glutMainLoop();//窗口和其中的图形被激活。
return 0;
}