qvolray
diff src/main.cc @ 11:8990b5d2c7fe
moving to qt
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 09 Apr 2012 23:42:57 +0300 |
parents | |
children | 17d9dc2edc91 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/main.cc Mon Apr 09 23:42:57 2012 +0300 1.3 @@ -0,0 +1,51 @@ 1.4 +#include <QApplication> 1.5 +#include <QMainWindow> 1.6 +#include <QGLWidget> 1.7 +#include "volray.h" 1.8 + 1.9 +class GLView : public QGLWidget { 1.10 +private: 1.11 + Q_OBJECT; 1.12 + 1.13 + void initializeGL(); 1.14 + void resizeGL(int xsz, int ysz); 1.15 + void paintGL(); 1.16 + 1.17 +public: 1.18 + GLView(QWidget *parent = 0); 1.19 +}; 1.20 + 1.21 + 1.22 +int main(int argc, char **argv) 1.23 +{ 1.24 + QApplication app(argc, argv); 1.25 + 1.26 + QMainWindow win; 1.27 + GLView glview(&win); 1.28 + 1.29 + win.show(); 1.30 + app.exec(); 1.31 +} 1.32 + 1.33 + 1.34 +GLView::GLView(QWidget *parent) 1.35 + : QGLWidget(parent) 1.36 +{ 1.37 +} 1.38 + 1.39 +void GLView::initializeGL() 1.40 +{ 1.41 + glClearColor(1, 0, 0, 1); 1.42 + 1.43 + volray_init(); 1.44 +} 1.45 + 1.46 +void GLView::resizeGL(int xsz, int ysz) 1.47 +{ 1.48 + volray_resize(xsz, ysz); 1.49 +} 1.50 + 1.51 +void GLView::paintGL() 1.52 +{ 1.53 + volray_draw(); 1.54 +}