Merge lp:~stellarium/stellarium/gz_spout into lp:stellarium

Proposed by gzotti
Status: Merged
Merged at revision: 8957
Proposed branch: lp:~stellarium/stellarium/gz_spout
Merge into: lp:stellarium
Diff against target: 833 lines (+425/-35)
16 files modified
CMakeLists.txt (+29/-1)
README (+2/-0)
cmake/stellarium.iss.cmake (+2/-1)
guide/ch_advanced_use.tex (+24/-2)
src/CLIProcessor.cpp (+40/-2)
src/CMakeLists.txt (+15/-0)
src/StelMainView.cpp (+11/-9)
src/StelMainView.hpp (+1/-1)
src/core/StelApp.cpp (+132/-17)
src/core/StelApp.hpp (+12/-1)
src/core/StelOpenGL.hpp (+1/-0)
src/core/external/SpoutLibrary.h (+90/-0)
util/ISL/EnglishCM.isl (+2/-1)
util/ISL/GermanCM.isl (+36/-0)
util/spout2/README.txt (+4/-0)
util/spout2/licence.txt (+24/-0)
To merge this branch: bzr merge lp:~stellarium/stellarium/gz_spout
Reviewer Review Type Date Requested Status
Alexander Wolf Approve
Review via email: mp+313043@code.launchpad.net

Description of the change

See branch description.
Spout can send the Sky window to DirectX graphics applications under Windows, apparently similar to what can be done via Syphon on a Mac. This enables new ways of interoperability, at least on this platform.

This must be tested on a fairly recent Windows system. I have seen it running on Win7+10 notebooks with NVidia GPUs, small Win10 netbook (AMD) and desktop PC (Intel HD4600). Virtual machines or Angle-only systems do not work, but should fall-back to regular operation, so it should never cause Stellarium itself to fail.

On Non-Windows systems, everything should be excluded, so it should not disturb compilation.

To post a comment you must log in.
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Please add shortcut "Stellarium (Spout)" in stellarium.iss.cmake file

review: Needs Fixing
lp:~stellarium/stellarium/gz_spout updated
8944. By gzotti

Added startup link to Inno configuration; added German translation to Inno setup; Fix a misnomer in English Inno setup.

Revision history for this message
Alexander Wolf (alexwolf) wrote :

