I want to write a program with two buffers and have a frame rate of 30 frames per second showing in the console. I'm using Open GL - C++
Display()
{
glutSwapBuffers();
}
Timer for fps:
void mytimer(int fps)
{
glutTimerFunc(1000/30 , mytimer, 0);
glutPostRedisplay();
}
This code draws a line but I want to draw a line at a frame rate 30 fps.
void drawScene (void){
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glVertex2f(0.0,0.0);
glVertex2f(120.0,120.0);
glEnd();
glFlush();
}
int main (int argc ,char** argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB);
glutInitWindowSize(360,360);
glutCreateWindow("mohammad");
initRendering();
mytimer(fps);
//glutDisplayFunc(drawScene);
glutDisplayFunc(Display);
glutMainLoop();
return (0);
}