#include <GL/glut.h>
void myDisplay()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0f, 1.0f, 1.0f);
glRectf(-1.0f, -1.0f, 1.0f, 1.0f);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(0.0f, 1.0f);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(0.8f, -0.5f);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(-0.8f, -0.5f);
glEnd();
<
void myDisplay()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0f, 1.0f, 1.0f);
glRectf(-1.0f, -1.0f, 1.0f, 1.0f);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(0.0f, 1.0f);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(0.8f, -0.5f);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(-0.8f, -0.5f);
glEnd();
<