It's seems ok now

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-11-20 17:15:43 +0000
3+++ CMakeLists.txt 2016-12-13 10:58:20 +0000
4@@ -181,6 +181,26 @@
5 # Activate media support
6 SET(ENABLE_MEDIA 1 CACHE BOOL "Define whether media support should be activated.")
7
8+# SPOUT allows relaying the Stellarium OpenGL framebuffer as DirectX texture in other programs.
9+# It exists on Windows only. Syphon is a similar system for MacOS, this might be added by a Mac developer.
10+# Note that we may also link with the real OpenGL library in this case!
11+# or find a way to define all of Spout's OpenGL calls to Qt5's version?
12+IF(WIN32)
13+ SET(ENABLE_SPOUT 1 CACHE BOOL "Define whether SPOUT support should be activated.")
14+ELSE()
15+ SET(ENABLE_SPOUT 0)
16+ENDIF()
17+IF(ENABLE_SPOUT)
18+ ADD_DEFINITIONS(-DENABLE_SPOUT)
19+# FIND_PACKAGE(OpenGL REQUIRED) # maybe we don't need it. Then remove part of comment above.
20+ IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") # 32bit build?
21+ LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/util/spout2/Win32/)
22+ ELSEIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") # 64bit build?
23+ LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/util/spout2/x64/)
24+ ENDIF()
25+ENDIF(ENABLE_SPOUT)
26+
27+
28 SET(ENABLE_SCRIPTING 1 CACHE BOOL "Define whether scripting features should be activated.")
29 IF(ENABLE_SCRIPTING)
30 # (De-)Activate the script edit console
31@@ -490,7 +510,15 @@
32 IF(ENABLE_MEDIA)
33 SET(ISS_QT_PLUGINS "${ISS_QT_PLUGINS}\nSource: \"${QT5_LIBS}/../plugins/mediaservice/dsengine.dll\"; DestDir: \"{app}/mediaservice/\";\nSource: \"${QT5_LIBS}/../plugins/mediaservice/qtmedia_audioengine.dll\"; DestDir: \"{app}/mediaservice/\";\nSource: \"${QT5_LIBS}/../plugins/playlistformats/qtmultimedia_m3u.dll\"; DestDir: \"{app}/playlistformats/\";")
34 ENDIF()
35-ENDIF()
36+ IF(ENABLE_SPOUT)
37+ IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") # 32bit build?
38+ SET(ISS_QT_PLUGINS "${ISS_QT_PLUGINS}\nSource: \"${CMAKE_SOURCE_DIR}/util/spout2/Win32/SpoutLibrary.dll\"; DestDir: \"{app}\";")
39+ ELSEIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") # 64bit build?
40+ SET(ISS_QT_PLUGINS "${ISS_QT_PLUGINS}\nSource: \"${CMAKE_SOURCE_DIR}/util/spout2/x64/SpoutLibrary.dll\"; DestDir: \"{app}\";")
41+ ENDIF()
42+ ENDIF(ENABLE_SPOUT)
43+
44+ENDIF(WIN32)
45
46
47 IF(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
48
49=== modified file 'README'
50--- README 2016-10-20 13:54:17 +0000
51+++ README 2016-12-13 10:58:20 +0000
52@@ -229,6 +229,8 @@
53 2.5 OBJ loader in the Scenery3D plugin based on glObjViewer (c) 2007 dhpoware
54 2.6 Parts of the code to work with DE430 and DE431 data files have been
55 taken from Project Pluto (GPL license).
56+ 2.7 The SpoutLibrary.dll and header from the SpoutSDK version 2.005
57+ available at http://spout.zeal.co (BSD license).
58
59 3. Data
60 3.1 The Hipparcos star catalog
61
62=== modified file 'cmake/stellarium.iss.cmake'
63--- cmake/stellarium.iss.cmake 2016-11-25 10:47:10 +0000
64+++ cmake/stellarium.iss.cmake 2016-12-13 10:58:20 +0000
65@@ -103,6 +103,7 @@
66 ; Name: "{group}\Stellarium {cm:AngleWarpMode}"; Filename: "{app}\stellarium.exe"; Parameters: "--angle-warp"; WorkingDir: "{app}"; IconFilename: "{app}\data\stellarium.ico"
67 Name: "{group}\Stellarium {cm:AngleMode}"; Filename: "{app}\stellarium.exe"; Parameters: "--angle-d3d9"; WorkingDir: "{app}"; IconFilename: "{app}\data\stellarium.ico"
68 Name: "{group}\Stellarium {cm:MesaMode}"; Filename: "{app}\stellarium.exe"; Parameters: "--mesa-mode"; WorkingDir: "{app}"; IconFilename: "{app}\data\stellarium.ico"
69+Name: "{group}\Stellarium {cm:SpoutMode}"; Filename: "{app}\stellarium.exe"; Parameters: "--spout=sky"; WorkingDir: "{app}"; IconFilename: "{app}\data\stellarium.ico"
70 Name: "{group}\{cm:UninstallProgram,Stellarium}"; Filename: "{uninstallexe}"
71 Name: "{group}\config.ini"; Filename: "{userappdata}\Stellarium\config.ini"
72 Name: "{group}\{cm:LastRunLog}"; Filename: "{userappdata}\Stellarium\log.txt"
73@@ -130,7 +131,7 @@
74 Name: "nl"; MessagesFile: "compiler:Languages\Dutch.isl"
75 Name: "fi"; MessagesFile: "compiler:Languages\Finnish.isl"
76 Name: "fr"; MessagesFile: "compiler:Languages\French.isl,@CMAKE_SOURCE_DIR@\util\ISL\FrenchCM.isl"
77-Name: "de"; MessagesFile: "compiler:Languages\German.isl"
78+Name: "de"; MessagesFile: "compiler:Languages\German.isl,@CMAKE_SOURCE_DIR@\util\ISL\GermanCM.isl"
79 Name: "el"; MessagesFile: "compiler:Languages\Greek.isl"
80 Name: "he"; MessagesFile: "compiler:Languages\Hebrew.isl"
81 Name: "hu"; MessagesFile: "compiler:Languages\Hungarian.isl"
82
83=== modified file 'guide/ch_advanced_use.tex'
84--- guide/ch_advanced_use.tex 2016-07-25 17:24:49 +0000
85+++ guide/ch_advanced_use.tex 2016-12-13 10:58:20 +0000
86@@ -313,15 +313,18 @@
87 -\/-startup-script & script name & The name of a script to run after the program has started. \\\midrule
88 -\/-fov & angle & The initial field of view in degrees. \\\midrule
89 -\/-projection-type & ptype & The initial projection type (e.g. \texttt{perspective}). \\\midrule
90+-\/-spout or -S & all or sky & Act as Spout sender (See section \ref{sec:CommandLineOptions:Special:Spout}).%
91+ \footnote{On Windows only}\footnote{This function requires running in OpenGL mode.}\\\midrule
92+-\/-spout-name & name & Use \texttt{name} as name of the Spout sender. Default name: \texttt{Stellarium}.\footnotemark[1]\\\midrule
93 -\/-dump-opengl-details or -d & {[}none{]} & Dump information about OpenGL support to logfile.
94 Use this is you have graphics problems and want to send a bug report. \\\midrule
95--\/-angle-mode or -a & {[}none{]} & Use ANGLE as OpenGL ES2 rendering engine (autodetect Direct3D version).\footnote{On Windows only}\\\midrule
96+-\/-angle-mode or -a & {[}none{]} & Use ANGLE as OpenGL ES2 rendering engine (autodetect Direct3D version).\footnotemark[1]\\\midrule
97 -\/-angle-d3d9 or -9 & {[}none{]} & Force use Direct3D 9 for ANGLE OpenGL ES2 rendering engine.\footnotemark[1]\\\midrule
98 -\/-angle-d3d11 & {[}none{]} & Force use Direct3D 11 for ANGLE OpenGL ES2 rendering engine.\footnotemark[1]\\\midrule
99 -\/-angle-warp & {[}none{]} & Force use the Direct3D 11 software rasterizer for ANGLE OpenGL ES2 rendering engine.\footnotemark[1]\\\midrule
100 -\/-mesa-mode or -m & {[}none{]} & Use MESA as software OpenGL rendering engine.\footnotemark[1]\\\midrule
101 -\/-safe-mode or -s & {[}none{]} & Synonymous to -\/-mesa-mode.\footnotemark[1]\\\midrule
102--\/-fix-text or -t & {[}none{]} & Alternative way of creating the Info text, required on some systems.\footnote{E.g., Raspberry Pi 2 with Raspbian Jessie and VC4 drivers from February 2016. A bugfix should be available later in 2016.}\\\bottomrule
103+-\/-fix-text or -t & {[}none{]} & Alternative way of creating the Info text, required on some systems.\footnote{E.g., Raspberry Pi 2 with Raspbian Jessie and VC4 drivers from February 2016. A driver update which makes this unnecessary should be available later in 2016.}\\\bottomrule
104 \end{longtabu}
105
106 \noindent \newFeature{0.15} If you want to avoid adding the same
107@@ -353,6 +356,25 @@
108 %% GZ found in 2015:
109 \noindent Note that console output (like \command{-\/-list-landscapes}) on Windows is not possible.
110
111+\section{Special Options}
112+\label{sec:CommandLineOptions:Special}
113+\subsection{Spout}\newFeature{0.15.1}
114+\label{sec:CommandLineOptions:Special:Spout}
115+Apart from stand-alone use, Stellarium can be used as multimedia source in larger installations, in museums or science exhibitions.
116+\program{Spout}\footnote{\url{http://spout.zeal.co/}} is a technology which enables use of Stellarium's
117+output window as texture in DirectX applications on Windows. Simply start Stellarium with
118+the \texttt{-\/-spout=sky} command line option. (Currently \program{Spout} output is limited to the main window
119+without GUI panels, but this may change in future versions.)
120+Your master application must obviously embed a \program{Spout} receiver.
121+The default name of the \program{Spout} sender is \texttt{Stellarium}. If you need more than one instance of Stellarium acting as source,
122+you can use option \texttt{-\/-spout-name=StelSpout2} in addition to create another \program{Spout} sender without a name conflict.
123+In such cases, it may be useful to also have separate user data directories and use option \texttt{-\/-user-dir}.
124+
125+This mode does not work in ANGLE mode and requires modern graphics hardware with the \texttt{WGL\_NV\_DX\_interop}
126+driver extension running in OpenGL mode. Some NVidia GPUs work without this extension listed explicitly.
127+On a notebook with NVidia Optimus technology, make sure to launch Stellarium on the NVidia hardware.
128+For permanent setting, use the NVidia configuration dialog to configure Stellarium explicitly to run always on the NVidia card.
129+
130 %%% Local Variables:
131 %%% mode: latex
132 %%% TeX-master: "guide"
133
134=== modified file 'src/CLIProcessor.cpp'
135--- src/CLIProcessor.cpp 2016-04-12 15:30:38 +0000
136+++ src/CLIProcessor.cpp 2016-12-13 10:58:20 +0000
137@@ -72,6 +72,12 @@
138 << " and want to send a bug report\n"
139 << "--full-screen (or -f) : With argument \"yes\" or \"no\" over-rides\n"
140 << " the full screen setting in the config file\n"
141+ #ifdef Q_OS_WIN
142+ #ifdef ENABLE_SPOUT
143+ << "--spout (or -S) <sky|all> : Act as SPOUT sender (Sky only/including GUI)\n"
144+ << "--spout-name <name> : Set particular name for SPOUT sender.\n"
145+ #endif
146+ #endif
147 << "--screenshot-dir : Specify directory to save screenshots\n"
148 << "--startup-script : Specify name of startup script\n"
149 << "--home-planet : Specify observer planet (English name)\n"
150@@ -160,13 +166,16 @@
151 }
152
153 void CLIProcessor::parseCLIArgsPostConfig(const QStringList& argList, QSettings* confSettings)
154-{
155+{
156 // Over-ride config file options with command line options
157 // We should catch exceptions from argsGetOptionWithArg...
158 int fullScreen, altitude;
159 float fov;
160 QString landscapeId, homePlanet, longitude, latitude, skyDate, skyTime;
161 QString projectionType, screenshotDir, multiresImage, startupScript;
162+#ifdef ENABLE_SPOUT
163+ QString spoutStr, spoutName;
164+#endif
165 try
166 {
167 bool dumpOpenGLDetails = argsGetOption(argList, "-d", "--dump-opengl-details");
168@@ -184,6 +193,12 @@
169 screenshotDir = argsGetOptionWithArg(argList, "", "--screenshot-dir", "").toString();
170 multiresImage = argsGetOptionWithArg(argList, "", "--multires-image", "").toString();
171 startupScript = argsGetOptionWithArg(argList, "", "--startup-script", "").toString();
172+#ifdef ENABLE_SPOUT
173+ // For now, we default to spout=sky when no extra option is given. Later, we should also accept "all".
174+ // Unfortunately, this still throws an exception when no optarg string is given.
175+ spoutStr = argsGetOptionWithArg(argList, "-S", "--spout", "sky").toString();
176+ spoutName = argsGetOptionWithArg(argList, "", "--spout-name", "").toString();
177+#endif
178 }
179 catch (std::runtime_error& e)
180 {
181@@ -299,6 +314,21 @@
182 }
183 }
184 }
185+
186+#ifdef ENABLE_SPOUT
187+ if (!spoutStr.isEmpty())
188+ {
189+ if (spoutStr=="all")
190+ qApp->setProperty("spout", "all");
191+ else
192+ qApp->setProperty("spout", "sky");
193+ }
194+ else
195+ qApp->setProperty("spout", "none");
196+ if (!spoutName.isEmpty())
197+ qApp->setProperty("spoutName", spoutName);
198+#endif
199+
200 }
201
202
203@@ -351,7 +381,15 @@
204 {
205 if (i+1>=lastOptIdx)
206 {
207- throw (std::runtime_error(qPrintable("optarg_missing ("+longOpt+")")));
208+ // i.e., option given as last option, but without arguments. Last chance: default value!
209+ if (defaultValue.isValid())
210+ {
211+ return defaultValue;
212+ }
213+ else
214+ {
215+ throw (std::runtime_error(qPrintable("optarg_missing ("+longOpt+")")));
216+ }
217 }
218 else
219 {
220
221=== modified file 'src/CMakeLists.txt'
222--- src/CMakeLists.txt 2016-11-13 09:27:45 +0000
223+++ src/CMakeLists.txt 2016-12-13 10:58:20 +0000
224@@ -57,6 +57,12 @@
225 core/external/zlib/zutil.h
226 )
227
228+IF(ENABLE_SPOUT)
229+ SET(spout_SRCS
230+ core/external/SpoutLibrary.h
231+ )
232+ENDIF()
233+
234 SET(stellarium_lib_SRCS
235 core/StelAudioMgr.hpp
236 core/StelAudioMgr.cpp
237@@ -166,6 +172,8 @@
238 ${gl_lib_SRCS}
239
240 ${glues_lib_SRCS}
241+
242+ ${spout_SRCS}
243
244 core/planetsephems/calc_interpolated_elements.c
245 core/planetsephems/calc_interpolated_elements.h
246@@ -491,6 +499,10 @@
247 IF(USE_PLUGIN_TELESCOPECONTROL)
248 QT5_USE_MODULES(stelMain SerialPort)
249 ENDIF()
250+ IF(ENABLE_SPOUT)
251+ TARGET_LINK_LIBRARIES(stelMain SpoutLibrary)
252+ ENDIF(ENABLE_SPOUT)
253+
254 INSTALL(TARGETS stelMain DESTINATION lib)
255 ADD_EXECUTABLE(stellarium ${stellarium_exe_SRCS})
256 #stelMain should be after the plug-ins, otherwise the build crashes
257@@ -511,6 +523,9 @@
258 IF(USE_PLUGIN_TELESCOPECONTROL)
259 QT5_USE_MODULES(stellarium SerialPort)
260 ENDIF()
261+ IF(ENABLE_SPOUT)
262+ TARGET_LINK_LIBRARIES(stellarium SpoutLibrary)
263+ ENDIF(ENABLE_SPOUT)
264
265 IF(APPLE)
266 SET_TARGET_PROPERTIES(stellarium PROPERTIES LINK_FLAGS " -framework Cocoa -framework OpenGL")
267
268=== modified file 'src/StelMainView.cpp'
269--- src/StelMainView.cpp 2016-11-20 20:45:14 +0000
270+++ src/StelMainView.cpp 2016-12-13 10:58:20 +0000
271@@ -426,7 +426,8 @@
272
273
274 StelMainView::StelMainView(QWidget* parent)
275- : QGraphicsView(parent), guiItem(NULL), gui(NULL),
276+ : QGraphicsView(parent), guiItem(NULL),
277+ gui(NULL),
278 flagInvertScreenShotColors(false),
279 flagOverwriteScreenshots(false),
280 screenShotPrefix("stellarium-"),
281@@ -569,6 +570,7 @@
282
283 stelApp= new StelApp();
284 stelApp->setGui(gui);
285+
286 stelApp->init(conf);
287 StelActionMgr *actionMgr = stelApp->getStelActionManager();
288 actionMgr->addAction("actionSave_Screenshot_Global", N_("Miscellaneous"), N_("Save screenshot"), this, "saveScreenShot()", "Ctrl+S");
289@@ -588,7 +590,7 @@
290 rootItem->setLayout(l);
291 scene()->addItem(rootItem);
292 nightModeEffect = new NightModeGraphicsEffect(this);
293- updateNightModeProperty();
294+ updateNightModeProperty(StelApp::getInstance().getVisionModeNight());
295 rootItem->setGraphicsEffect(nightModeEffect);
296
297 QSize size = glWidget->windowHandle()->screen()->size();
298@@ -648,7 +650,7 @@
299 StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
300 if (gui!=NULL)
301 setStyleSheet(gui->getStelStyle().qtStyleSheet);
302- connect(&StelApp::getInstance(), SIGNAL(visionNightModeChanged(bool)), this, SLOT(updateNightModeProperty()));
303+ connect(&StelApp::getInstance(), SIGNAL(visionNightModeChanged(bool)), this, SLOT(updateNightModeProperty(bool)));
304
305 QThread::currentThread()->setPriority(QThread::HighestPriority);
306 #ifndef NDEBUG
307@@ -665,11 +667,11 @@
308 startMainLoop();
309 }
310
311-void StelMainView::updateNightModeProperty()
312+void StelMainView::updateNightModeProperty(bool b)
313 {
314 // So that the bottom bar tooltips get properly rendered in night mode.
315- setProperty("nightMode", StelApp::getInstance().getVisionModeNight());
316- nightModeEffect->setEnabled(StelApp::getInstance().getVisionModeNight());
317+ setProperty("nightMode", b);
318+ nightModeEffect->setEnabled(b);
319 }
320
321 // This is a series of various diagnostics based on "bugs" reported for 0.13.0 and 0.13.1.
322@@ -732,7 +734,7 @@
323 if ((!isANGLE) && (!isMesa))
324 qWarning() << "Oops... Insufficient OpenGL version. Please update drivers, graphics hardware, or use --angle-mode (or even --mesa-mode) option.";
325 else if (isANGLE)
326- qWarning() << "Oops... Insufficient OpenGL version in ANGLE. Please update drivers, graphics hardware, or use --mesa-mode option.";
327+ qWarning() << "Oops... Insufficient OpenGLES version in ANGLE. Please update drivers, graphics hardware, or use --mesa-mode option.";
328 else
329 qWarning() << "Oops... Insufficient OpenGL version. Mesa failed! Please send a bug report.";
330
331@@ -1160,7 +1162,7 @@
332
333 void StelMainView::mouseMoveEvent(QMouseEvent* event)
334 {
335- // We notify the applicatio to increase the fps if a button has been
336+ // We notify the application to increase the fps if a button has been
337 // clicked, but also if the cursor is currently hidden, so that it gets
338 // restored.
339 if (event->buttons() || QGuiApplication::overrideCursor()!=0)
340@@ -1190,7 +1192,7 @@
341 {
342 Q_UNUSED(event);
343
344- // We use the glWidget instead of the even, as we want the screen that shows most of the widget.
345+ // We use the glWidget instead of the event, as we want the screen that shows most of the widget.
346 StelApp::getInstance().setDevicePixelsPerPixel(glWidget->windowHandle()->devicePixelRatio());
347 }
348
349
350=== modified file 'src/StelMainView.hpp'
351--- src/StelMainView.hpp 2016-06-14 14:56:19 +0000
352+++ src/StelMainView.hpp 2016-12-13 10:58:20 +0000
353@@ -162,7 +162,7 @@
354 // Do the actual screenshot generation in the main thread with this method.
355 void doScreenshot(void);
356 void minFpsChanged();
357- void updateNightModeProperty();
358+ void updateNightModeProperty(bool b);
359
360 private:
361 //! Start the display loop
362
363=== modified file 'src/core/StelApp.cpp'
364--- src/core/StelApp.cpp 2016-11-21 21:04:36 +0000
365+++ src/core/StelApp.cpp 2016-12-13 10:58:20 +0000
366@@ -79,6 +79,9 @@
367 #include <QCoreApplication>
368 #include <QScreen>
369 #include <QDateTime>
370+#ifdef ENABLE_SPOUT
371+#include <QMessageBox>
372+#endif
373
374 #ifdef USE_STATIC_PLUGIN_HELLOSTELMODULE
375 Q_IMPORT_PLUGIN(HelloStelModuleStelPluginInterface)
376@@ -200,8 +203,16 @@
377 *************************************************************************/
378 StelApp::StelApp(QObject* parent)
379 : QObject(parent)
380- , core(NULL)
381+ , core(NULL)
382+ , moduleMgr(NULL)
383+ , localeMgr(NULL)
384+ , skyCultureMgr(NULL)
385+ , actionMgr(NULL)
386+ , propMgr(NULL)
387+ , textureMgr(NULL)
388+ , stelObjectMgr(NULL)
389 , planetLocationMgr(NULL)
390+ , networkAccessManager(NULL)
391 , audioMgr(NULL)
392 , videoMgr(NULL)
393 , skyImageMgr(NULL)
394@@ -221,29 +232,23 @@
395 , initialized(false)
396 , saveProjW(-1)
397 , saveProjH(-1)
398+ , nbDownloadedFiles(0)
399+ , totalDownloadedSize(0)
400+ , nbUsedCache(0)
401+ , totalUsedCacheSize(0)
402 , baseFontSize(13)
403 , renderBuffer(NULL)
404 , viewportEffect(NULL)
405 , flagShowDecimalDegrees(false)
406 , flagUseAzimuthFromSouth(false)
407+ #ifdef ENABLE_SPOUT
408+ , spoutSender(NULL)
409+ , spoutTexID(0)
410+ , spoutValid(false)
411+ #endif
412 {
413- // Stat variables
414- nbDownloadedFiles=0;
415- totalDownloadedSize=0;
416- nbUsedCache=0;
417- totalUsedCacheSize=0;
418-
419 setObjectName("StelApp");
420
421- skyCultureMgr=NULL;
422- localeMgr=NULL;
423- stelObjectMgr=NULL;
424- textureMgr=NULL;
425- moduleMgr=NULL;
426- networkAccessManager=NULL;
427- actionMgr = NULL;
428- propMgr = NULL;
429-
430 // Can't create 2 StelApp instances
431 Q_ASSERT(!singleton);
432 singleton = this;
433@@ -531,6 +536,61 @@
434 // Animation
435 animationScale = confSettings->value("gui/pointer_animation_speed", 1.f).toFloat();
436
437+#ifdef ENABLE_SPOUT
438+ //qDebug() << "Property spout is" << qApp->property("spout").toString();
439+ //qDebug() << "Property spoutName is" << qApp->property("spoutName").toString();
440+ if (qApp->property("spout").toString() != "none")
441+ {
442+ QString glRenderer(reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
443+ bool isANGLE=glRenderer.startsWith("ANGLE", Qt::CaseSensitive);
444+
445+ if (isANGLE)
446+ {
447+ qDebug() << "SPOUT: Does not run in ANGLE mode!";
448+ }
449+ else
450+ {
451+ // Initialize the SpoutSender object. This does not create a spout sender yet.
452+ memset(spoutName, 0, sizeof(spoutName));
453+ if (qApp->property("spoutName").toString().isEmpty())
454+ sprintf(spoutName, "Stellarium");
455+ else
456+ sprintf(spoutName, qApp->property("spoutName").toString().toLocal8Bit());
457+
458+ qDebug() << "SPOUT name is: " << spoutName;
459+ spoutSender = GetSpout();
460+ int numAdapters=spoutSender->GetNumAdapters();
461+ qDebug() << "SPOUT: Found " << numAdapters << "GPUs";
462+ for (int i=0; i<numAdapters; i++){
463+ char name[256]; // 256 chars min required by Spout specs!
464+ spoutSender->GetAdapterName(i, name, 255);
465+ qDebug() << " GPU" << i << ": " << name;
466+ }
467+ qDebug() << " Currently used: GPU" << spoutSender->GetAdapter();
468+ // Now try to create the SpoutSender.
469+ spoutValid=spoutSender->CreateSender(spoutName, 500, 500); // try any size, will be resized later.
470+ }
471+ if (spoutValid)
472+ {
473+ qDebug() << " Sender has been created in" << (spoutSender->GetMemoryShareMode() ? "Memory Share Mode" : "OpenGL/DirectX interop mode");
474+ qDebug() << " Sender is" << (spoutSender->GetDX9()? "working" : "not working") << "with DX9 textures";
475+ }
476+ else
477+ {
478+ qDebug() << " Sender creation failed!";
479+ qDebug() << " You may need a better GPU for this function, see Spout docs.";
480+ qDebug() << " On a notebook with NVidia Optimus, force running Stellarium on the NVidia GPU.";
481+ QMessageBox::warning(0, "Stellarium SPOUT", q_("Cannot create Spout sender. See log for details."), QMessageBox::Ok);
482+ qDebug() << " Continuing without SPOUT sender.";
483+ qApp->setProperty("spout", "");
484+ }
485+ }
486+ else
487+ {
488+ qApp->setProperty("spout", "");
489+ }
490+#endif
491+
492 initialized = true;
493 }
494
495@@ -554,6 +614,16 @@
496
497 void StelApp::deinit()
498 {
499+#ifdef ENABLE_SPOUT
500+ if (spoutValid)
501+ {
502+ //qDebug() << "SPOUT: Releasing ...";
503+ spoutSender->ReleaseSender();
504+ spoutSender->Release();
505+ spoutValid=false;
506+ //qDebug() << "SPOUT: Releasing ... DONE.";
507+ }
508+#endif
509 #ifndef DISABLE_SCRIPTING
510 if (scriptMgr->scriptIsRunning())
511 scriptMgr->stopScript();
512@@ -561,7 +631,6 @@
513 QCoreApplication::processEvents();
514 getModuleMgr().unloadAllPlugins();
515 QCoreApplication::processEvents();
516-
517 StelPainter::deinitGLShaders();
518 }
519
520@@ -650,7 +719,28 @@
521 module->draw(core);
522 }
523 core->postDraw();
524+#ifdef ENABLE_SPOUT
525+ // At this point, the sky scene has been drawn, but no GUI panels.
526+ // GZ: It is rather unclear to me how to draw also the GUI into the Spout texture.
527+ //if (qApp->property("spout")=="sky")
528+ if (qApp->property("spout")!="") // first version.
529+ {
530+ if (spoutValid)
531+ {
532+ StelProjector::StelProjectorParams params = core->getCurrentStelProjectorParams();
533+ int w = params.viewportXywh[2];
534+ int h = params.viewportXywh[3];
535+
536+ initSpoutTexture(w, h);
537+ glBindTexture(GL_TEXTURE_2D, spoutTexID);
538+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, w, h);
539+ glBindTexture(GL_TEXTURE_2D, 0);
540+ spoutSender->SendTexture(spoutTexID, GL_TEXTURE_2D, w, h, true, drawFbo);
541+ }
542+ }
543+#endif
544 applyRenderBuffer(drawFbo);
545+
546 }
547
548 /*************************************************************************
549@@ -670,6 +760,15 @@
550 delete renderBuffer;
551 renderBuffer = NULL;
552 }
553+#ifdef ENABLE_SPOUT
554+ if (spoutValid)
555+ {
556+ // UpdateSender does not seem to work and keep the name,
557+ // it creates a new Sender entry and keeps a dead old texture. Better recreate.
558+ spoutSender->ReleaseSender();
559+ spoutSender->CreateSender(spoutName, w, h);
560+ }
561+#endif
562 }
563
564 // Handle mouse clics
565@@ -901,3 +1000,19 @@
566 qDebug() << " -- " << module->getCallOrder(actionName) << "Module: " << module->objectName();
567 }
568 }
569+
570+#ifdef ENABLE_SPOUT
571+void StelApp::initSpoutTexture(unsigned int width, unsigned int height)
572+{
573+ if(spoutTexID != 0) glDeleteTextures(1, &spoutTexID);
574+
575+ glGenTextures(1, &spoutTexID);
576+ glBindTexture(GL_TEXTURE_2D, spoutTexID);
577+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
578+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
579+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
580+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
581+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
582+ glBindTexture(GL_TEXTURE_2D, 0);
583+}
584+#endif
585
586=== modified file 'src/core/StelApp.hpp'
587--- src/core/StelApp.hpp 2016-11-20 20:45:14 +0000
588+++ src/core/StelApp.hpp 2016-12-13 10:58:20 +0000
589@@ -23,6 +23,9 @@
590 #include <QString>
591 #include <QObject>
592 #include "StelModule.hpp"
593+#ifdef ENABLE_SPOUT
594+#include "SpoutLibrary.h"
595+#endif
596
597 // Predeclaration of some classes
598 class StelCore;
599@@ -176,7 +179,7 @@
600
601 //! Get the GUI instance implementing the abstract GUI interface.
602 StelGuiBase* getGui() const {return stelGui;}
603- //! Tell the StelApp instance which GUI si currently being used.
604+ //! Tell the StelApp instance which GUI is currently being used.
605 //! The caller is responsible for destroying the GUI.
606 void setGui(StelGuiBase* b) {stelGui=b;}
607
608@@ -390,6 +393,14 @@
609 bool flagShowDecimalDegrees;
610 // flag to indicate we want calculate azimuth from south towards west (as in old astronomical literature)
611 bool flagUseAzimuthFromSouth;
612+#ifdef ENABLE_SPOUT
613+ SPOUTLIBRARY * spoutSender;
614+ char spoutName[256];
615+ GLuint spoutTexID;
616+ bool spoutValid; // true when the named sender instance has been created.
617+ //void initSpoutTexture(GLuint &texID, unsigned int width, unsigned int height);
618+ void initSpoutTexture(unsigned int width, unsigned int height);
619+#endif
620
621 };
622
623
624=== modified file 'src/core/StelOpenGL.hpp'
625--- src/core/StelOpenGL.hpp 2016-07-05 21:52:42 +0000
626+++ src/core/StelOpenGL.hpp 2016-12-13 10:58:20 +0000
627@@ -53,6 +53,7 @@
628 #define glCompileShader(...) GLFUNC_(glCompileShader(__VA_ARGS__))
629 #define glCompressedTexImage2D(...) GLFUNC_(glCompressedTexImage2D(__VA_ARGS__))
630 #define glCompressedTexSubImage2D(...) GLFUNC_(glCompressedTexSubImage2D(__VA_ARGS__))
631+#define glCopyTexSubImage2D(...) GLFUNC_(glCopyTexSubImage2D(__VA_ARGS__)) // new for spout
632 #define glCreateProgram(...) GLFUNC_(glCreateProgram(__VA_ARGS__))
633 #define glCreateShader(...) GLFUNC_(glCreateShader(__VA_ARGS__))
634 #define glDeleteBuffers(...) GLFUNC_(glDeleteBuffers(__VA_ARGS__))
635
636=== added file 'src/core/external/SpoutLibrary.h'
637--- src/core/external/SpoutLibrary.h 1970-01-01 00:00:00 +0000
638+++ src/core/external/SpoutLibrary.h 2016-12-13 10:58:20 +0000
639@@ -0,0 +1,90 @@
640+//
641+// SpoutLibrary.dll
642+//
643+// Spout SDK dll compatible with any C++ compiler
644+//
645+
646+#include <windows.h>
647+#include <GL/GL.h>
648+
649+#define SPOUTLIBRARY_EXPORTS // defined for this DLL. The application imports rather than exports
650+
651+#ifdef SPOUTLIBRARY_EXPORTS
652+#define SPOUTAPI __declspec(dllexport)
653+#else
654+#define SPOUTAPI __declspec(dllimport)
655+#endif
656+
657+////////////////////////////////////////////////////////////////////////////////
658+//
659+// COM-Like abstract interface.
660+// This interface doesn't require __declspec(dllexport/dllimport) specifier.
661+// Method calls are dispatched via virtual table.
662+// Any C++ compiler can use it.
663+// Instances are obtained via factory function.
664+//
665+struct SPOUTLIBRARY
666+{
667+ // Sender
668+ virtual bool CreateSender(const char *Sendername, unsigned int width, unsigned int height, DWORD dwFormat = 0) = 0;
669+ virtual void ReleaseSender(DWORD dwMsec = 0) = 0;
670+ virtual bool UpdateSender(const char* Sendername, unsigned int width, unsigned int height) = 0;
671+ virtual bool SendTexture(GLuint TextureID, GLuint TextureTarget, unsigned int width, unsigned int height, bool bInvert = true, GLuint HostFBO = 0) = 0;
672+ virtual bool SendImage(const unsigned char* pixels, unsigned int width, unsigned int height, GLenum glFormat = GL_RGBA, bool bInvert=false) = 0;
673+
674+ // Receiver
675+ virtual bool CreateReceiver(char* Sendername, unsigned int &width, unsigned int &height, bool bUseActive = false) = 0;
676+ virtual void ReleaseReceiver() = 0;
677+ virtual bool ReceiveTexture(char* Sendername, unsigned int &width, unsigned int &height, GLuint TextureID = 0, GLuint TextureTarget = 0, bool bInvert = false, GLuint HostFBO = 0) = 0;
678+ virtual bool ReceiveImage(char* Sendername, unsigned int &width, unsigned int &height, unsigned char* pixels, GLenum glFormat = GL_RGBA, bool bInvert = false, GLuint HostFBO=0) = 0;
679+ virtual bool CheckReceiver(char* Sendername, unsigned int &width, unsigned int &height, bool &bConnected) = 0;
680+ virtual bool GetImageSize(char* sendername, unsigned int &width, unsigned int &height, bool &bMemoryMode) = 0;
681+
682+ virtual bool BindSharedTexture() = 0;
683+ virtual bool UnBindSharedTexture() = 0;
684+
685+ virtual bool DrawSharedTexture(float max_x = 1.0, float max_y = 1.0, float aspect = 1.0, bool bInvert = true) = 0;
686+ virtual bool DrawToSharedTexture(GLuint TextureID, GLuint TextureTarget, unsigned int width, unsigned int height, float max_x = 1.0, float max_y = 1.0, float aspect = 1.0, bool bInvert = false, GLuint HostFBO = 0) = 0;
687+
688+ virtual int GetSenderCount() = 0;
689+ virtual bool GetSenderName(int index, char* sendername, int MaxSize = 256) = 0;
690+ virtual bool GetSenderInfo(const char* sendername, unsigned int &width, unsigned int &height, HANDLE &dxShareHandle, DWORD &dwFormat) = 0;
691+ virtual bool GetActiveSender(char* Sendername) = 0;
692+ virtual bool SetActiveSender(const char* Sendername) = 0;
693+
694+ // Utilities
695+ virtual bool SetDX9(bool bDX9 = true) = 0; // User request to use DirectX 9 (default is DirectX 11)
696+ virtual bool GetDX9() = 0; // Return the flag that has been set
697+ virtual bool SetMemoryShareMode(bool bMem = true) = 0;
698+ virtual bool GetMemoryShareMode() = 0;
699+ virtual int GetMaxSenders() = 0; // Get maximum senders allowed
700+ virtual void SetMaxSenders(int maxSenders) = 0; // Set maximum senders allowed
701+ virtual bool GetHostPath(const char *sendername, char *hostpath, int maxchars) = 0; // The path of the host that produced the sender
702+ virtual int GetVerticalSync() = 0;
703+ virtual bool SetVerticalSync(bool bSync = true) = 0;
704+ virtual bool SelectSenderPanel(const char* message = NULL) = 0;
705+
706+ // Access to globals
707+ virtual bool GetSpoutSenderName(char * sendername, int maxchars) = 0; // get the global sender name
708+ virtual bool IsSpoutInitialized() = 0; // has the class been initialized
709+
710+ // Adapter functions
711+ virtual int GetNumAdapters() = 0; // Get the number of graphics adapters in the system
712+ virtual bool GetAdapterName(int index, char *adaptername, int maxchars) = 0; // Get an adapter name
713+ virtual bool SetAdapter(int index = 0) = 0; // Set required graphics adapter for output
714+ virtual int GetAdapter() = 0; // Get the SpoutDirectX global adapter index
715+
716+ // Library release function
717+ virtual void Release() = 0;
718+
719+};
720+
721+
722+// Handle type. In C++ language the interface type is used.
723+typedef SPOUTLIBRARY* SPOUTHANDLE;
724+
725+// Factory function that creates instances of the SPOUT object.
726+extern "C" SPOUTAPI SPOUTHANDLE WINAPI GetSpout(VOID);
727+
728+
729+////////////////////////////////////////////////////////////////////////////////
730
731=== modified file 'util/ISL/EnglishCM.isl'
732--- util/ISL/EnglishCM.isl 2016-11-25 10:47:10 +0000
733+++ util/ISL/EnglishCM.isl 2016-12-13 10:58:20 +0000
734@@ -31,5 +31,6 @@
735 AngleD3D11Mode=(ANGLE Direct3D 11 mode)
736 AngleWarpMode=(ANGLE WARP mode)
737 MesaMode=(MESA mode)
738-DebugMode=(debug mode)
739+DebugMode=(with OpenGL diagnostics)
740+SpoutMode=(with Spout sender)
741 RedistRun=Installing Microsoft's C/C++ runtime...
742
743=== added file 'util/ISL/GermanCM.isl'
744--- util/ISL/GermanCM.isl 1970-01-01 00:00:00 +0000
745+++ util/ISL/GermanCM.isl 2016-12-13 10:58:20 +0000
746@@ -0,0 +1,36 @@
747+; *** Inno Setup version 5.5.3+ German messages for Stellarium ***
748+;
749+; Note: When translating this text, do not add periods (.) to the end of
750+; messages that didn't have them already, because on those messages Inno
751+; Setup adds the periods automatically (appending a period would result in
752+; two periods being displayed).
753+
754+[LangOptions]
755+LanguageName=Deutsch
756+LanguageID=$0407
757+LanguageCodePage=1252
758+
759+[CustomMessages]
760+ForAllUsers=Für alle Benutzer
761+ForCurrentUserOnly=Nur für den aktuellen Benutzer
762+RemoveFromPreviousInstallation=Dateien früherer Installationen entfernen:
763+RemoveMainConfig=Entferne Haupt-Konfigurationsdatei
764+RemovePluginsConfig=Entferne Plugin-Konfigurationsdateien
765+RemoveSolarConfig=Entferne Sonnensystem-Datei
766+RemoveUILandscapes=Lösche benutzer-installierte Landschaften
767+RemoveShortcutsConfig=Lösche Tastaturkürzel
768+RemoveCache=Lösche Cache-Dateien
769+UserGuide=Stellarium User Guide (englisch)
770+DevelopersDocsOnTheWeb=Stellarium Entwickler-Dokumentation am Web
771+LastRunLog=Logfile des letzten Durchlaufs
772+OutputDataFile=Ausgabe-Datei
773+ChangeLog=Change log (Änderungsprotokoll)
774+FallbackMode=(Fallback-Modus)
775+AngleMode=(ANGLE-Modus)
776+AngleD3D9Mode=(ANGLE Direct3D 9 Modus)
777+AngleD3D11Mode=(ANGLE Direct3D 11 Modus)
778+AngleWarpMode=(ANGLE WARP Modus)
779+MesaMode=(MESA-Modus)
780+DebugMode=(mit OpenGL Diagnostik)
781+SpoutMode=(mit Spout-Sender)
782+RedistRun=Installiere Microsofts C/C++ Runtime...
783
784=== added directory 'util/spout2'
785=== added file 'util/spout2/README.txt'
786--- util/spout2/README.txt 1970-01-01 00:00:00 +0000
787+++ util/spout2/README.txt 2016-12-13 10:58:20 +0000
788@@ -0,0 +1,4 @@
789+This is the Binaries directory of the SPOUT_LIBRARY part of the Spout SDK retrieved 2016-12-08 from https://github.com/leadedge/Spout2. This version is preferred because it should be usable with non-MS compilers.
790+
791+More information: http://spout.zeal.co/
792+
793\ No newline at end of file
794
795=== added directory 'util/spout2/Win32'
796=== added file 'util/spout2/Win32/SpoutLibrary.dll'
797Binary files util/spout2/Win32/SpoutLibrary.dll 1970-01-01 00:00:00 +0000 and util/spout2/Win32/SpoutLibrary.dll 2016-12-13 10:58:20 +0000 differ
798=== added file 'util/spout2/Win32/SpoutLibrary.lib'
799Binary files util/spout2/Win32/SpoutLibrary.lib 1970-01-01 00:00:00 +0000 and util/spout2/Win32/SpoutLibrary.lib 2016-12-13 10:58:20 +0000 differ
800=== added file 'util/spout2/licence.txt'
801--- util/spout2/licence.txt 1970-01-01 00:00:00 +0000
802+++ util/spout2/licence.txt 2016-12-13 10:58:20 +0000
803@@ -0,0 +1,24 @@
804+SpoutSDK is released under the Simplified BSD licence.
805+
806+Copyright (C) 2014-2016. Lynn Jarvis. All rights reserved.
807+
808+Redistribution and use in source and binary forms, with or without modification,
809+are permitted provided that the following conditions are met:
810+
811+1. Redistributions of source code must retain the above copyright notice,
812+ this list of conditions and the following disclaimer.
813+
814+2. Redistributions in binary form must reproduce the above copyright notice,
815+ this list of conditions and the following disclaimer in the documentation
816+ and/or other materials provided with the distribution.
817+
818+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
819+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
820+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
821+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
822+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
823+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
824+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
825+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
826+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
827+
828
829=== added directory 'util/spout2/x64'
830=== added file 'util/spout2/x64/SpoutLibrary.dll'
831Binary files util/spout2/x64/SpoutLibrary.dll 1970-01-01 00:00:00 +0000 and util/spout2/x64/SpoutLibrary.dll 2016-12-13 10:58:20 +0000 differ
832=== added file 'util/spout2/x64/SpoutLibrary.lib'
833Binary files util/spout2/x64/SpoutLibrary.lib 1970-01-01 00:00:00 +0000 and util/spout2/x64/SpoutLibrary.lib 2016-12-13 10:58:20 +0000 differ