Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
No, but you can share it yourself. There everything is in one cycle, first input, and then TimerFunc. The input is fast, so it's invisible.
Test code
#include<glut.h>
void Keyboard(unsigned char key, int x, int y)
{
while (true);
}
float angle = 0;
void Draw()
{
angle++;
glLoadIdentity();
glRotatef(angle, 0,0,1);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glVertex3f(1, 1, 0);
glVertex3f(-1, -1, 0);
glEnd();
glFlush();
}
void Time(int)
{
Draw();
glutTimerFunc(0,Time,50);
}
void Init()
{
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0,0,0);
glOrtho(0.0,1,0.0,1, 1,-1);
}
int main(int argv, char** argc)
{
glutInit(&argv, argc);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowPosition(200,200);
glutInitWindowSize(400,400);
glutCreateWindow("hello");
Init();
glutKeyboardFunc(Keyboard);
glutDisplayFunc(Draw);
glutTimerFunc(0,Time,50);
glutMainLoop();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question