Mercurial > hg > orthanc-stone
comparison Deprecated/Samples/MultiPlatform/BasicScene/mainQt.cpp @ 1402:65e1e4b08302
moved deprecated samples into Deprecated
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 29 Apr 2020 20:50:53 +0200 |
parents | Samples/Deprecated/MultiPlatform/BasicScene/mainQt.cpp@eac254fb6791 |
children | 182bf3106ee2 |
comparison
equal
deleted
inserted
replaced
1401:f6a2d46d2b76 | 1402:65e1e4b08302 |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 #define GLEW_STATIC 1 | |
22 // From Stone | |
23 #include "../../Framework/OpenGL/OpenGLIncludes.h" | |
24 #include "../../Applications/Sdl/SdlWindow.h" | |
25 #include "../../Framework/Scene2D/CairoCompositor.h" | |
26 #include "../../Framework/Scene2D/ColorTextureSceneLayer.h" | |
27 #include "../../Framework/Scene2D/OpenGLCompositor.h" | |
28 #include "../../Framework/Scene2D/PanSceneTracker.h" | |
29 #include "../../Framework/Scene2D/RotateSceneTracker.h" | |
30 #include "../../Framework/Scene2D/Scene2D.h" | |
31 #include "../../Framework/Scene2D/ZoomSceneTracker.h" | |
32 #include "../../Framework/Scene2DViewport/ViewportController.h" | |
33 #include "../../Framework/Scene2DViewport/UndoStack.h" | |
34 | |
35 #include "../../Framework/StoneInitialization.h" | |
36 #include "../../Framework/Messages/MessageBroker.h" | |
37 | |
38 // From Orthanc framework | |
39 #include <Core/Logging.h> | |
40 #include <Core/OrthancException.h> | |
41 #include <Core/Images/Image.h> | |
42 #include <Core/Images/ImageProcessing.h> | |
43 #include <Core/Images/PngWriter.h> | |
44 | |
45 #include <boost/make_shared.hpp> | |
46 #include <boost/ref.hpp> | |
47 #include "EmbeddedResources.h" | |
48 | |
49 #include <stdio.h> | |
50 #include <QDebug> | |
51 #include <QWindow> | |
52 | |
53 #include "BasicScene.h" | |
54 | |
55 | |
56 using namespace OrthancStone; | |
57 | |
58 | |
59 | |
60 static void GLAPIENTRY OpenGLMessageCallback(GLenum source, | |
61 GLenum type, | |
62 GLuint id, | |
63 GLenum severity, | |
64 GLsizei length, | |
65 const GLchar* message, | |
66 const void* userParam ) | |
67 { | |
68 if (severity != GL_DEBUG_SEVERITY_NOTIFICATION) | |
69 { | |
70 fprintf(stderr, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n", | |
71 ( type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : "" ), | |
72 type, severity, message ); | |
73 } | |
74 } | |
75 | |
76 extern void InitGL(); | |
77 | |
78 #include <QApplication> | |
79 #include "BasicSceneWindow.h" | |
80 | |
81 int main(int argc, char* argv[]) | |
82 { | |
83 QApplication a(argc, argv); | |
84 | |
85 OrthancStone::Samples::BasicSceneWindow window; | |
86 window.show(); | |
87 window.GetOpenGlWidget().Init(); | |
88 | |
89 MessageBroker broker; | |
90 boost::shared_ptr<UndoStack> undoStack(new UndoStack); | |
91 boost::shared_ptr<ViewportController> controller = boost::make_shared<ViewportController>(undoStack, boost::ref(broker), window.GetOpenGlWidget()); | |
92 PrepareScene(controller->GetScene()); | |
93 | |
94 window.GetOpenGlWidget().GetCompositor().SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, | |
95 BASIC_SCENE_FONT_SIZE, Orthanc::Encoding_Latin1); | |
96 | |
97 boost::shared_ptr<OrthancStone::Scene2DInteractor> interactor(new BasicScene2DInteractor(controller)); | |
98 window.GetOpenGlWidget().SetInteractor(interactor); | |
99 | |
100 controller->FitContent(); | |
101 | |
102 return a.exec(); | |
103 } |