QUADS指的是四边形,
每给出4个点,就绘制一个四边形;
给出5-7个,还是一个四边形
程序运行截图如下:
伪代码如下:
void Draw() {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glColor4ub(255, 0, 0, 255); glVertex3f(-0.5f, -0.25f, -2.5f);
glColor4ub(0, 0, 255, 255); glVertex3f(0.5f, -0.25f, -2.5f);
glColor4ub(0, 255, 0, 255); glVertex3f(1.0f, 0.5f, -2.5f);
glColor4ub(255, 0, 0, 255); glVertex3f(0.5f, 0.5f, -2.5f);
glEnd();
}