-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
72 lines (47 loc) · 2.42 KB
/
Copy pathmain.cpp
File metadata and controls
72 lines (47 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "WindowHandler.h"
#include <AntTweakBar.h>
#include "armadillo"
using namespace std;
WindowHandler *mainWindow = 0;
void display(void) { mainWindow->display(); }
void idle(void) { mainWindow->idle(); }
void reshape(int width, int height) { mainWindow->reshape(width, height); }
void mouse(int button, int state, int x, int y) { mainWindow->mouseButtonEvent(button,state,x,y); }
void move(int x, int y) { mainWindow->mouseMoveEvent(x,y); }
void processNormalKeys(unsigned char key, int x, int y) { mainWindow->processNormalKeys(key, x, y); }
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
TwInit(TW_OPENGL, NULL);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
mainWindow = new WindowHandler();
GLenum err = glewInit();
mainWindow->init();
glClearColor(1., 1., 1., 0.);
glDisable(GL_DEPTH_TEST);
glutDisplayFunc(display);
glutReshapeFunc(reshape);
/*glutKeyboardFunc(processNormalKeys);
glutMouseFunc(mouse);
glutMotionFunc(move);*/
// Set GLUT event callbacks
// - Directly redirect GLUT mouse button events to AntTweakBar
glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT);
// - Directly redirect GLUT mouse motion events to AntTweakBar
glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
// - Directly redirect GLUT mouse "passive" motion events to AntTweakBar (same as MouseMotion)
glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
// - Directly redirect GLUT key events to AntTweakBar
glutKeyboardFunc((GLUTkeyboardfun)TwEventKeyboardGLUT);
// - Directly redirect GLUT special key events to AntTweakBar
glutSpecialFunc((GLUTspecialfun)TwEventSpecialGLUT);
// - Send 'glutGetModifers' function pointer to AntTweakBar;
// required because the GLUT key event functions do not report key modifiers states.
TwGLUTModifiersFunc(glutGetModifiers);
//TwDefine(" GLOBAL help='This example shows how to integrate AntTweakBar with GLUT and OpenGL.' "); // Message added to the help bar.
//TwDefine(" TweakBar size='60 60' color='96 216 224' "); // change default tweak bar size and color
glutIdleFunc(idle);
glutMainLoop();
TwTerminate();
return 0;
}