qvolray

annotate 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
rev   line source
nuclear@11 1 #include <QApplication>
nuclear@11 2 #include <QMainWindow>
nuclear@11 3 #include <QGLWidget>
nuclear@11 4 #include "volray.h"
nuclear@11 5
nuclear@11 6 class GLView : public QGLWidget {
nuclear@11 7 private:
nuclear@11 8 Q_OBJECT;
nuclear@11 9
nuclear@11 10 void initializeGL();
nuclear@11 11 void resizeGL(int xsz, int ysz);
nuclear@11 12 void paintGL();
nuclear@11 13
nuclear@11 14 public:
nuclear@11 15 GLView(QWidget *parent = 0);
nuclear@11 16 };
nuclear@11 17
nuclear@11 18
nuclear@11 19 int main(int argc, char **argv)
nuclear@11 20 {
nuclear@11 21 QApplication app(argc, argv);
nuclear@11 22
nuclear@11 23 QMainWindow win;
nuclear@11 24 GLView glview(&win);
nuclear@11 25
nuclear@11 26 win.show();
nuclear@11 27 app.exec();
nuclear@11 28 }
nuclear@11 29
nuclear@11 30
nuclear@11 31 GLView::GLView(QWidget *parent)
nuclear@11 32 : QGLWidget(parent)
nuclear@11 33 {
nuclear@11 34 }
nuclear@11 35
nuclear@11 36 void GLView::initializeGL()
nuclear@11 37 {
nuclear@11 38 glClearColor(1, 0, 0, 1);
nuclear@11 39
nuclear@11 40 volray_init();
nuclear@11 41 }
nuclear@11 42
nuclear@11 43 void GLView::resizeGL(int xsz, int ysz)
nuclear@11 44 {
nuclear@11 45 volray_resize(xsz, ysz);
nuclear@11 46 }
nuclear@11 47
nuclear@11 48 void GLView::paintGL()
nuclear@11 49 {
nuclear@11 50 volray_draw();
nuclear@11 51 }