nuclear@35: #include nuclear@29: #include "ui_xferview.h" nuclear@29: #include "volray.h" nuclear@29: nuclear@35: static int prev_x, prev_y; nuclear@35: nuclear@30: XFerGLView::XFerGLView(QGLWidget *share_widget) nuclear@29: : QGLWidget(QGLFormat(QGL::DoubleBuffer), 0, share_widget) nuclear@29: { nuclear@29: } nuclear@29: nuclear@30: QSize XFerGLView::minimumSizeHint() const nuclear@29: { nuclear@29: return QSize(160, 100); nuclear@29: } nuclear@29: nuclear@30: void XFerGLView::initializeGL() nuclear@29: { nuclear@29: } nuclear@29: nuclear@30: void XFerGLView::resizeGL(int xsz, int ysz) nuclear@29: { nuclear@29: glViewport(0, 0, xsz, ysz); nuclear@29: } nuclear@29: nuclear@30: void XFerGLView::paintGL() nuclear@29: { nuclear@29: volray_draw_xfer(); nuclear@29: } nuclear@35: nuclear@35: void XFerGLView::mousePressEvent(QMouseEvent *ev) nuclear@35: { nuclear@35: prev_x = ev->x(); nuclear@35: prev_y = ev->y(); nuclear@35: } nuclear@35: nuclear@35: void modxfer(int dx, int dy, int max_x, int max_y); nuclear@35: nuclear@35: void XFerGLView::mouseMoveEvent(QMouseEvent *ev) nuclear@35: { nuclear@35: int x = ev->x(); nuclear@35: int y = ev->y(); nuclear@35: nuclear@35: int dx = x - prev_x; nuclear@35: int dy = y - prev_y; nuclear@35: nuclear@35: prev_x = x; nuclear@35: prev_y = y; nuclear@35: nuclear@35: modxfer(dx, dy, width(), height()); nuclear@35: }