本文使用的是glut库:
#include "stdafx.h"
#include <GL/glut.h>
void init(void)
{
glClearColor(0.0f,0.0f,0.0f,0.0f);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0f,0.0f,0.0f);
glLoadIdentity();
glTranslatef( 0.0f, 0.0f , -1.0f);
//draw a square