#include <stdlib.h>
#include <glut.h>
#include <math.h>
#include <stdio.h>
GLsizei width=640;
GLsizei height=480;
GLsizei xwmin=-50;
GLsizei xwmax=50;
GLsizei ywmin=-50;
GLsizei ywmax=50;
void timerFunc(int value) {
glPushMatrix();
glTranslatef(20.0,10.0,0);
glScalef(1.0,2.0,1.0);
glColor3f(0,0,1);
glutSolidCube(10);
glColor3f(1,0,1);
glutWireCube(10);
glPopMatrix();
glutPostRedisplay();
}
void display()
{
glClearColor(1,1,1,0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0,0,1);
glutSolidCube(10);
glColor3f(1,0,1);
glutWireCube(10);
glPushMatrix();
glTranslatef(10.0,10.0,0);
glScalef(1.0,2.0,1.0);
glColor3f(0,0,1);
glutSolidCube(10);
glColor3f(1,0,1);
glutWireCube(10);
glPopMatrix();
glFlush();
}
int main (int argc, char** argv)
{
glutInit(&argc,argv);
glutInitWindowPosition(50,50);
glutInitWindowSize(width,height);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutCreateWindow("attempt1");
glMatrixMode(GL_PROJECTION);
glOrtho(-50,50,-50,50,0,100);
glMatrixMode(GL_MODELVIEW);
gluLookAt(-30,-30,40,0,0,0,0,1,0);
glutDisplayFunc(display);
glutTimerFunc(2000,timerFunc,0);
glutMainLoop();
return 0;
}
i do not see the results of glutTimerFunc… or i see it and it disappears immediately… why??