qvolray
annotate src/ui_xferview.cc @ 37:450d4c50470f
- 16bit floating point textures halve gpu texture memory usage
- slower transfer function change
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 01 Jan 2014 00:23:57 +0200 |
parents | 40df2cdc6323 |
children |
rev | line source |
---|---|
nuclear@35 | 1 #include <QtGui> |
nuclear@29 | 2 #include "ui_xferview.h" |
nuclear@29 | 3 #include "volray.h" |
nuclear@29 | 4 |
nuclear@35 | 5 static int prev_x, prev_y; |
nuclear@35 | 6 |
nuclear@30 | 7 XFerGLView::XFerGLView(QGLWidget *share_widget) |
nuclear@29 | 8 : QGLWidget(QGLFormat(QGL::DoubleBuffer), 0, share_widget) |
nuclear@29 | 9 { |
nuclear@29 | 10 } |
nuclear@29 | 11 |
nuclear@30 | 12 QSize XFerGLView::minimumSizeHint() const |
nuclear@29 | 13 { |
nuclear@29 | 14 return QSize(160, 100); |
nuclear@29 | 15 } |
nuclear@29 | 16 |
nuclear@30 | 17 void XFerGLView::initializeGL() |
nuclear@29 | 18 { |
nuclear@29 | 19 } |
nuclear@29 | 20 |
nuclear@30 | 21 void XFerGLView::resizeGL(int xsz, int ysz) |
nuclear@29 | 22 { |
nuclear@29 | 23 glViewport(0, 0, xsz, ysz); |
nuclear@29 | 24 } |
nuclear@29 | 25 |
nuclear@30 | 26 void XFerGLView::paintGL() |
nuclear@29 | 27 { |
nuclear@29 | 28 volray_draw_xfer(); |
nuclear@29 | 29 } |
nuclear@35 | 30 |
nuclear@35 | 31 void XFerGLView::mousePressEvent(QMouseEvent *ev) |
nuclear@35 | 32 { |
nuclear@35 | 33 prev_x = ev->x(); |
nuclear@35 | 34 prev_y = ev->y(); |
nuclear@35 | 35 } |
nuclear@35 | 36 |
nuclear@35 | 37 void modxfer(int dx, int dy, int max_x, int max_y); |
nuclear@35 | 38 |
nuclear@35 | 39 void XFerGLView::mouseMoveEvent(QMouseEvent *ev) |
nuclear@35 | 40 { |
nuclear@35 | 41 int x = ev->x(); |
nuclear@35 | 42 int y = ev->y(); |
nuclear@35 | 43 |
nuclear@35 | 44 int dx = x - prev_x; |
nuclear@35 | 45 int dy = y - prev_y; |
nuclear@35 | 46 |
nuclear@35 | 47 prev_x = x; |
nuclear@35 | 48 prev_y = y; |
nuclear@35 | 49 |
nuclear@35 | 50 modxfer(dx, dy, width(), height()); |
nuclear@35 | 51 } |