效果
程序如下:
/*
* File: main.c
* Author: leo
*
* Created on 2011年8月22日, 下午4:42
*/
#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
//called to draw scene
void RenderScene(void)
{
//clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
//flush drawing commands
glFlush();
}
//set up the rendering state
void SetupRC(void)
{
glClearColor(0.0f,0.0f,1.0f,1.0f);
}
int main(int argc, char** argv) {
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow("Test Glut");
glutDisplayFunc(RenderScene);
SetupRC();
glutMainLoop();
return (EXIT_SUCCESS);
}
转载于:https://www.cnblogs.com/shaoguangleo/archive/2011/08/23/2805976.html