#include <GL/gl.h>
#include <glut.h>
float increment = 0;
void renderScene(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f(-0.5-increment,-0.5+increment,0.0+increment);
glVertex3f(0.0+increment,0.5+increment,0.0+increment);
glVertex3f(0.5+increment,-0.5-increment,0.0+increment);
glEnd();
glutSwapBuffers();
increment = increment + 0.01;
}
void timerfunc(int value) {
renderScene();
glutTimerFunc(40, timerfunc, 0);
}
int main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(400,400);
glutCreateWindow("Инкремент координат");
glutDisplayFunc(renderScene);
glutTimerFunc(40, timerfunc, 0);
glutMainLoop();
return 1;
}
|