Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ACCUM.C
Package: 《OpenGL三维图形系统开发与实用技术》书的源码.rar [view]
Upload User: tengyuc
Upload Date: 2007-08-14
Package Size: 722k
Code Size: 1k
Category:
OpenGL program
Development Platform:
Visual C++
- #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();
- }