tumvis.cpp 1.56 KB
Newer Older
schultezub's avatar
schultezub committed
1
#include "tgt/camera.h"
2
3
#include "tgt/exception.h"
#include "tgt/shadermanager.h"
schultezub's avatar
schultezub committed
4
5
6
7
#include "tgt/qt/qtapplication.h"
#include "tgt/qt/qtcanvas.h"

#include "tumvispainter.h"
schultezub's avatar
schultezub committed
8
9
#include "modules/pipelines/slicevis.h"

schultezub's avatar
schultezub committed
10

11
using namespace TUMVis;
schultezub's avatar
schultezub committed
12

schultezub's avatar
schultezub committed
13
14
15
16
17
18
19
/**
 * TUMVis main function, application entry point
 *
 * \param   argc    number of passed arguments
 * \param   argv    vector of arguments
 * \return  0 if program exited successfully
 **/
20
21
22
int main(int argc, char** argv) {  
    tgt::QtApplication* app = new tgt::QtApplication(argc, argv);
    tgt::QtCanvas* canvas = new tgt::QtCanvas("TUMVis");
23
    SliceVis* sliceVis = 0;
schultezub's avatar
schultezub committed
24

25
    app->addCanvas(canvas);  
schultezub's avatar
schultezub committed
26
    app->init();
27
28
29
30
31
32
33
34

    if (argc > 0) {
        // ugly hack
        std::string programPath(argv[0]);
        programPath = tgt::FileSystem::parentDir(tgt::FileSystem::parentDir(tgt::FileSystem::parentDir(programPath)));
        ShdrMgr.addPath(programPath);
        ShdrMgr.addPath(programPath + "/core/glsl");
    }
schultezub's avatar
schultezub committed
35

36
37
    tgt::Camera camera;  
    canvas->setCamera(&camera);  
schultezub's avatar
schultezub committed
38

39
40
41
42
43
44
45
46
47
48
49
50
51
    try {
        sliceVis = new SliceVis(canvas);
        canvas->setPainter(sliceVis);  
        //     TumVisPainter painter(canvas);  
        //     canvas->setPainter(&painter);  

    }
    catch (tgt::Exception& e) {
        LERRORC("main.cpp", "Encountered tgt::Exception: " << e.what());
    }
    catch (std::exception& e) {
        LERRORC("main.cpp", "Encountered std::exception: " << e.what());
    }
schultezub's avatar
schultezub committed
52

53
    app->run();
schultezub's avatar
schultezub committed
54

55
56
    delete sliceVis;
    delete canvas;
57
    delete app;  
schultezub's avatar
schultezub committed
58

59
    return 0;  
schultezub's avatar
schultezub committed
60
}