#include <GL/glut.h>
void display()
{
//clear all pixels
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.5451,0.27059,0.0); //设置颜色为棕色
glBegin(GL_POLYGON);
glVertex3f(0.5,0.75,0);
glVertex3f(1.0,0.25,0);
glVertex3f(0.95,0.25,0);
glVertex3f(0.5,0.85,0);
glVertex3f(0.05,0.25,0);
glVertex3f(0.0,0.25,0);
glEnd();
glColor3f(1.0,1.0,1.0);
glBegin(GL_LINE_STRIP);
glVertex3f(0.85,0.35,0);
glVertex3f(0.85,-0.25,0);
glVertex3f(0.15,-0.25,0);
glVertex3f(0.15,0.35,0);
glEnd();
glColor3f(1.0,1.0,1.0);
glBegin(GL_LINE_LOOP);
glVertex3f(0.25,0.25,0);
glVertex3f(0.25,0.1,0);
glVertex3f(0.4,0.1,0);
glVertex3f(0.4,0.25,0);
glEnd();
glBegin(GL_LINES);
glVertex3f(0.25,0.175,0);
glVertex3f(0.4,0.175,0);
glVertex3f(0.325,0.25,0);
glVertex3f(0.325,0.1,0);
glEnd();
glBegin(GL_LINE_LOOP);
glVertex3f(0.6,0.25,0);
glVertex3f(0.6,0.1,0);
glVertex3f(0.75,0.1,0);
glVertex3f(0.75,0.25,0);
glEnd();
glBegin(GL_LINES);
glVertex3f(0.6,0.1
C++画房子的代码
最新推荐文章于 2024-06-18 23:05:05 发布
本文介绍如何利用C++编程语言结合OpenGL库来实现三维空间中画房子的过程,详细探讨了代码结构和关键步骤,适合初学者学习。
摘要由CSDN通过智能技术生成