9 Widget::Widget(QWidget *parent, QGLFormat
const &pformat): QGLWidget(pformat, parent) {
25 glewExperimental = GL_TRUE;
26 GLenum err = glewInit();
29 qDebug() <<
reinterpret_cast<const char*
>(glewGetErrorString(err));
34 glEnable(GL_FRAMEBUFFER_SRGB);
35 glEnable(GL_DEPTH_TEST);
36 glBlendFunc(GL_ONE, GL_ONE);
38 glEnable(GL_TEXTURE_2D);
40 int width=size().width();
41 SetWindowWidth(width);
43 int height=size().height();
44 SetWindowHeight(height);
46 resize (width,height);
47 int occlusionQuality=0;
48 SetOcclusionQuality(occlusionQuality);
88 int x_new =
event->x();
89 int y_new =
event->y();
92 if (_mouseLeftPressed)
93 _mainapp->
RotateMolecule(0.4*(x_new-_mousePosX),0.4*(y_new-_mousePosY));
94 else if (_mouseRightPressed)
95 _mainapp->
MoveLight(0.5*(x_new-_mousePosX),0.5*(y_new-_mousePosY));
96 else if(_mouseMiddlePressed)
97 _mainapp->
MoveCamera(-0.2*(x_new-_mousePosX),0.2*(y_new-_mousePosY));
111 int x_new =
event->x();
112 int y_new =
event->y();
116 if (event->button() == Qt::LeftButton)
117 _mouseLeftPressed =
true;
118 if (event->button() == Qt::RightButton)
119 _mouseRightPressed =
true;
120 if (event->button() == Qt::MiddleButton)
121 _mouseMiddlePressed =
true;
126 if (event->button() == Qt::LeftButton)
127 _mouseLeftPressed =
false;
128 if (event->button() == Qt::RightButton)
129 _mouseRightPressed =
false;
130 if (event->button() == Qt::MiddleButton)
131 _mouseMiddlePressed =
false;