- Работа с прозорци
- auxInitDisplayMode
- (AUX_SINGLE | AUX_RGBA | AUX_DEPTH);
- auxInitPosition (0, 0, 500, 500);
- auxInitWindow ("Name");
- Обработка на събития – задаване на функции
- auxReshapeFunc (myReshape);
- auxKeyFunc() и auxMouseFunc()
- auxMainLoop(display);
- auxIdleFunc()
- Изчертаване
- void auxWireSphere(radius);
- void auxSolidSphere(radius);
- void auxWireTorus(innerRadius, outerRadius);
- void auxSolidTorus(innerRadius, outerRadius);
- auxWireCone(rad, h); auxWireCylinder(rad, h);
- auxSolidCone(rad,h); auxSolidCylinder(rad, h);
- 6. Анимация
- ...
- float spin=0.0;
- ...
- void CALLBACK display(void)
- {
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClear(GL_COLOR_BUFFER_BIT );glLoadIdentity();
- glTranslatef(1.0,1.0,0.0);
- glRotatef(spin, 0.0, 0.0, 1.0);
- glTranslatef(-1.0,-1.0,0.0);
- glColor3f(1.0, 1.0, 1.0);
- glBegin(GL_POLYGON);
- glVertex3f(0.5,0.5,0.0);
- glVertex3f(0.5,1.5,0.0);
- glVertex3f(1.5,1.5,0.0);
- glVertex3f(1.5,0.5,0.0);
- glEnd();
- glFlush();
- auxSwapBuffers();
- }
void CALLBACK animate(void) - void CALLBACK animate(void)
- {
- spin = spin + 2.0;
- if (spin > 360.0)
- spin = spin - 360.0;
- display();
- }
- int WINAPI WinMain(...) {
- auxInitDisplayMode (AUX_DOUBLE | AUX_RGBA | AUX_DEPTH);
- auxInitPosition (0, 0, 500, 500);
- auxInitWindow ("OpenGL");
- myinit();
- auxReshapeFunc (myReshape);
- auxIdleFunc(animate);
- auxMainLoop(display);
- return 1;
- }
Сподели с приятели: |