下面是一个使用 C++ 和 OpenGL 绘制图形并添加颜色的示例代码: #include <GL/glut.h> void display() { glClearColor(0.0, 0.0, 0.0