ACCUM.C
上传用户:tengyuc
上传日期:2007-08-14
资源大小:722k
文件大小:1k
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <GL/glut.h>
- GLint thing1, thing2;
- static void Init(void)
- {
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClearAccum(0.0, 0.0, 0.0, 0.0);
- thing1 = glGenLists(1);
- glNewList(thing1, GL_COMPILE);
- glColor3f(1.0, 0.0, 0.0);
- glRectf(-1.0, -1.0, 1.0, 0.0);
- glEndList();
- thing2 = glGenLists(1);
- glNewList(thing2, GL_COMPILE);
- glColor3f(0.0, 1.0, 0.0);
- glRectf(0.0, -1.0, 1.0, 1.0);
- glEndList();
- }
- static void Reshape(int width, int height)
- {
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- }
- static void Draw(void)
- {
- glPushMatrix();
- glScalef(0.8, 0.8, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
- glCallList(thing1);
- glAccum(GL_LOAD, 0.5);
- glClear(GL_COLOR_BUFFER_BIT);
- glCallList(thing2);
- glAccum(GL_ACCUM, 0.5);
- glAccum(GL_RETURN, 1.0);
- glPopMatrix();
- glutSwapBuffers();
- }
- int main(int argc, char **argv)
- {
- GLenum type;
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_RGB | GLUT_ACCUM | GLUT_DOUBLE);
- glutInitWindowSize(300, 300);
- glutCreateWindow("Accum Test");
- Init();
- glutReshapeFunc(Reshape);
- glutDisplayFunc(Draw);
- glutMainLoop();
- }