Keyboard2 openGL keyboad, timer / 키보드 콜백과 타이머 타이머를 이용하여 계속 회전 시키기 #include #include #include #include #include int zRotate = 0; unsigned char key = 'z'; void MyDisplay() { glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); //이전 상태 초기화 후 변환 glRotatef(zRotate, 0.0, 0.0, 1.0); //z를 중심을 회전 glutWireTeapot(0.5); glFlush(); } void MyKeyboard(unsigned char KeyPressed, int X, int Y) { key = KeyPressed; switch (KeyPressed) { case 'Q':case'q': exit(0); b.. 2020. 5. 3. OpenGL 키보드 콜백 회전 회오리 #include #include #include #include #include #include using namespace std; int zRotate = 0; void MyDisplay() { glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); //이전 상태 초기화 후 변환 glRotatef(zRotate, 0.0, 0.0, 1.0); //z를 중심을 회전 glutSolidTeapot(0.5); glFlush(); } void MyKeyboard(unsigned char KeyPressed, int X, int Y) { switch (KeyPressed) { case 'Q':case'q': exit(0); break; case 'Z': zRotate += 10; b.. 2020. 4. 25. 이전 1 다음