Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "objectrotation.h"
- GLfloat point[3] = {0, 0, 0};
- GLfloat trajectory[3] = {0, 0, 0};
- GLfloat angle = 0;
- void display(void)
- {
- glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- // Clear current projection matrix to identity.
- glLoadIdentity();
- glutSwapBuffers();
- }
- // Keyboard input processing routine.
- void keyInput(unsigned char key, int x, int y)
- {
- switch(key)
- {
- // Press escape to exit.
- case 27:
- exit(0);
- break;
- default:
- break;
- }
- }
- void ChangePosition(int)
- {
- //glutPostRedisplay();
- cout << "TOCHKA.\n";
- for(int i = 0; i < 3; i++)
- {
- cout << "VVOD: ";
- cin >> point[i];
- }
- cout << "\nVECTOR.\n";
- for(int i = 0; i < 3; i++)
- {
- cout << "VVOD: ";
- cin >> trajectory[i];
- }
- cout << "\nUGOL: ";
- cin >> angle;
- glTranslatef(point[0], point[1], point[2]);
- glRotatef(angle, trajectory[0], trajectory[1], trajectory[2]);
- glTranslatef(-point[0], -point[1], -point[2]);
- glutTimerFunc(2, ChangePosition, 0);
- }
- void main(int argc, char** argv)
- {
- Object cube;
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE|GLUT_DEPTH);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(700, 700);
- glutCreateWindow("Try GLUI");
- glutDisplayFunc(display);
- glClearColor(1, 1, 1, 0);
- glutDisplayFunc(cube.RenderObject);
- glutTimerFunc(0.1, ChangePosition, 0);
- glutMainLoop();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement