Merge lp:~fschauk/stellarium/qopenglwidget into lp:stellarium

Proposed by Florian Schaukowitsch
Status: Merged
Merged at revision: 9082
Proposed branch: lp:~fschauk/stellarium/qopenglwidget
Merge into: lp:stellarium
Diff against target: 6644 lines (+1643/-1820)
111 files modified
CMakeLists.txt (+70/-25)
cmake/default_config.ini.cmake (+1/-0)
cmake/stellarium.iss.cmake (+1/-2)
data/shaders/s3d_pixellit.frag (+14/-7)
guide/version.tex (+1/-1)
plugins/AngleMeasure/src/AngleMeasure.cpp (+5/-14)
plugins/AngleMeasure/src/CMakeLists.txt (+1/-4)
plugins/ArchaeoLines/src/ArchaeoLines.cpp (+10/-37)
plugins/ArchaeoLines/src/CMakeLists.txt (+1/-4)
plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp (+2/-2)
plugins/CompassMarks/src/CMakeLists.txt (+1/-3)
plugins/CompassMarks/src/CompassMarks.cpp (+4/-20)
plugins/EquationOfTime/src/CMakeLists.txt (+1/-4)
plugins/Exoplanets/src/CMakeLists.txt (+1/-4)
plugins/Exoplanets/src/Exoplanet.cpp (+1/-2)
plugins/Exoplanets/src/Exoplanets.cpp (+1/-3)
plugins/Exoplanets/src/gui/ExoplanetsDialog.cpp (+1/-1)
plugins/Exoplanets/src/gui/exoplanetsDialog.ui (+1/-1)
plugins/FOV/src/CMakeLists.txt (+1/-4)
plugins/HelloStelModule/src/CMakeLists.txt (+1/-5)
plugins/MeteorShowers/src/CMakeLists.txt (+1/-4)
plugins/MeteorShowers/src/MeteorShower.cpp (+1/-3)
plugins/MeteorShowers/src/MeteorShowers.cpp (+2/-3)
plugins/MeteorShowers/src/MeteorShowersMgr.hpp (+1/-1)
plugins/NavStars/src/CMakeLists.txt (+1/-4)
plugins/NavStars/src/NavStars.cpp (+1/-3)
plugins/Novae/src/CMakeLists.txt (+1/-4)
plugins/Novae/src/Novae.cpp (+1/-3)
plugins/Observability/src/CMakeLists.txt (+1/-4)
plugins/Oculars/src/CMakeLists.txt (+1/-5)
plugins/Oculars/src/Oculars.cpp (+4/-23)
plugins/PointerCoordinates/src/CMakeLists.txt (+1/-4)
plugins/Pulsars/src/CMakeLists.txt (+1/-4)
plugins/Pulsars/src/Pulsar.cpp (+2/-2)
plugins/Pulsars/src/Pulsars.cpp (+1/-3)
plugins/Quasars/src/CMakeLists.txt (+1/-4)
plugins/Quasars/src/Quasar.cpp (+1/-2)
plugins/Quasars/src/Quasars.cpp (+1/-3)
plugins/RemoteControl/src/CMakeLists.txt (+1/-4)
plugins/RemoteControl/src/MainService.cpp (+2/-0)
plugins/RemoteControl/src/ScriptService.cpp (+3/-0)
plugins/RemoteSync/src/CMakeLists.txt (+1/-4)
plugins/Satellites/src/CMakeLists.txt (+1/-11)
plugins/Satellites/src/Satellite.cpp (+1/-6)
plugins/Satellites/src/Satellites.cpp (+2/-6)
plugins/Scenery3d/src/CMakeLists.txt (+1/-6)
plugins/Scenery3d/src/OBJ.cpp (+20/-17)
plugins/Scenery3d/src/OBJ.hpp (+2/-0)
plugins/Scenery3d/src/Scenery3d.cpp (+34/-33)
plugins/Scenery3d/src/Scenery3d.hpp (+2/-2)
plugins/Scenery3d/src/ShaderManager.cpp (+6/-3)
plugins/Scenery3d/src/ShaderManager.hpp (+5/-1)
plugins/SimpleDrawLine/src/CMakeLists.txt (+3/-5)
plugins/SolarSystemEditor/src/CMakeLists.txt (+1/-5)
plugins/Supernovae/src/CMakeLists.txt (+1/-4)
plugins/Supernovae/src/Supernovae.cpp (+1/-3)
plugins/TelescopeControl/src/CMakeLists.txt (+7/-3)
plugins/TelescopeControl/src/TelescopeControl.cpp (+2/-9)
plugins/TextUserInterface/src/CMakeLists.txt (+1/-4)
plugins/TextUserInterface/src/TextUserInterface.cpp (+1/-3)
src/CMakeLists.txt (+59/-199)
src/StelLogger.cpp (+14/-6)
src/StelMainView.cpp (+657/-577)
src/StelMainView.hpp (+83/-58)
src/core/OctahedronPolygon.cpp (+1/-1)
src/core/SpoutSender.cpp (+1/-1)
src/core/StelApp.cpp (+36/-20)
src/core/StelApp.hpp (+27/-10)
src/core/StelCore.cpp (+3/-4)
src/core/StelOpenGL.cpp (+12/-12)
src/core/StelOpenGL.hpp (+16/-171)
src/core/StelPainter.cpp (+149/-39)
src/core/StelPainter.hpp (+46/-16)
src/core/StelSkyDrawer.cpp (+8/-21)
src/core/StelSkyDrawer.hpp (+2/-1)
src/core/StelSkyImageTile.cpp (+6/-8)
src/core/StelSkyLayerMgr.cpp (+1/-2)
src/core/StelSkyPolygon.cpp (+1/-2)
src/core/StelTexture.cpp (+10/-3)
src/core/StelTexture.hpp (+1/-1)
src/core/StelToast.cpp (+5/-7)
src/core/StelViewportEffect.cpp (+9/-10)
src/core/TrailGroup.cpp (+1/-2)
src/core/modules/Atmosphere.cpp (+2/-4)
src/core/modules/Comet.cpp (+16/-24)
src/core/modules/Constellation.cpp (+4/-10)
src/core/modules/ConstellationMgr.cpp (+10/-25)
src/core/modules/CustomObject.cpp (+1/-2)
src/core/modules/CustomObjectMgr.cpp (+1/-3)
src/core/modules/GridLinesMgr.cpp (+19/-60)
src/core/modules/LabelMgr.cpp (+1/-3)
src/core/modules/Landscape.cpp (+27/-58)
src/core/modules/LandscapeMgr.cpp (+1/-4)
src/core/modules/Meteor.cpp (+4/-6)
src/core/modules/MilkyWay.cpp (+3/-4)
src/core/modules/Nebula.cpp (+1/-2)
src/core/modules/NebulaMgr.cpp (+2/-6)
src/core/modules/Planet.cpp (+18/-20)
src/core/modules/SolarSystem.cpp (+2/-6)
src/core/modules/StarMgr.cpp (+1/-3)
src/core/modules/ZodiacalLight.cpp (+3/-5)
src/external/CMakeLists.txt (+85/-0)
src/gui/AstroCalcDialog.cpp (+1/-1)
src/gui/HelpDialog.cpp (+0/-1)
src/gui/ScriptConsole.cpp (+1/-0)
src/gui/StelDialog.cpp (+1/-0)
src/gui/StelGuiItems.cpp (+1/-1)
src/gui/astroCalcDialog.ui (+1/-1)
src/main.cpp (+2/-2)
src/scripting/StelScriptMgr.cpp (+45/-27)
src/scripting/StelScriptMgr.hpp (+2/-20)
To merge this branch: bzr merge lp:~fschauk/stellarium/qopenglwidget
Reviewer Review Type Date Requested Status
Fabien Chéreau Approve
gzotti Approve
Review via email: mp+314653@code.launchpad.net

Description of the change

This branch removes the dependency on the deprecated QtOpenGL module by changing the main viewport to use the newer QOpenGLWidget from the QtGUI module instead of the old QGLWidget.

Additionally, it changes the way the Qt libraries are linked with CMake by using the provided imported targets, instead of the deprecated QT5_USE_MODULES. Also, the external depedencies are now built as static libraries and linked in later, this is a cleaner setup and accelerates rebuilding (especially the tests).

The OpenGL library is now only directly linked when building for an ES2-only platform. All GL access is done through the QtGUI module and QOpenGLFunctions directly. The troublesome macros from StelOpenGL have all been removed.

Many classes used the same GL calls to repeatedly set up blending modes, line smoothing, etc. This is now part of StelPainter, which tracks the current state and avoids GL calls if possible. Only very few classes now call GL directly.

QOpenGLWidget requires Qt 5.4 at a minimum. A CMake flag USE_OLD_QGLWIDGET can be used to switch back to the QGLWidget, this allows Stellarium to still be built with 5.3.
The widget change has an effect on performance. On Windows, there generally seems to be a slight FPS decrease when QOpenGLWidget is used (220 instead of 240 FPS for me), while on Linux Georg and I noticed an improved performance (in a case even ~50%!).
I'm not fully sure what causes this, but most likely the internal changes QOpenGLWidget has are at fault. It uses an explicit framebuffer object for rendering, and context sharing.

I need further help testing:
- Touch/Pinch input (Windows)
- HiDPI/Retina rendering
because I don't have the necessary hardware.

To post a comment you must log in.
Revision history for this message
gzotti (georg-zotti) wrote :

Looks like a thorough cleanout of old stuff, restructuring of the CMakefile for a faster build esp of the tests, and the removal of the deprecated QGLWidgets is a clear step forwards which should ensure longevity even beyond Qt5.7.
I have tested pinch/touch now on my netbook (40min compile...), works nicely on Win10!
I don't have any HiDPI hardware to test either, sorry.
I have tested a week ago on RaspberryPi. I compiles with the old classes from its old Qt5.3.2.
The performance loss on Windows is strange, maybe we should keep the old class on Windows for a while? On 2 PC-based Linux systems I saw consistently higher framerate.
I would like to hear about Mac compatibility, but from my side, I approve.

review: Approve
Revision history for this message
Guillaume Chereau (guillaume-chereau) wrote :

Approve.

I agree: the cleanup of the CMakeFile.txt is very welcome!

Could we remove USE_OLD_QGLWIDGET in StelMainView now? Or is that still
needed?

Revision history for this message
Fabien Chéreau (xalioth) wrote :

Good patch! Fine for me.

I also don't think it makes much sense to support Qt < 5.3 as we already have too many configuration to deal with so I'd also just drop USE_OLD_QGLWIDGET to clean up the code further.

review: Approve
Revision history for this message
gzotti (georg-zotti) wrote :

Just FYI: There are systems still around which don't have upgraded to Qt5.4 yet. Esp. Raspbian on the Raspberry Pi 2 or 3 platform has Qt5.3.2, and I have failed so far to compile and setup Qt myself successfully in a way that wold allow Stellarium to run (I am not familiar enough with X11 and EGL to understand the error messages). I consider this platform interesting for education and low-power use, there is a new open-source OpenGL driver just being completed (actually Mesa13 has it, but I now noted a new heavy bug in it). Else Stellarium runs with 12-20fps now, that's competitive to my AMD Win10 netbook. When Raspbian (and any other platforms we can regard important) comes with Qt5.4+, we can remove USE_OLD_QGLWIDGET.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2017-01-03 08:56:34 +0000
+++ CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -16,6 +16,9 @@
16 CMAKE_POLICY(SET CMP0054 OLD)16 CMAKE_POLICY(SET CMP0054 OLD)
17ENDIF()17ENDIF()
1818
19# warn about deprecated stuff so that we may try fixing it
20SET(CMAKE_WARN_DEPRECATED 1)
21
19########### Project name ###########22########### Project name ###########
20PROJECT(Stellarium)23PROJECT(Stellarium)
21# Use integer versions instead of strings for easier handling if required24# Use integer versions instead of strings for easier handling if required
@@ -37,6 +40,7 @@
37# Write version of Stellarium to Stellarium User Guide40# Write version of Stellarium to Stellarium User Guide
38FILE(WRITE ${PROJECT_SOURCE_DIR}/guide/version.tex "\\newcommand{\\StelVersion}{${VERSION}}\n")41FILE(WRITE ${PROJECT_SOURCE_DIR}/guide/version.tex "\\newcommand{\\StelVersion}{${VERSION}}\n")
3942
43# currently Qt 5.4 - 5.6 is recommended, we can still build with Qt 5.3, and 5.7 may have some bugs
40SET(MINIMAL_QT_VERSION "5.3.0")44SET(MINIMAL_QT_VERSION "5.3.0")
4145
42# Use customized cmake macros46# Use customized cmake macros
@@ -58,6 +62,13 @@
58 ADD_DEFINITIONS(-DQT_NO_DEBUG -DNDEBUG)62 ADD_DEFINITIONS(-DQT_NO_DEBUG -DNDEBUG)
59endif()63endif()
6064
65set(OPENGL_DEBUG_LOGGING 0 CACHE BOOL "Enable to log OpenGL information using the GL_KHR_debug extension/QOpenGLLogger")
66if(OPENGL_DEBUG_LOGGING)
67 add_definitions(-DOPENGL_DEBUG_LOGGING)
68 # This enables logging of QOpenGLFunctions through forced glGetError after each call
69 add_definitions(-DQ_ENABLE_OPENGL_FUNCTIONS_DEBUG)
70endif()
71
61# Use ccache if possible72# Use ccache if possible
62find_program(CCACHE_PROGRAM ccache)73find_program(CCACHE_PROGRAM ccache)
63if(CCACHE_PROGRAM)74if(CCACHE_PROGRAM)
@@ -276,6 +287,7 @@
276ADD_PLUGIN(Exoplanets 1)287ADD_PLUGIN(Exoplanets 1)
277ADD_PLUGIN(EquationOfTime 1)288ADD_PLUGIN(EquationOfTime 1)
278ADD_PLUGIN(FOV 1)289ADD_PLUGIN(FOV 1)
290# TODO: Logbook build is broken for quite some time
279ADD_PLUGIN(LogBook 0)291ADD_PLUGIN(LogBook 0)
280ADD_PLUGIN(MeteorShowers 1)292ADD_PLUGIN(MeteorShowers 1)
281ADD_PLUGIN(NavStars 1)293ADD_PLUGIN(NavStars 1)
@@ -318,8 +330,9 @@
318FIND_PACKAGE(Qt5Concurrent REQUIRED)330FIND_PACKAGE(Qt5Concurrent REQUIRED)
319FIND_PACKAGE(Qt5Gui REQUIRED)331FIND_PACKAGE(Qt5Gui REQUIRED)
320FIND_PACKAGE(Qt5Network REQUIRED)332FIND_PACKAGE(Qt5Network REQUIRED)
321FIND_PACKAGE(Qt5OpenGL REQUIRED)
322FIND_PACKAGE(Qt5Widgets REQUIRED)333FIND_PACKAGE(Qt5Widgets REQUIRED)
334# required for qcustomplot external dependency
335# not used elsewhere
323FIND_PACKAGE(Qt5PrintSupport REQUIRED)336FIND_PACKAGE(Qt5PrintSupport REQUIRED)
324IF(USE_PLUGIN_TELESCOPECONTROL)337IF(USE_PLUGIN_TELESCOPECONTROL)
325 FIND_PACKAGE(Qt5SerialPort REQUIRED)338 FIND_PACKAGE(Qt5SerialPort REQUIRED)
@@ -355,6 +368,38 @@
355 ENDIF()368 ENDIF()
356ENDIF()369ENDIF()
357370
371# when using Qt 5.3, default to using the old QGLWidget, but warn
372if(${Qt5Core_VERSION_STRING} VERSION_LESS "5.4")
373 set(USE_OLD_QGLWIDGET 1)
374 message(WARNING "You are using Qt ${Qt5Core_VERSION_STRING} to build, falling back to legacy QGLWidget rendering. Consider using at least Qt 5.4 if possible.")
375else()
376 # offer the old widget as an alternative, default off
377 set(USE_OLD_QGLWIDGET 0 CACHE BOOL "Use the legacy QGLWidget instead of the new QOpenGLWidget for the main viewport, and link to the QtOpenGL module")
378endif()
379
380if(USE_OLD_QGLWIDGET)
381 add_definitions(-DUSE_OLD_QGLWIDGET)
382 find_package(Qt5OpenGL REQUIRED)
383endif()
384
385# Since Qt 5.4, linking to OpenGL is basically not required anymore,
386# because the QtGui module re-implements the GL functions, and perhaps even
387# dispatches the calls to a dynamically selected GL library.
388#
389# The only exception where this does not work with CMake is for
390# ES2-only/ANGLE-only builds, which are seemingly not included in
391# official Qt downloads, but may be required as a custom build
392# for some embedded systems. Interestingly, this works with qmake,
393# but CMake needs an explicit link definition.
394# See also this bug: https://bugreports.qt.io/browse/QTBUG-29132
395
396# Check if we have a GLES-only build
397# On dynamic builds, this property is also "GL"
398if(${Qt5Gui_OPENGL_IMPLEMENTATION} MATCHES "GLES")
399 message(STATUS "Building an OpenGL ES build (${Qt5Gui_OPENGL_IMPLEMENTATION})")
400 set(STEL_GLES_LIBS Qt5::Gui_EGL Qt5::Gui_GLESv2)
401endif()
402
358403
359# Tell CMake to run moc when necessary:404# Tell CMake to run moc when necessary:
360set(CMAKE_AUTOMOC ON)405set(CMAKE_AUTOMOC ON)
@@ -362,31 +407,38 @@
362set(CMAKE_INCLUDE_CURRENT_DIR ON)407set(CMAKE_INCLUDE_CURRENT_DIR ON)
363408
364IF(ENABLE_SCRIPTING)409IF(ENABLE_SCRIPTING)
365 SET(QT_USE_QTSCRIPT TRUE)
366 FIND_PACKAGE(Qt5Script REQUIRED)410 FIND_PACKAGE(Qt5Script REQUIRED)
367 INCLUDE_DIRECTORIES(${Qt5Script_INCLUDE_DIRS})
368ENDIF()411ENDIF()
369IF(ENABLE_MEDIA)412IF(ENABLE_MEDIA)
370 ADD_DEFINITIONS(-DENABLE_MEDIA)413 ADD_DEFINITIONS(-DENABLE_MEDIA)
371 FIND_PACKAGE(Qt5Multimedia REQUIRED)414 FIND_PACKAGE(Qt5Multimedia REQUIRED)
372 FIND_PACKAGE(Qt5MultimediaWidgets REQUIRED)415 FIND_PACKAGE(Qt5MultimediaWidgets REQUIRED)
373 INCLUDE_DIRECTORIES(${Qt5Multimedia_INCLUDE_DIRS})
374 INCLUDE_DIRECTORIES(${Qt5MultimediaWidgets_INCLUDE_DIRS})
375ENDIF()
376
377# I add this test because on Windows with angle we should not link
378# with OpenGL. Maybe there is a better way to do that.
379IF("${Qt5Gui_OPENGL_LIBRARIES}" MATCHES "opengl")
380 FIND_PACKAGE(OpenGL REQUIRED)
381ENDIF()
382IF(NOT WIN32)
383 FIND_PACKAGE(ZLIB)
384ELSE()
385 SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/core/external/zlib)
386ENDIF()416ENDIF()
387417
388FIND_PACKAGE(Qt5Test)418FIND_PACKAGE(Qt5Test)
389INCLUDE_DIRECTORIES(${Qt5Test_INCLUDE_DIRS})419
420### Setup external packages
421
422find_package(ZLIB QUIET) #quiet warnings about not found, we have our own version anyway
423
424# if a system zlib is found, let the user choose if to instead use our bundled version
425if(ZLIB_FOUND)
426 if(WIN32) #on win, we default to "no"
427 set(USE_SYSTEM_ZLIB 0 CACHE BOOL "Use system-provided zlib instead of the bundled version")
428 else() #else, we default to "yes"
429 set(USE_SYSTEM_ZLIB 1 CACHE BOOL "Use system-provided zlib instead of the bundled version")
430 endif()
431else()
432 set(USE_SYSTEM_ZLIB 0)
433endif()
434
435if(NOT USE_SYSTEM_ZLIB)
436 #use our own zlib
437 message(STATUS "Using bundled zlib version at ${CMAKE_SOURCE_DIR}/src/external/zlib")
438 set(ZLIB_LIBRARIES zlib_stel)
439else()
440 message(STATUS "Using system-provided zlib at ${ZLIB_LIBRARIES}")
441endif()
390442
391########### Set some global variables ###########443########### Set some global variables ###########
392IF(UNIX AND NOT WIN32)444IF(UNIX AND NOT WIN32)
@@ -408,7 +460,6 @@
408 ADD_DEFINITIONS(-DINSTALL_LOCALEDIR_FOR_DEBUG="${CMAKE_SOURCE_DIR}")460 ADD_DEFINITIONS(-DINSTALL_LOCALEDIR_FOR_DEBUG="${CMAKE_SOURCE_DIR}")
409endif()461endif()
410462
411
412########### Get revision number for non-release builds ###########463########### Get revision number for non-release builds ###########
413IF(NOT STELLARIUM_RELEASE_BUILD)464IF(NOT STELLARIUM_RELEASE_BUILD)
414 # Hack until CMake detection for Bazaar is finished465 # Hack until CMake detection for Bazaar is finished
@@ -502,12 +553,12 @@
502 GET_TARGET_PROPERTY(QtConcurrent_location Qt5::Concurrent LOCATION)553 GET_TARGET_PROPERTY(QtConcurrent_location Qt5::Concurrent LOCATION)
503 GET_TARGET_PROPERTY(QtCore_location Qt5::Core LOCATION)554 GET_TARGET_PROPERTY(QtCore_location Qt5::Core LOCATION)
504 GET_TARGET_PROPERTY(QtGui_location Qt5::Gui LOCATION)555 GET_TARGET_PROPERTY(QtGui_location Qt5::Gui LOCATION)
505 GET_TARGET_PROPERTY(QtOpenGL_location Qt5::OpenGL LOCATION)
506 GET_TARGET_PROPERTY(QtNetwork_location Qt5::Network LOCATION)556 GET_TARGET_PROPERTY(QtNetwork_location Qt5::Network LOCATION)
507 GET_TARGET_PROPERTY(QtWidgets_location Qt5::Widgets LOCATION)557 GET_TARGET_PROPERTY(QtWidgets_location Qt5::Widgets LOCATION)
508 GET_TARGET_PROPERTY(QtSql_location Qt5::Sql LOCATION) 558 GET_TARGET_PROPERTY(QtSql_location Qt5::Sql LOCATION)
509 GET_TARGET_PROPERTY(QtXmlPatterns_location Qt5::XmlPatterns LOCATION)559 GET_TARGET_PROPERTY(QtXmlPatterns_location Qt5::XmlPatterns LOCATION)
510 GET_TARGET_PROPERTY(QtPrintSupport_location Qt5::PrintSupport LOCATION)560 GET_TARGET_PROPERTY(QtPrintSupport_location Qt5::PrintSupport LOCATION)
561 SET(ISS_QT_PRINTSUPPORT "Source: \"${QtPrintSupport_location}\"; DestDir: \"{app}\";")
511 IF(ENABLE_SCRIPTING)562 IF(ENABLE_SCRIPTING)
512 GET_TARGET_PROPERTY(QtScript_location Qt5::Script LOCATION)563 GET_TARGET_PROPERTY(QtScript_location Qt5::Script LOCATION)
513 SET(ISS_QT_SCRIPT "Source: \"${QtScript_location}\"; DestDir: \"{app}\";")564 SET(ISS_QT_SCRIPT "Source: \"${QtScript_location}\"; DestDir: \"{app}\";")
@@ -685,16 +736,10 @@
685 ${CMAKE_SOURCE_DIR}/src/core736 ${CMAKE_SOURCE_DIR}/src/core
686 ${CMAKE_SOURCE_DIR}/src/core/modules737 ${CMAKE_SOURCE_DIR}/src/core/modules
687 ${CMAKE_SOURCE_DIR}/src/core/planetsephems738 ${CMAKE_SOURCE_DIR}/src/core/planetsephems
688 ${CMAKE_SOURCE_DIR}/src/core/external
689 ${CMAKE_SOURCE_DIR}/src/core/external/qtcompress
690 ${CMAKE_SOURCE_DIR}/src/core/external/qcustomplot
691 ${CMAKE_SOURCE_DIR}/src/core/external/glues_stel/source/
692 ${CMAKE_SOURCE_DIR}/src/core/external/glues_stel/source/libtess
693 ${CMAKE_SOURCE_DIR}/src/gui739 ${CMAKE_SOURCE_DIR}/src/gui
694 ${CMAKE_SOURCE_DIR}/src/scripting740 ${CMAKE_SOURCE_DIR}/src/scripting
695 ${INTL_INCLUDE_DIR}741 ${INTL_INCLUDE_DIR}
696 ${CMAKE_BINARY_DIR}/src742 ${CMAKE_BINARY_DIR}/src
697 ${ZLIB_INCLUDE_DIR}
698)743)
699744
700########### Subdirectories ###############745########### Subdirectories ###############
701746
=== modified file 'cmake/default_config.ini.cmake'
--- cmake/default_config.ini.cmake 2016-10-29 12:45:33 +0000
+++ cmake/default_config.ini.cmake 2017-01-12 21:08:38 +0000
@@ -22,6 +22,7 @@
22maximum_fps = 1000022maximum_fps = 10000
23#viewport_effect = sphericMirrorDistorter23#viewport_effect = sphericMirrorDistorter
24viewport_effect = none24viewport_effect = none
25vsync = true
2526
26[projection]27[projection]
27type = ProjectionStereographic28type = ProjectionStereographic
2829
=== modified file 'cmake/stellarium.iss.cmake'
--- cmake/stellarium.iss.cmake 2017-01-03 08:56:34 +0000
+++ cmake/stellarium.iss.cmake 2017-01-12 21:08:38 +0000
@@ -47,13 +47,12 @@
47Source: "@CMAKE_SOURCE_DIR@\ChangeLog"; DestDir: "{app}"; Flags: ignoreversion; DestName: "ChangeLog.rtf"47Source: "@CMAKE_SOURCE_DIR@\ChangeLog"; DestDir: "{app}"; Flags: ignoreversion; DestName: "ChangeLog.rtf"
48Source: "@QtCore_location@"; DestDir: "{app}";48Source: "@QtCore_location@"; DestDir: "{app}";
49Source: "@QtGui_location@"; DestDir: "{app}";49Source: "@QtGui_location@"; DestDir: "{app}";
50Source: "@QtOpenGL_location@"; DestDir: "{app}";
51Source: "@QtNetwork_location@"; DestDir: "{app}";50Source: "@QtNetwork_location@"; DestDir: "{app}";
52Source: "@QtWidgets_location@"; DestDir: "{app}";51Source: "@QtWidgets_location@"; DestDir: "{app}";
53Source: "@QtSql_location@"; DestDir: "{app}";52Source: "@QtSql_location@"; DestDir: "{app}";
54Source: "@QtXmlPatterns_location@"; DestDir: "{app}";53Source: "@QtXmlPatterns_location@"; DestDir: "{app}";
55Source: "@QtConcurrent_location@"; DestDir: "{app}";54Source: "@QtConcurrent_location@"; DestDir: "{app}";
56Source: "@QtPrintSupport_location@"; DestDir: "{app}";55@ISS_QT_PRINTSUPPORT@
57@ISS_QT_SCRIPT@56@ISS_QT_SCRIPT@
58@ISS_QT_MULTIMEDIA@57@ISS_QT_MULTIMEDIA@
59@ISS_QT_SERIALPORT@58@ISS_QT_SERIALPORT@
6059
=== modified file 'data/shaders/s3d_pixellit.frag'
--- data/shaders/s3d_pixellit.frag 2015-09-11 16:34:17 +0000
+++ data/shaders/s3d_pixellit.frag 2017-01-12 21:08:38 +0000
@@ -32,6 +32,7 @@
32#define SHADOW_FILTER 032#define SHADOW_FILTER 0
33#define SHADOW_FILTER_HQ 033#define SHADOW_FILTER_HQ 0
34#define SINGLE_SHADOW_FRUSTUM 134#define SINGLE_SHADOW_FRUSTUM 1
35#define HW_SHADOW_SAMPLERS 0
35#define PCSS 036#define PCSS 0
36#define MAT_DIFFUSETEX 137#define MAT_DIFFUSETEX 1
37#define MAT_EMISSIVETEX 138#define MAT_EMISSIVETEX 1
@@ -254,10 +255,10 @@
254#endif255#endif
255//shadow related uniforms256//shadow related uniforms
256uniform vec4 u_vSplits; //the frustum splits257uniform vec4 u_vSplits; //the frustum splits
257#if PCSS258#if HW_SHADOW_SAMPLERS
259 #define SHADOWSAMPLER sampler2DShadow
260#else
258 #define SHADOWSAMPLER sampler2D261 #define SHADOWSAMPLER sampler2D
259#else
260 #define SHADOWSAMPLER sampler2DShadow
261#endif262#endif
262263
263//for some reason, Intel does absolutely not like it if the shadowmaps are passed as an array264//for some reason, Intel does absolutely not like it if the shadowmaps are passed as an array
@@ -311,23 +312,29 @@
311 {312 {
312 vec2 offset = poissonDisk[i] * filterRadiusUV;313 vec2 offset = poissonDisk[i] * filterRadiusUV;
313 //TODO offsets should probably depend on light ortho size?314 //TODO offsets should probably depend on light ortho size?
314 #if PCSS315 #if HW_SHADOW_SAMPLERS
316 sum+=shadow2D(tex,vec3(texC.xy + offset, texC.z)).x;
317 #else
315 //texture is a normal sampler2D because we need depth values in blocker calculation318 //texture is a normal sampler2D because we need depth values in blocker calculation
316 //opengl does not allow to sample this texture in 2 different ways (unless sampler objects are used, but needs version >= 3.3)319 //opengl does not allow to sample this texture in 2 different ways (unless sampler objects are used, but needs version >= 3.3)
317 //so we have to do comparison ourselves 320 //so we have to do comparison ourselves
318 sum+= (texture2D(tex,texC.xy + offset).r > texC.z) ? 1.0f : 0.0f;321 sum+= (texture2D(tex,texC.xy + offset).r > texC.z) ? 1.0f : 0.0f;
319 #else
320 sum+=shadow2D(tex,vec3(texC.xy + offset, texC.z)).x;
321 #endif322 #endif
322 }323 }
323 return sum / FILTER_STEPS;324 return sum / FILTER_STEPS;
324 #else325 #elif HW_SHADOW_SAMPLERS
325 //no filtering performed, just return the sampled tex326 //no filtering performed, just return the sampled tex
326 return shadow2DProj(tex,coord).x;327 return shadow2DProj(tex,coord).x;
328 #else
329 vec3 texC = coord.xyz / coord.w;
330 return texture2D(tex,texC.xy).x > texC.z ? 1.0f : 0.0f;
327 #endif331 #endif
328}332}
329333
330#if PCSS334#if PCSS
335#if HW_SHADOW_SAMPLERS
336#error Tried to compile PCSS shader compiled with HW shadow samplers
337#endif
331//Based on the PCSS implementation of NVidia, ported to GLSL 338//Based on the PCSS implementation of NVidia, ported to GLSL
332//see http://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf339//see http://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf
333//Some modifications to work better with directional light are included340//Some modifications to work better with directional light are included
334341
=== modified file 'guide/version.tex'
--- guide/version.tex 2017-01-02 14:34:22 +0000
+++ guide/version.tex 2017-01-12 21:08:38 +0000
@@ -1,1 +1,1 @@
1\newcommand{\StelVersion}{0.90.0}1\newcommand{\StelVersion}{0.90.0}
22
=== modified file 'plugins/AngleMeasure/src/AngleMeasure.cpp'
--- plugins/AngleMeasure/src/AngleMeasure.cpp 2017-01-06 16:52:05 +0000
+++ plugins/AngleMeasure/src/AngleMeasure.cpp 2017-01-12 21:08:38 +0000
@@ -34,7 +34,6 @@
34#include <QDebug>34#include <QDebug>
35#include <QTimer>35#include <QTimer>
36#include <QPixmap>36#include <QPixmap>
37#include <QtNetwork>
38#include <QSettings>37#include <QSettings>
39#include <QKeyEvent>38#include <QKeyEvent>
40#include <QMouseEvent>39#include <QMouseEvent>
@@ -188,9 +187,8 @@
188 const StelProjectorP prj = core->getProjection(frameType, refractionMode);187 const StelProjectorP prj = core->getProjection(frameType, refractionMode);
189 StelPainter painter(prj);188 StelPainter painter(prj);
190 painter.setFont(font);189 painter.setFont(font);
190 painter.setBlending(true);
191191
192 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
193 glEnable(GL_BLEND);
194 if (lineVisible.getInterstate() > 0.000001f)192 if (lineVisible.getInterstate() > 0.000001f)
195 {193 {
196 Vec3d xy;194 Vec3d xy;
@@ -220,12 +218,7 @@
220 }218 }
221 }219 }
222220
223 glDisable(GL_TEXTURE_2D);221 painter.setLineSmooth(true);
224 // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH. But it looks much better.
225 #ifdef GL_LINE_SMOOTH
226 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
227 glEnable(GL_LINE_SMOOTH);
228 #endif
229222
230 // main line is a great circle223 // main line is a great circle
231 painter.setColor(lineColor[0], lineColor[1], lineColor[2], lineVisible.getInterstate());224 painter.setColor(lineColor[0], lineColor[1], lineColor[2], lineVisible.getInterstate());
@@ -245,10 +238,8 @@
245 painter.drawGreatCircleArc(perp1StartPointHor, perp1EndPointHor, NULL);238 painter.drawGreatCircleArc(perp1StartPointHor, perp1EndPointHor, NULL);
246 painter.drawGreatCircleArc(perp2StartPointHor, perp2EndPointHor, NULL);239 painter.drawGreatCircleArc(perp2StartPointHor, perp2EndPointHor, NULL);
247 }240 }
248 #ifdef GL_LINE_SMOOTH241
249 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)242 painter.setLineSmooth(false);
250 glDisable(GL_LINE_SMOOTH);
251 #endif
252 }243 }
253 if (messageFader.getInterstate() > 0.000001f)244 if (messageFader.getInterstate() > 0.000001f)
254 {245 {
@@ -262,7 +253,7 @@
262 y -= ls;253 y -= ls;
263 painter.drawText(x, y, messageRightButton);254 painter.drawText(x, y, messageRightButton);
264 }255 }
265 glDisable(GL_BLEND);256 painter.setBlending(false);
266}257}
267258
268//! Draw any parts on the screen which are for our module259//! Draw any parts on the screen which are for our module
269260
=== modified file 'plugins/AngleMeasure/src/CMakeLists.txt'
--- plugins/AngleMeasure/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/AngleMeasure/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -18,12 +18,9 @@
18SET(AngleMeasure_RES ../AngleMeasure.qrc)18SET(AngleMeasure_RES ../AngleMeasure.qrc)
19QT5_ADD_RESOURCES(AngleMeasure_RES_CXX ${AngleMeasure_RES})19QT5_ADD_RESOURCES(AngleMeasure_RES_CXX ${AngleMeasure_RES})
2020
21SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
22
23ADD_LIBRARY(AngleMeasure-static STATIC ${AngleMeasure_SRCS} ${AngleMeasure_RES_CXX} ${AngleMeasure_UIS_H})21ADD_LIBRARY(AngleMeasure-static STATIC ${AngleMeasure_SRCS} ${AngleMeasure_RES_CXX} ${AngleMeasure_UIS_H})
24QT5_USE_MODULES(AngleMeasure-static Core Network Widgets)22TARGET_LINK_LIBRARIES(AngleMeasure-static Qt5::Core Qt5::Widgets)
25# The library target "AngleMeasure-static" has a default OUTPUT_NAME of "AngleMeasure-static", so change it.23# The library target "AngleMeasure-static" has a default OUTPUT_NAME of "AngleMeasure-static", so change it.
26SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES OUTPUT_NAME "AngleMeasure")24SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES OUTPUT_NAME "AngleMeasure")
27TARGET_LINK_LIBRARIES(AngleMeasure-static ${extLinkerOption})
28SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")25SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
29ADD_DEPENDENCIES(AllStaticPlugins AngleMeasure-static)26ADD_DEPENDENCIES(AllStaticPlugins AngleMeasure-static)
3027
=== modified file 'plugins/ArchaeoLines/src/ArchaeoLines.cpp'
--- plugins/ArchaeoLines/src/ArchaeoLines.cpp 2016-12-24 10:33:14 +0000
+++ plugins/ArchaeoLines/src/ArchaeoLines.cpp 2017-01-12 21:08:38 +0000
@@ -37,7 +37,6 @@
37#include <QTimer>37#include <QTimer>
38#include <QPixmap>38#include <QPixmap>
39#include <QColor>39#include <QColor>
40#include <QtNetwork>
41#include <QSettings>40#include <QSettings>
42#include <QMouseEvent>41#include <QMouseEvent>
43#include <cmath>42#include <cmath>
@@ -1223,9 +1222,7 @@
12231222
1224 d->sPainter->drawText(screenPos[0], screenPos[1], text, angleDeg, xshift, 3);1223 d->sPainter->drawText(screenPos[0], screenPos[1], text, angleDeg, xshift, 3);
1225 //d->sPainter->setColor(tmpColor[0], tmpColor[1], tmpColor[2], tmpColor[3]); // RESTORE1224 //d->sPainter->setColor(tmpColor[0], tmpColor[1], tmpColor[2], tmpColor[3]); // RESTORE
1226 glDisable(GL_TEXTURE_2D);1225 d->sPainter->setBlending(true);
1227 glEnable(GL_BLEND);
1228 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1229}1226}
12301227
12311228
@@ -1324,16 +1321,8 @@
13241321
1325 // Initialize a painter and set OpenGL state1322 // Initialize a painter and set OpenGL state
1326 StelPainter sPainter(prj);1323 StelPainter sPainter(prj);
1327 glEnable(GL_BLEND);1324 sPainter.setBlending(true);
1328 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode1325 sPainter.setLineSmooth(true);
1329 glDisable(GL_TEXTURE_2D);
1330
1331 // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH
1332 #ifdef GL_LINE_SMOOTH
1333 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
1334 glEnable(GL_LINE_SMOOTH);
1335 #endif
1336
1337 sPainter.setColor(color[0], color[1], color[2], intensity*fader.getInterstate());1326 sPainter.setColor(color[0], color[1], color[2], intensity*fader.getInterstate());
1338 //Vec4f textColor(color[0], color[1], color[2], intensity*fader.getInterstate());1327 //Vec4f textColor(color[0], color[1], color[2], intensity*fader.getInterstate());
13391328
@@ -1419,22 +1408,11 @@
1419 sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, alViewportEdgeIntersectCallback, &userData);1408 sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, alViewportEdgeIntersectCallback, &userData);
1420 sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, alViewportEdgeIntersectCallback, &userData);1409 sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, alViewportEdgeIntersectCallback, &userData);
1421 sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, alViewportEdgeIntersectCallback, &userData);1410 sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, alViewportEdgeIntersectCallback, &userData);
1422 #ifdef GL_LINE_SMOOTH1411 }
1423 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)1412
1424 glDisable(GL_LINE_SMOOTH);1413 sPainter.setLineSmooth(false);
1425 #endif1414 sPainter.setBlending(false);
1426 glDisable(GL_BLEND);1415 return;
1427 return;
1428 }
1429 else
1430 {
1431 #ifdef GL_LINE_SMOOTH
1432 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
1433 glDisable(GL_LINE_SMOOTH);
1434 #endif
1435 glDisable(GL_BLEND);
1436 return;
1437 }
1438 }1416 }
1439 // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg1417 // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg
1440 Vec3d middlePoint = p1-rotCenter+p2-rotCenter;1418 Vec3d middlePoint = p1-rotCenter+p2-rotCenter;
@@ -1451,11 +1429,6 @@
1451 sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,alViewportEdgeIntersectCallback, &userData);1429 sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,alViewportEdgeIntersectCallback, &userData);
1452 sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, alViewportEdgeIntersectCallback, &userData);1430 sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, alViewportEdgeIntersectCallback, &userData);
14531431
1454 // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH1432 sPainter.setLineSmooth(false);
1455 #ifdef GL_LINE_SMOOTH1433 sPainter.setBlending(false);
1456 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
1457 glDisable(GL_LINE_SMOOTH);
1458 #endif
1459
1460 glDisable(GL_BLEND);
1461}1434}
14621435
=== modified file 'plugins/ArchaeoLines/src/CMakeLists.txt'
--- plugins/ArchaeoLines/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/ArchaeoLines/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -18,12 +18,9 @@
18SET(ArchaeoLines_RES ../ArchaeoLines.qrc)18SET(ArchaeoLines_RES ../ArchaeoLines.qrc)
19QT5_ADD_RESOURCES(ArchaeoLines_RES_CXX ${ArchaeoLines_RES})19QT5_ADD_RESOURCES(ArchaeoLines_RES_CXX ${ArchaeoLines_RES})
2020
21SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
22
23ADD_LIBRARY(ArchaeoLines-static STATIC ${ArchaeoLines_SRCS} ${ArchaeoLines_RES_CXX} ${ArchaeoLines_UIS_H})21ADD_LIBRARY(ArchaeoLines-static STATIC ${ArchaeoLines_SRCS} ${ArchaeoLines_RES_CXX} ${ArchaeoLines_UIS_H})
24QT5_USE_MODULES(ArchaeoLines-static Core Network Widgets)22TARGET_LINK_LIBRARIES(ArchaeoLines-static Qt5::Core Qt5::Widgets)
25# The library target "ArchaeoLines-static" has a default OUTPUT_NAME of "ArchaeoLines-static", so change it.23# The library target "ArchaeoLines-static" has a default OUTPUT_NAME of "ArchaeoLines-static", so change it.
26SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES OUTPUT_NAME "ArchaeoLines")24SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES OUTPUT_NAME "ArchaeoLines")
27TARGET_LINK_LIBRARIES(ArchaeoLines-static ${extLinkerOption})
28SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")25SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
29ADD_DEPENDENCIES(AllStaticPlugins ArchaeoLines-static)26ADD_DEPENDENCIES(AllStaticPlugins ArchaeoLines-static)
3027
=== modified file 'plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp'
--- plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp 2017-01-05 15:28:52 +0000
+++ plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp 2017-01-12 21:08:38 +0000
@@ -222,8 +222,8 @@
222 #ifndef Q_OS_WIN222 #ifndef Q_OS_WIN
223 ui->switchToWindowedModeLabel->hide();223 ui->switchToWindowedModeLabel->hide();
224 #else224 #else
225 QString glRenderer(reinterpret_cast<const char*>(glGetString(GL_RENDERER)));225 // don't call GL functions in GUI code please
226 if (glRenderer.startsWith("ANGLE", Qt::CaseSensitive))226 if (StelMainView::getInstance().getGLInformation().renderer.startsWith("ANGLE", Qt::CaseSensitive))
227 ui->switchToWindowedModeLabel->hide();227 ui->switchToWindowedModeLabel->hide();
228 #endif228 #endif
229 setAboutHtml();229 setAboutHtml();
230230
=== modified file 'plugins/CompassMarks/src/CMakeLists.txt'
--- plugins/CompassMarks/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/CompassMarks/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -8,12 +8,10 @@
88
9SET(CompassMarks_RES ../CompassMarks.qrc)9SET(CompassMarks_RES ../CompassMarks.qrc)
10QT5_ADD_RESOURCES(CompassMarks_RES_CXX ${CompassMarks_RES})10QT5_ADD_RESOURCES(CompassMarks_RES_CXX ${CompassMarks_RES})
11SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
1211
13ADD_LIBRARY(CompassMarks-static STATIC ${CompassMarks_SRCS} ${CompassMarks_RES_CXX})12ADD_LIBRARY(CompassMarks-static STATIC ${CompassMarks_SRCS} ${CompassMarks_RES_CXX})
14QT5_USE_MODULES(CompassMarks-static Core Network Widgets)13TARGET_LINK_LIBRARIES(CompassMarks-static Qt5::Core Qt5::Widgets)
15# The library target "CompassMarks-static" has a default OUTPUT_NAME of "CompassMarks-static", so change it.14# The library target "CompassMarks-static" has a default OUTPUT_NAME of "CompassMarks-static", so change it.
16SET_TARGET_PROPERTIES(CompassMarks-static PROPERTIES OUTPUT_NAME "CompassMarks")15SET_TARGET_PROPERTIES(CompassMarks-static PROPERTIES OUTPUT_NAME "CompassMarks")
17TARGET_LINK_LIBRARIES(CompassMarks-static ${extLinkerOption})
18SET_TARGET_PROPERTIES(CompassMarks-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")16SET_TARGET_PROPERTIES(CompassMarks-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
19ADD_DEPENDENCIES(AllStaticPlugins CompassMarks-static)17ADD_DEPENDENCIES(AllStaticPlugins CompassMarks-static)
2018
=== modified file 'plugins/CompassMarks/src/CompassMarks.cpp'
--- plugins/CompassMarks/src/CompassMarks.cpp 2015-10-28 13:39:43 +0000
+++ plugins/CompassMarks/src/CompassMarks.cpp 2017-01-12 21:08:38 +0000
@@ -35,7 +35,6 @@
35#include <QPixmap>35#include <QPixmap>
36#include <QSettings>36#include <QSettings>
37#include <QKeyEvent>37#include <QKeyEvent>
38#include <QtNetwork>
39#include <cmath>38#include <cmath>
4039
41StelModule* CompassMarksStelPluginInterface::getStelModule() const40StelModule* CompassMarksStelPluginInterface::getStelModule() const
@@ -129,14 +128,8 @@
129 painter.setFont(font);128 painter.setFont(font);
130129
131 painter.setColor(markColor[0], markColor[1], markColor[2], markFader.getInterstate());130 painter.setColor(markColor[0], markColor[1], markColor[2], markFader.getInterstate());
132 glDisable(GL_TEXTURE_2D);131 painter.setBlending(true);
133 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);132 painter.setLineSmooth(true);
134 glEnable(GL_BLEND);
135 // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH. But it looks much better.
136 #ifdef GL_LINE_SMOOTH
137 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
138 glEnable(GL_LINE_SMOOTH);
139 #endif
140133
141 for(int i=0; i<360; i++)134 for(int i=0; i<360; i++)
142 {135 {
@@ -161,20 +154,11 @@
161 // Limit arcs to those that are visible for improved performance154 // Limit arcs to those that are visible for improved performance
162 if (prj->project(pos, screenPos) && 155 if (prj->project(pos, screenPos) &&
163 screenPos[0]>prj->getViewportPosX() && screenPos[0] < prj->getViewportPosX() + prj->getViewportWidth()) {156 screenPos[0]>prj->getViewportPosX() && screenPos[0] < prj->getViewportPosX() + prj->getViewportWidth()) {
164 // This has been disabled above already...
165 //glDisable(GL_TEXTURE_2D);
166 painter.drawGreatCircleArc(pos, Vec3d(pos[0], pos[1], h), NULL);157 painter.drawGreatCircleArc(pos, Vec3d(pos[0], pos[1], h), NULL);
167 //glEnable(GL_TEXTURE_2D);
168 }158 }
169 }159 }
170 // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH160 painter.setBlending(false);
171 #ifdef GL_LINE_SMOOTH161 painter.setLineSmooth(false);
172 if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL)
173 glDisable(GL_LINE_SMOOTH);
174 #endif
175 glDisable(GL_BLEND);
176 glEnable(GL_TEXTURE_2D);
177
178}162}
179163
180void CompassMarks::update(double deltaTime)164void CompassMarks::update(double deltaTime)
181165
=== modified file 'plugins/EquationOfTime/src/CMakeLists.txt'
--- plugins/EquationOfTime/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/EquationOfTime/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -25,11 +25,8 @@
25SET(EQUATIONOFTIME_RES ../resources/EquationOfTime.qrc)25SET(EQUATIONOFTIME_RES ../resources/EquationOfTime.qrc)
26QT5_ADD_RESOURCES(EQUATIONOFTIME_RES_CXX ${EQUATIONOFTIME_RES})26QT5_ADD_RESOURCES(EQUATIONOFTIME_RES_CXX ${EQUATIONOFTIME_RES})
2727
28SET(extLinkerOption ${OPENGL_LIBRARIES})
29
30ADD_LIBRARY(EquationOfTime-static STATIC ${EQUATIONOFTIME_SRCS} ${EQUATIONOFTIME_RES_CXX} ${EQUATIONOFTIME_UIS_H})28ADD_LIBRARY(EquationOfTime-static STATIC ${EQUATIONOFTIME_SRCS} ${EQUATIONOFTIME_RES_CXX} ${EQUATIONOFTIME_UIS_H})
31QT5_USE_MODULES(EquationOfTime-static Core Network Gui Widgets)29TARGET_LINK_LIBRARIES(EquationOfTime-static Qt5::Core Qt5::Widgets)
32SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES OUTPUT_NAME "EquationOfTime")30SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES OUTPUT_NAME "EquationOfTime")
33TARGET_LINK_LIBRARIES(EquationOfTime-static ${extLinkerOption})
34SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")31SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
35ADD_DEPENDENCIES(AllStaticPlugins EquationOfTime-static)32ADD_DEPENDENCIES(AllStaticPlugins EquationOfTime-static)
3633
=== modified file 'plugins/Exoplanets/src/CMakeLists.txt'
--- plugins/Exoplanets/src/CMakeLists.txt 2016-01-30 17:47:43 +0000
+++ plugins/Exoplanets/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -24,11 +24,8 @@
24SET(Exoplanets_RES ../resources/Exoplanets.qrc)24SET(Exoplanets_RES ../resources/Exoplanets.qrc)
25QT5_ADD_RESOURCES(Exoplanets_RES_CXX ${Exoplanets_RES})25QT5_ADD_RESOURCES(Exoplanets_RES_CXX ${Exoplanets_RES})
2626
27SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
28
29ADD_LIBRARY(Exoplanets-static STATIC ${Exoplanets_SRCS} ${Exoplanets_RES_CXX} ${ExoplanetsDialog_UIS_H})27ADD_LIBRARY(Exoplanets-static STATIC ${Exoplanets_SRCS} ${Exoplanets_RES_CXX} ${ExoplanetsDialog_UIS_H})
30QT5_USE_MODULES(Exoplanets-static Core Network Widgets)28TARGET_LINK_LIBRARIES(Exoplanets-static Qt5::Core Qt5::Network Qt5::Widgets qcustomplot_stel)
31SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES OUTPUT_NAME "Exoplanets")29SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES OUTPUT_NAME "Exoplanets")
32TARGET_LINK_LIBRARIES(Exoplanets-static ${extLinkerOption})
33SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")30SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
34ADD_DEPENDENCIES(AllStaticPlugins Exoplanets-static)31ADD_DEPENDENCIES(AllStaticPlugins Exoplanets-static)
3532
=== modified file 'plugins/Exoplanets/src/Exoplanet.cpp'
--- plugins/Exoplanets/src/Exoplanet.cpp 2016-11-17 17:47:59 +0000
+++ plugins/Exoplanets/src/Exoplanet.cpp 2017-01-12 21:08:38 +0000
@@ -559,8 +559,7 @@
559 StelUtils::spheToRect(RA, DE, XYZ);559 StelUtils::spheToRect(RA, DE, XYZ);
560 double mag = getVMagnitudeWithExtinction(core);560 double mag = getVMagnitudeWithExtinction(core);
561561
562 glEnable(GL_BLEND);562 painter->setBlending(true, GL_ONE, GL_ONE);
563 glBlendFunc(GL_ONE, GL_ONE);
564 painter->setColor(color[0], color[1], color[2], 1);563 painter->setColor(color[0], color[1], color[2], 1);
565564
566 if (timelineMode)565 if (timelineMode)
567566
=== modified file 'plugins/Exoplanets/src/Exoplanets.cpp'
--- plugins/Exoplanets/src/Exoplanets.cpp 2016-11-18 19:24:45 +0000
+++ plugins/Exoplanets/src/Exoplanets.cpp 2017-01-12 21:08:38 +0000
@@ -252,9 +252,7 @@
252 const Vec3f& c(obj->getInfoColor());252 const Vec3f& c(obj->getInfoColor());
253 painter.setColor(c[0],c[1],c[2]);253 painter.setColor(c[0],c[1],c[2]);
254 texPointer->bind();254 texPointer->bind();
255 painter.enableTexture2d(true);255 painter.setBlending(true);
256 glEnable(GL_BLEND);
257 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
258 painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);256 painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);
259 }257 }
260}258}
261259
=== modified file 'plugins/Exoplanets/src/gui/ExoplanetsDialog.cpp'
--- plugins/Exoplanets/src/gui/ExoplanetsDialog.cpp 2017-01-05 15:28:52 +0000
+++ plugins/Exoplanets/src/gui/ExoplanetsDialog.cpp 2017-01-12 21:08:38 +0000
@@ -39,7 +39,7 @@
39#include "StelTranslator.hpp"39#include "StelTranslator.hpp"
40#include "StelLocaleMgr.hpp"40#include "StelLocaleMgr.hpp"
4141
42#include "qcustomplot/qcustomplot.h"42#include "external/qcustomplot/qcustomplot.h"
4343
44ExoplanetsDialog::ExoplanetsDialog()44ExoplanetsDialog::ExoplanetsDialog()
45 : StelDialog("Exoplanets")45 : StelDialog("Exoplanets")
4646
=== modified file 'plugins/Exoplanets/src/gui/exoplanetsDialog.ui'
--- plugins/Exoplanets/src/gui/exoplanetsDialog.ui 2016-11-29 13:26:25 +0000
+++ plugins/Exoplanets/src/gui/exoplanetsDialog.ui 2017-01-12 21:08:38 +0000
@@ -606,7 +606,7 @@
606 <customwidget>606 <customwidget>
607 <class>QCustomPlot</class>607 <class>QCustomPlot</class>
608 <extends>QWidget</extends>608 <extends>QWidget</extends>
609 <header>qcustomplot.h</header>609 <header>external/qcustomplot/qcustomplot.h</header>
610 </customwidget>610 </customwidget>
611 </customwidgets>611 </customwidgets>
612 <resources/>612 <resources/>
613613
=== modified file 'plugins/FOV/src/CMakeLists.txt'
--- plugins/FOV/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/FOV/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -22,11 +22,8 @@
2222
23QT5_WRAP_UI(FOV_UIS_H ${FOV_UIS})23QT5_WRAP_UI(FOV_UIS_H ${FOV_UIS})
2424
25SET(extLinkerOption ${OPENGL_LIBRARIES})
26
27ADD_LIBRARY(FOV-static STATIC ${FOV_SRCS} ${FOV_RES_CXX} ${FOV_UIS_H})25ADD_LIBRARY(FOV-static STATIC ${FOV_SRCS} ${FOV_RES_CXX} ${FOV_UIS_H})
28QT5_USE_MODULES(FOV-static Core Network Widgets)26TARGET_LINK_LIBRARIES(FOV-static Qt5::Core Qt5::Widgets)
29SET_TARGET_PROPERTIES(FOV-static PROPERTIES OUTPUT_NAME "FOV")27SET_TARGET_PROPERTIES(FOV-static PROPERTIES OUTPUT_NAME "FOV")
30TARGET_LINK_LIBRARIES(FOV-static ${extLinkerOption})
31SET_TARGET_PROPERTIES(FOV-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")28SET_TARGET_PROPERTIES(FOV-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
32ADD_DEPENDENCIES(AllStaticPlugins FOV-static)29ADD_DEPENDENCIES(AllStaticPlugins FOV-static)
3330
=== modified file 'plugins/HelloStelModule/src/CMakeLists.txt'
--- plugins/HelloStelModule/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/HelloStelModule/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -7,14 +7,10 @@
7 HelloStelModule.cpp7 HelloStelModule.cpp
8)8)
99
10
11SET(extLinkerOption ${OPENGL_LIBRARIES})
12
13ADD_LIBRARY(HelloStelModule-static STATIC ${HelloStelModule_SRCS})10ADD_LIBRARY(HelloStelModule-static STATIC ${HelloStelModule_SRCS})
14# The library target "HelloStelModule-static" has a default OUTPUT_NAME of "HelloStelModule-static", so change it.11# The library target "HelloStelModule-static" has a default OUTPUT_NAME of "HelloStelModule-static", so change it.
15QT5_USE_MODULES(HelloStelModule-static Core Gui)
16SET_TARGET_PROPERTIES(HelloStelModule-static PROPERTIES OUTPUT_NAME "HelloStelModule")12SET_TARGET_PROPERTIES(HelloStelModule-static PROPERTIES OUTPUT_NAME "HelloStelModule")
17TARGET_LINK_LIBRARIES(HelloStelModule-static ${extLinkerOption})13TARGET_LINK_LIBRARIES(HelloStelModule-static Qt5::Core Qt5::Gui)
18SET_TARGET_PROPERTIES(HelloStelModule-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")14SET_TARGET_PROPERTIES(HelloStelModule-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
19ADD_DEPENDENCIES(AllStaticPlugins HelloStelModule-static)15ADD_DEPENDENCIES(AllStaticPlugins HelloStelModule-static)
2016
2117
=== modified file 'plugins/MeteorShowers/src/CMakeLists.txt'
--- plugins/MeteorShowers/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/MeteorShowers/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -33,11 +33,8 @@
33SET(MeteorShowers_RES ../resources/MeteorShower.qrc)33SET(MeteorShowers_RES ../resources/MeteorShower.qrc)
34QT5_ADD_RESOURCES(MeteorShowers_RES_CXX ${MeteorShowers_RES})34QT5_ADD_RESOURCES(MeteorShowers_RES_CXX ${MeteorShowers_RES})
3535
36SET(extLinkerOption ${QT_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES} ${ICONV_LIBRARIES} ${INTL_LIBRARIES})
37
38ADD_LIBRARY(MeteorShowers-static STATIC ${MeteorShowers_SRCS} ${MeteorShowers_MOC_SRCS} ${MeteorShowers_RES_CXX} ${MeteorShowersDialog_UIS_H})36ADD_LIBRARY(MeteorShowers-static STATIC ${MeteorShowers_SRCS} ${MeteorShowers_MOC_SRCS} ${MeteorShowers_RES_CXX} ${MeteorShowersDialog_UIS_H})
39QT5_USE_MODULES(MeteorShowers-static Core Network Widgets)37TARGET_LINK_LIBRARIES(MeteorShowers-static Qt5::Core Qt5::Network Qt5::Widgets)
40SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES OUTPUT_NAME "MeteorShowers")38SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES OUTPUT_NAME "MeteorShowers")
41TARGET_LINK_LIBRARIES(MeteorShowers-static ${extLinkerOption})
42SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")39SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
43ADD_DEPENDENCIES(AllStaticPlugins MeteorShowers-static)40ADD_DEPENDENCIES(AllStaticPlugins MeteorShowers-static)
4441
=== modified file 'plugins/MeteorShowers/src/MeteorShower.cpp'
--- plugins/MeteorShowers/src/MeteorShower.cpp 2017-01-07 17:36:45 +0000
+++ plugins/MeteorShowers/src/MeteorShower.cpp 2017-01-12 21:08:38 +0000
@@ -333,9 +333,7 @@
333 StelUtils::spheToRect(m_radiantAlpha, m_radiantDelta, m_position);333 StelUtils::spheToRect(m_radiantAlpha, m_radiantDelta, m_position);
334 painter.getProjector()->project(m_position, XY);334 painter.getProjector()->project(m_position, XY);
335335
336 glEnable(GL_TEXTURE_2D);336 painter.setBlending(true, GL_SRC_ALPHA, GL_ONE);
337 glEnable(GL_BLEND);
338 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
339337
340 Vec3f rgb;338 Vec3f rgb;
341 float alpha = 0.85f + ((float) qrand() / (float) RAND_MAX) / 10.f;339 float alpha = 0.85f + ((float) qrand() / (float) RAND_MAX) / 10.f;
342340
=== modified file 'plugins/MeteorShowers/src/MeteorShowers.cpp'
--- plugins/MeteorShowers/src/MeteorShowers.cpp 2016-07-03 21:58:54 +0000
+++ plugins/MeteorShowers/src/MeteorShowers.cpp 2017-01-12 21:08:38 +0000
@@ -81,9 +81,8 @@
81 const Vec3f& c(obj->getInfoColor());81 const Vec3f& c(obj->getInfoColor());
82 painter.setColor(c[0],c[1],c[2]);82 painter.setColor(c[0],c[1],c[2]);
83 m_mgr->getPointerTexture()->bind();83 m_mgr->getPointerTexture()->bind();
84 painter.enableTexture2d(true);84
85 glEnable(GL_BLEND);85 painter.setBlending(true);
86 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
8786
88 float size = obj->getAngularSize(core) * M_PI / 180. * painter.getProjector()->getPixelPerRadAtCenter();87 float size = obj->getAngularSize(core) * M_PI / 180. * painter.getProjector()->getPixelPerRadAtCenter();
89 size += 20.f + 10.f * qSin(2.f * StelApp::getInstance().getTotalRunTime());88 size += 20.f + 10.f * qSin(2.f * StelApp::getInstance().getTotalRunTime());
9089
=== modified file 'plugins/MeteorShowers/src/MeteorShowersMgr.hpp'
--- plugins/MeteorShowers/src/MeteorShowersMgr.hpp 2016-07-10 03:16:07 +0000
+++ plugins/MeteorShowers/src/MeteorShowersMgr.hpp 2017-01-12 21:08:38 +0000
@@ -325,7 +325,7 @@
325 QString m_url;325 QString m_url;
326 QDateTime m_lastUpdate;326 QDateTime m_lastUpdate;
327 DownloadStatus m_statusOfLastUpdate;327 DownloadStatus m_statusOfLastUpdate;
328 QNetworkAccessManager* m_downloadMgr;328 QNetworkAccessManager* m_downloadMgr;
329 class StelProgressController* m_progressBar;329 class StelProgressController* m_progressBar;
330330
331 void createActions();331 void createActions();
332332
=== modified file 'plugins/NavStars/src/CMakeLists.txt'
--- plugins/NavStars/src/CMakeLists.txt 2016-05-21 14:14:31 +0000
+++ plugins/NavStars/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -23,11 +23,8 @@
23SET(NavStars_RES ../resources/NavStars.qrc)23SET(NavStars_RES ../resources/NavStars.qrc)
24QT5_ADD_RESOURCES(NavStars_RES_CXX ${NavStars_RES})24QT5_ADD_RESOURCES(NavStars_RES_CXX ${NavStars_RES})
2525
26SET(extLinkerOption ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
27
28ADD_LIBRARY(NavStars-static STATIC ${NavStars_SRCS} ${NavStars_RES_CXX} ${NavStars_UIS_H})26ADD_LIBRARY(NavStars-static STATIC ${NavStars_SRCS} ${NavStars_RES_CXX} ${NavStars_UIS_H})
29QT5_USE_MODULES(NavStars-static Core Network Widgets)27TARGET_LINK_LIBRARIES(NavStars-static Qt5::Core Qt5::Widgets)
30SET_TARGET_PROPERTIES(NavStars-static PROPERTIES OUTPUT_NAME "NavStars")28SET_TARGET_PROPERTIES(NavStars-static PROPERTIES OUTPUT_NAME "NavStars")
31TARGET_LINK_LIBRARIES(NavStars-static ${extLinkerOption})
32SET_TARGET_PROPERTIES(NavStars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")29SET_TARGET_PROPERTIES(NavStars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
33ADD_DEPENDENCIES(AllStaticPlugins NavStars-static)30ADD_DEPENDENCIES(AllStaticPlugins NavStars-static)
3431
=== modified file 'plugins/NavStars/src/NavStars.cpp'
--- plugins/NavStars/src/NavStars.cpp 2016-08-01 12:55:49 +0000
+++ plugins/NavStars/src/NavStars.cpp 2017-01-12 21:08:38 +0000
@@ -182,9 +182,7 @@
182 // ... and draw a marker around it182 // ... and draw a marker around it
183 if (!markerTexture.isNull())183 if (!markerTexture.isNull())
184 {184 {
185 glEnable(GL_BLEND);185 painter.setBlending(true);
186 painter.enableTexture2d(true);
187 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
188 painter.setColor(markerColor[0], markerColor[1], markerColor[2], markerFader.getInterstate());186 painter.setColor(markerColor[0], markerColor[1], markerColor[2], markerFader.getInterstate());
189 markerTexture->bind();187 markerTexture->bind();
190 painter.drawSprite2dMode(pos[0], pos[1], 11.f);188 painter.drawSprite2dMode(pos[0], pos[1], 11.f);
191189
=== modified file 'plugins/Novae/src/CMakeLists.txt'
--- plugins/Novae/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/Novae/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -25,11 +25,8 @@
25SET(Novae_RES ../resources/Novae.qrc)25SET(Novae_RES ../resources/Novae.qrc)
26QT5_ADD_RESOURCES(Novae_RES_CXX ${Novae_RES})26QT5_ADD_RESOURCES(Novae_RES_CXX ${Novae_RES})
2727
28SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
29
30ADD_LIBRARY(Novae-static STATIC ${Novae_SRCS} ${Novae_RES_CXX} ${NovaeDialog_UIS_H})28ADD_LIBRARY(Novae-static STATIC ${Novae_SRCS} ${Novae_RES_CXX} ${NovaeDialog_UIS_H})
31QT5_USE_MODULES(Novae-static Core Network OpenGL)29TARGET_LINK_LIBRARIES(Novae-static Qt5::Core Qt5::Network Qt5::Widgets)
32SET_TARGET_PROPERTIES(Novae-static PROPERTIES OUTPUT_NAME "Novae")30SET_TARGET_PROPERTIES(Novae-static PROPERTIES OUTPUT_NAME "Novae")
33TARGET_LINK_LIBRARIES(Novae-static ${extLinkerOption})
34SET_TARGET_PROPERTIES(Novae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")31SET_TARGET_PROPERTIES(Novae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
35ADD_DEPENDENCIES(AllStaticPlugins Novae-static)32ADD_DEPENDENCIES(AllStaticPlugins Novae-static)
3633
=== modified file 'plugins/Novae/src/Novae.cpp'
--- plugins/Novae/src/Novae.cpp 2016-09-28 13:19:24 +0000
+++ plugins/Novae/src/Novae.cpp 2017-01-12 21:08:38 +0000
@@ -224,9 +224,7 @@
224 const Vec3f& c(obj->getInfoColor());224 const Vec3f& c(obj->getInfoColor());
225 painter.setColor(c[0],c[1],c[2]);225 painter.setColor(c[0],c[1],c[2]);
226 texPointer->bind();226 texPointer->bind();
227 painter.enableTexture2d(true);227 painter.setBlending(true);
228 glEnable(GL_BLEND);
229 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
230 painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);228 painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);
231 }229 }
232}230}
233231
=== modified file 'plugins/Observability/src/CMakeLists.txt'
--- plugins/Observability/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/Observability/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -25,11 +25,8 @@
25SET(Observability_RES ../Observability.qrc)25SET(Observability_RES ../Observability.qrc)
26QT5_ADD_RESOURCES(Observability_RES_CXX ${Observability_RES})26QT5_ADD_RESOURCES(Observability_RES_CXX ${Observability_RES})
2727
28SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
29
30ADD_LIBRARY(Observability-static STATIC ${Observability_SRCS} ${Observability_RES_CXX} ${ObservabilityDialog_UIS_H})28ADD_LIBRARY(Observability-static STATIC ${Observability_SRCS} ${Observability_RES_CXX} ${ObservabilityDialog_UIS_H})
31QT5_USE_MODULES(Observability-static Core Network Widgets)29TARGET_LINK_LIBRARIES(Observability-static Qt5::Core Qt5::Widgets)
32SET_TARGET_PROPERTIES(Observability-static PROPERTIES OUTPUT_NAME "Observability")30SET_TARGET_PROPERTIES(Observability-static PROPERTIES OUTPUT_NAME "Observability")
33TARGET_LINK_LIBRARIES(Observability-static ${extLinkerOption})
34SET_TARGET_PROPERTIES(Observability-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")31SET_TARGET_PROPERTIES(Observability-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
35ADD_DEPENDENCIES(AllStaticPlugins Observability-static)32ADD_DEPENDENCIES(AllStaticPlugins Observability-static)
3633
=== modified file 'plugins/Oculars/src/CMakeLists.txt'
--- plugins/Oculars/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/Oculars/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -34,12 +34,8 @@
34)34)
35QT5_WRAP_UI(Oculars_UIS_H ${Oculars_UIS})35QT5_WRAP_UI(Oculars_UIS_H ${Oculars_UIS})
3636
37SET(extLinkerOption ${OPENGL_LIBRARIES})
38
39ADD_LIBRARY(Oculars-static STATIC ${Oculars_SRCS} ${Oculars_RES_CXX} ${Oculars_UIS_H})37ADD_LIBRARY(Oculars-static STATIC ${Oculars_SRCS} ${Oculars_RES_CXX} ${Oculars_UIS_H})
40SET_TARGET_PROPERTIES(Oculars-static PROPERTIES OUTPUT_NAME "Oculars")38SET_TARGET_PROPERTIES(Oculars-static PROPERTIES OUTPUT_NAME "Oculars")
41QT5_USE_MODULES(Oculars-static Core Network OpenGL Widgets)39TARGET_LINK_LIBRARIES(Oculars-static Qt5::Core Qt5::Widgets)
42
43TARGET_LINK_LIBRARIES(Oculars-static ${StelMain} ${extLinkerOption})
44SET_TARGET_PROPERTIES(Oculars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")40SET_TARGET_PROPERTIES(Oculars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
45ADD_DEPENDENCIES(AllStaticPlugins Oculars-static)41ADD_DEPENDENCIES(AllStaticPlugins Oculars-static)
4642
=== modified file 'plugins/Oculars/src/Oculars.cpp'
--- plugins/Oculars/src/Oculars.cpp 2017-01-10 17:21:30 +0000
+++ plugins/Oculars/src/Oculars.cpp 2017-01-12 21:08:38 +0000
@@ -50,7 +50,6 @@
50#include <QKeyEvent>50#include <QKeyEvent>
51#include <QMenu>51#include <QMenu>
52#include <QMouseEvent>52#include <QMouseEvent>
53#include <QtNetwork>
54#include <QPixmap>53#include <QPixmap>
55#include <QSignalMapper>54#include <QSignalMapper>
5655
@@ -335,14 +334,7 @@
335 paintCrosshairs();334 paintCrosshairs();
336 }335 }
337 }336 }
338 if (guiPanelEnabled)337 if (!guiPanelEnabled)
339 {
340 // Reset the state to allow the panel to be painted normally
341 glDisable(GL_TEXTURE_2D);
342 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
343 glEnable(GL_BLEND);
344 }
345 else
346 {338 {
347 // Paint the information in the upper-right hand corner339 // Paint the information in the upper-right hand corner
348 paintText(core);340 paintText(core);
@@ -352,14 +344,7 @@
352 else if (flagShowCCD)344 else if (flagShowCCD)
353 {345 {
354 paintCCDBounds();346 paintCCDBounds();
355 if (guiPanelEnabled)347 if (!guiPanelEnabled)
356 {
357 // Reset the state to allow the panel to be painted normally
358 glDisable(GL_TEXTURE_2D);
359 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
360 glEnable(GL_BLEND);
361 }
362 else
363 {348 {
364 // Paint the information in the upper-right hand corner349 // Paint the information in the upper-right hand corner
365 paintText(core);350 paintText(core);
@@ -1768,15 +1753,13 @@
1768 inner = oculars[selectedOcularIndex]->appearentFOV() * inner / maxEyepieceAngle;1753 inner = oculars[selectedOcularIndex]->appearentFOV() * inner / maxEyepieceAngle;
1769 }1754 }
17701755
1771 glEnable(GL_BLEND);1756 painter.setBlending(true);
1772 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
17731757
1774 Vec2i centerScreen(prj->getViewportPosX()+prj->getViewportWidth()/2, prj->getViewportPosY()+prj->getViewportHeight()/2);1758 Vec2i centerScreen(prj->getViewportPosX()+prj->getViewportWidth()/2, prj->getViewportPosY()+prj->getViewportHeight()/2);
17751759
1776 // Paint the reticale, if needed1760 // Paint the reticale, if needed
1777 if (!reticleTexture.isNull())1761 if (!reticleTexture.isNull())
1778 {1762 {
1779 painter.enableTexture2d(true);
1780 painter.setColor(0.77f, 0.14f, 0.16f, 1.f);1763 painter.setColor(0.77f, 0.14f, 0.16f, 1.f);
17811764
1782 reticleTexture->bind();1765 reticleTexture->bind();
@@ -1869,9 +1852,7 @@
18691852
1870 // set up the color and the GL state1853 // set up the color and the GL state
1871 painter.setColor(0.8f, 0.48f, 0.f, 1.f);1854 painter.setColor(0.8f, 0.48f, 0.f, 1.f);
1872 glDisable(GL_TEXTURE_2D);1855 painter.setBlending(true);
1873 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1874 glEnable(GL_BLEND);
18751856
1876 // Get the X & Y positions, and the line height1857 // Get the X & Y positions, and the line height
1877 painter.setFont(font);1858 painter.setFont(font);
18781859
=== modified file 'plugins/PointerCoordinates/src/CMakeLists.txt'
--- plugins/PointerCoordinates/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/PointerCoordinates/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -25,11 +25,8 @@
25SET(POINTERCOORDINATES_RES ../resources/PointerCoordinates.qrc)25SET(POINTERCOORDINATES_RES ../resources/PointerCoordinates.qrc)
26QT5_ADD_RESOURCES(POINTERCOORDINATES_RES_CXX ${POINTERCOORDINATES_RES})26QT5_ADD_RESOURCES(POINTERCOORDINATES_RES_CXX ${POINTERCOORDINATES_RES})
2727
28SET(extLinkerOption ${OPENGL_LIBRARIES})
29
30ADD_LIBRARY(PointerCoordinates-static STATIC ${POINTERCOORDINATES_SRCS} ${POINTERCOORDINATES_RES_CXX} ${POINTERCOORDINATES_UIS_H})28ADD_LIBRARY(PointerCoordinates-static STATIC ${POINTERCOORDINATES_SRCS} ${POINTERCOORDINATES_RES_CXX} ${POINTERCOORDINATES_UIS_H})
31QT5_USE_MODULES(PointerCoordinates-static Core Network Widgets)29TARGET_LINK_LIBRARIES(PointerCoordinates-static Qt5::Core Qt5::Widgets)
32SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES OUTPUT_NAME "PointerCoordinates")30SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES OUTPUT_NAME "PointerCoordinates")
33TARGET_LINK_LIBRARIES(PointerCoordinates-static ${extLinkerOption})
34SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")31SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
35ADD_DEPENDENCIES(AllStaticPlugins PointerCoordinates-static)32ADD_DEPENDENCIES(AllStaticPlugins PointerCoordinates-static)
3633
=== modified file 'plugins/Pulsars/src/CMakeLists.txt'
--- plugins/Pulsars/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/Pulsars/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -25,11 +25,8 @@
25SET(Pulsars_RES ../resources/Pulsars.qrc)25SET(Pulsars_RES ../resources/Pulsars.qrc)
26QT5_ADD_RESOURCES(Pulsars_RES_CXX ${Pulsars_RES})26QT5_ADD_RESOURCES(Pulsars_RES_CXX ${Pulsars_RES})
2727
28SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
29
30ADD_LIBRARY(Pulsars-static STATIC ${Pulsars_SRCS} ${Pulsars_RES_CXX} ${PulsarsDialog_UIS_H})28ADD_LIBRARY(Pulsars-static STATIC ${Pulsars_SRCS} ${Pulsars_RES_CXX} ${PulsarsDialog_UIS_H})
31QT5_USE_MODULES(Pulsars-static Core Network Widgets)29TARGET_LINK_LIBRARIES(Pulsars-static Qt5::Core Qt5::Network Qt5::Widgets)
32SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES OUTPUT_NAME "Pulsars")30SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES OUTPUT_NAME "Pulsars")
33TARGET_LINK_LIBRARIES(Pulsars-static ${extLinkerOption})
34SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")31SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
35ADD_DEPENDENCIES(AllStaticPlugins Pulsars-static)32ADD_DEPENDENCIES(AllStaticPlugins Pulsars-static)
3633
=== modified file 'plugins/Pulsars/src/Pulsar.cpp'
--- plugins/Pulsars/src/Pulsar.cpp 2016-07-30 18:20:22 +0000
+++ plugins/Pulsars/src/Pulsar.cpp 2017-01-12 21:08:38 +0000
@@ -384,8 +384,8 @@
384 if (!(painter->getProjector()->projectCheck(XYZ, win)))384 if (!(painter->getProjector()->projectCheck(XYZ, win)))
385 return;385 return;
386386
387 glEnable(GL_BLEND);387 painter->setBlending(true, GL_ONE, GL_ONE);
388 glBlendFunc(GL_ONE, GL_ONE);388
389 if (glitch>0 && glitchFlag)389 if (glitch>0 && glitchFlag)
390 painter->setColor(glitchColor[0], glitchColor[1], glitchColor[2], 1.f);390 painter->setColor(glitchColor[0], glitchColor[1], glitchColor[2], 1.f);
391 else391 else
392392
=== modified file 'plugins/Pulsars/src/Pulsars.cpp'
--- plugins/Pulsars/src/Pulsars.cpp 2016-07-03 21:58:54 +0000
+++ plugins/Pulsars/src/Pulsars.cpp 2017-01-12 21:08:38 +0000
@@ -259,9 +259,7 @@
259 const Vec3f& c(obj->getInfoColor());259 const Vec3f& c(obj->getInfoColor());
260 painter.setColor(c[0],c[1],c[2]);260 painter.setColor(c[0],c[1],c[2]);
261 texPointer->bind();261 texPointer->bind();
262 painter.enableTexture2d(true);262 painter.setBlending(true);
263 glEnable(GL_BLEND);
264 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
265 painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);263 painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);
266 }264 }
267}265}
268266
=== modified file 'plugins/Quasars/src/CMakeLists.txt'
--- plugins/Quasars/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/Quasars/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -25,11 +25,8 @@
25SET(Quasars_RES ../resources/Quasars.qrc)25SET(Quasars_RES ../resources/Quasars.qrc)
26QT5_ADD_RESOURCES(Quasars_RES_CXX ${Quasars_RES})26QT5_ADD_RESOURCES(Quasars_RES_CXX ${Quasars_RES})
2727
28SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
29
30ADD_LIBRARY(Quasars-static STATIC ${Quasars_SRCS} ${Quasars_RES_CXX} ${QuasarsDialog_UIS_H})28ADD_LIBRARY(Quasars-static STATIC ${Quasars_SRCS} ${Quasars_RES_CXX} ${QuasarsDialog_UIS_H})
31QT5_USE_MODULES(Quasars-static Core Network Widgets)29TARGET_LINK_LIBRARIES(Quasars-static Qt5::Core Qt5::Network Qt5::Widgets)
32SET_TARGET_PROPERTIES(Quasars-static PROPERTIES OUTPUT_NAME "Quasars")30SET_TARGET_PROPERTIES(Quasars-static PROPERTIES OUTPUT_NAME "Quasars")
33TARGET_LINK_LIBRARIES(Quasars-static ${extLinkerOption})
34SET_TARGET_PROPERTIES(Quasars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")31SET_TARGET_PROPERTIES(Quasars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
35ADD_DEPENDENCIES(AllStaticPlugins Quasars-static)32ADD_DEPENDENCIES(AllStaticPlugins Quasars-static)
3633
=== modified file 'plugins/Quasars/src/Quasar.cpp'
--- plugins/Quasars/src/Quasar.cpp 2016-07-30 18:20:22 +0000
+++ plugins/Quasars/src/Quasar.cpp 2017-01-12 21:08:38 +0000
@@ -180,8 +180,7 @@
180180
181 if (distributionMode)181 if (distributionMode)
182 {182 {
183 glEnable(GL_BLEND);183 painter.setBlending(true, GL_ONE, GL_ONE);
184 glBlendFunc(GL_ONE, GL_ONE);
185 painter.setColor(markerColor[0], markerColor[1], markerColor[2], 1);184 painter.setColor(markerColor[0], markerColor[1], markerColor[2], 1);
186185
187 Quasar::markerTexture->bind();186 Quasar::markerTexture->bind();
188187
=== modified file 'plugins/Quasars/src/Quasars.cpp'
--- plugins/Quasars/src/Quasars.cpp 2016-07-22 09:25:03 +0000
+++ plugins/Quasars/src/Quasars.cpp 2017-01-12 21:08:38 +0000
@@ -261,9 +261,7 @@
261 const Vec3f& c(obj->getInfoColor());261 const Vec3f& c(obj->getInfoColor());
262 painter.setColor(c[0],c[1],c[2]);262 painter.setColor(c[0],c[1],c[2]);
263 texPointer->bind();263 texPointer->bind();
264 painter.enableTexture2d(true);264 painter.setBlending(true);
265 glEnable(GL_BLEND);
266 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
267 painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);265 painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);
268 }266 }
269}267}
270268
=== modified file 'plugins/RemoteControl/src/CMakeLists.txt'
--- plugins/RemoteControl/src/CMakeLists.txt 2016-01-18 16:55:10 +0000
+++ plugins/RemoteControl/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -67,12 +67,9 @@
67SET(RemoteControl_RES ../RemoteControl.qrc)67SET(RemoteControl_RES ../RemoteControl.qrc)
68QT5_ADD_RESOURCES(RemoteControl_RES_CXX ${RemoteControl_RES})68QT5_ADD_RESOURCES(RemoteControl_RES_CXX ${RemoteControl_RES})
6969
70SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
71
72ADD_LIBRARY(RemoteControl-static STATIC ${RemoteControl_SRCS} ${RemoteControl_RES_CXX} ${RemoteControl_UIS_H} ${QtWebApp_SRCS})70ADD_LIBRARY(RemoteControl-static STATIC ${RemoteControl_SRCS} ${RemoteControl_RES_CXX} ${RemoteControl_UIS_H} ${QtWebApp_SRCS})
73QT5_USE_MODULES(RemoteControl-static Core Network Widgets)71TARGET_LINK_LIBRARIES(RemoteControl-static Qt5::Core Qt5::Network Qt5::Widgets)
74# The library target "RemoteControl-static" has a default OUTPUT_NAME of "RemoteControl-static", so change it.72# The library target "RemoteControl-static" has a default OUTPUT_NAME of "RemoteControl-static", so change it.
75SET_TARGET_PROPERTIES(RemoteControl-static PROPERTIES OUTPUT_NAME "RemoteControl")73SET_TARGET_PROPERTIES(RemoteControl-static PROPERTIES OUTPUT_NAME "RemoteControl")
76TARGET_LINK_LIBRARIES(RemoteControl-static ${extLinkerOption})
77SET_TARGET_PROPERTIES(RemoteControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")74SET_TARGET_PROPERTIES(RemoteControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
78ADD_DEPENDENCIES(AllStaticPlugins RemoteControl-static)75ADD_DEPENDENCIES(AllStaticPlugins RemoteControl-static)
7976
=== modified file 'plugins/RemoteControl/src/MainService.cpp'
--- plugins/RemoteControl/src/MainService.cpp 2017-01-11 14:13:45 +0000
+++ plugins/RemoteControl/src/MainService.cpp 2017-01-12 21:08:38 +0000
@@ -35,6 +35,8 @@
35#include "StelUtils.hpp"35#include "StelUtils.hpp"
3636
37#include <QJsonDocument>37#include <QJsonDocument>
38#include <QJsonObject>
39#include <QJsonArray>
3840
3941
40MainService::MainService(const QByteArray &serviceName, QObject *parent)42MainService::MainService(const QByteArray &serviceName, QObject *parent)
4143
=== modified file 'plugins/RemoteControl/src/ScriptService.cpp'
--- plugins/RemoteControl/src/ScriptService.cpp 2016-05-10 19:03:51 +0000
+++ plugins/RemoteControl/src/ScriptService.cpp 2017-01-12 21:08:38 +0000
@@ -24,6 +24,9 @@
24#include "StelTranslator.hpp"24#include "StelTranslator.hpp"
2525
26#include <QJsonDocument>26#include <QJsonDocument>
27#include <QJsonObject>
28#include <QJsonArray>
29#include <QVariant>
2730
28ScriptService::ScriptService(const QByteArray &serviceName, QObject *parent) : AbstractAPIService(serviceName,parent)31ScriptService::ScriptService(const QByteArray &serviceName, QObject *parent) : AbstractAPIService(serviceName,parent)
29{32{
3033
=== modified file 'plugins/RemoteSync/src/CMakeLists.txt'
--- plugins/RemoteSync/src/CMakeLists.txt 2016-02-05 14:05:45 +0000
+++ plugins/RemoteSync/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -32,12 +32,9 @@
32SET(RemoteSync_RES ../RemoteSync.qrc)32SET(RemoteSync_RES ../RemoteSync.qrc)
33QT5_ADD_RESOURCES(RemoteSync_RES_CXX ${RemoteSync_RES})33QT5_ADD_RESOURCES(RemoteSync_RES_CXX ${RemoteSync_RES})
3434
35SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
36
37ADD_LIBRARY(RemoteSync-static STATIC ${RemoteSync_SRCS} ${RemoteSync_UIS_H} ${RemoteSync_RES_CXX})35ADD_LIBRARY(RemoteSync-static STATIC ${RemoteSync_SRCS} ${RemoteSync_UIS_H} ${RemoteSync_RES_CXX})
38QT5_USE_MODULES(RemoteSync-static Core Network Widgets)36TARGET_LINK_LIBRARIES(RemoteSync-static Qt5::Core Qt5::Network Qt5::Widgets)
39# The library target "RemoteSync-static" has a default OUTPUT_NAME of "RemoteSync-static", so change it.37# The library target "RemoteSync-static" has a default OUTPUT_NAME of "RemoteSync-static", so change it.
40SET_TARGET_PROPERTIES(RemoteSync-static PROPERTIES OUTPUT_NAME "RemoteSync")38SET_TARGET_PROPERTIES(RemoteSync-static PROPERTIES OUTPUT_NAME "RemoteSync")
41TARGET_LINK_LIBRARIES(RemoteSync-static ${extLinkerOption})
42SET_TARGET_PROPERTIES(RemoteSync-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")39SET_TARGET_PROPERTIES(RemoteSync-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
43ADD_DEPENDENCIES(AllStaticPlugins RemoteSync-static)40ADD_DEPENDENCIES(AllStaticPlugins RemoteSync-static)
4441
=== modified file 'plugins/Satellites/src/CMakeLists.txt'
--- plugins/Satellites/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/Satellites/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -53,23 +53,13 @@
53SET(Satellites_RES ../resources/Satellites.qrc)53SET(Satellites_RES ../resources/Satellites.qrc)
54QT5_ADD_RESOURCES(Satellites_RES_CXX ${Satellites_RES})54QT5_ADD_RESOURCES(Satellites_RES_CXX ${Satellites_RES})
5555
56SET(extLinkerOption ${OPENGL_LIBRARIES})
57
58ADD_LIBRARY(Satellites-static STATIC ${Satellites_SRCS} ${Satellites_RES_CXX} ${SatellitesDialog_UIS_H})56ADD_LIBRARY(Satellites-static STATIC ${Satellites_SRCS} ${Satellites_RES_CXX} ${SatellitesDialog_UIS_H})
59QT5_USE_MODULES(Satellites-static Core Network OpenGL)57TARGET_LINK_LIBRARIES(Satellites-static Qt5::Core Qt5::Network Qt5::Widgets)
60# The library target "Satellites-static" has a default OUTPUT_NAME of "Satellites-static", so change it.58# The library target "Satellites-static" has a default OUTPUT_NAME of "Satellites-static", so change it.
61SET_TARGET_PROPERTIES(Satellites-static PROPERTIES OUTPUT_NAME "Satellites")59SET_TARGET_PROPERTIES(Satellites-static PROPERTIES OUTPUT_NAME "Satellites")
62TARGET_LINK_LIBRARIES(Satellites-static ${StelMain} ${extLinkerOption})
63IF(MSVC)60IF(MSVC)
64 SET_TARGET_PROPERTIES(Satellites-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")61 SET_TARGET_PROPERTIES(Satellites-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
65ELSE()62ELSE()
66 SET_TARGET_PROPERTIES(Satellites-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN -Wno-unused-parameter")63 SET_TARGET_PROPERTIES(Satellites-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN -Wno-unused-parameter")
67ENDIF()64ENDIF()
68ADD_DEPENDENCIES(AllStaticPlugins Satellites-static)65ADD_DEPENDENCIES(AllStaticPlugins Satellites-static)
69
70
71
72
73
74
75
7666
=== modified file 'plugins/Satellites/src/Satellite.cpp'
--- plugins/Satellites/src/Satellite.cpp 2017-01-05 17:00:35 +0000
+++ plugins/Satellites/src/Satellite.cpp 2017-01-12 21:08:38 +0000
@@ -834,8 +834,7 @@
834 if (Satellite::showLabels)834 if (Satellite::showLabels)
835 painter.drawText(xy[0], xy[1], name, 0, 10, 10, false);835 painter.drawText(xy[0], xy[1], name, 0, 10, 10, false);
836836
837 glEnable(GL_BLEND);837 painter.setBlending(true, GL_ONE, GL_ONE);
838 glBlendFunc(GL_ONE, GL_ONE);
839838
840 Satellite::hintTexture->bind();839 Satellite::hintTexture->bind();
841 painter.drawSprite2dMode(xy[0], xy[1], 11); 840 painter.drawSprite2dMode(xy[0], xy[1], 11);
@@ -851,8 +850,6 @@
851 Vec3f drawColor;850 Vec3f drawColor;
852 int size = orbitPoints.size();851 int size = orbitPoints.size();
853852
854 glDisable(GL_TEXTURE_2D);
855
856 QList<Vec3d>::iterator it= orbitPoints.begin();853 QList<Vec3d>::iterator it= orbitPoints.begin();
857 it++;854 it++;
858855
@@ -881,8 +878,6 @@
881 }878 }
882 }879 }
883 painter.drawPath(vertexArray, colorArray);880 painter.drawPath(vertexArray, colorArray);
884
885 glEnable(GL_TEXTURE_2D);
886 painter.enableClientStates(false);881 painter.enableClientStates(false);
887}882}
888883
889884
=== modified file 'plugins/Satellites/src/Satellites.cpp'
--- plugins/Satellites/src/Satellites.cpp 2017-01-05 17:00:35 +0000
+++ plugins/Satellites/src/Satellites.cpp 2017-01-12 21:08:38 +0000
@@ -1607,9 +1607,7 @@
1607 painter.setFont(labelFont);1607 painter.setFont(labelFont);
1608 Satellite::hintBrightness = hintFader.getInterstate();1608 Satellite::hintBrightness = hintFader.getInterstate();
16091609
1610 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);1610 painter.setBlending(true);
1611 glEnable(GL_BLEND);
1612 glEnable(GL_TEXTURE_2D);
1613 Satellite::hintTexture->bind();1611 Satellite::hintTexture->bind();
1614 Satellite::viewportHalfspace = painter.getProjector()->getBoundingCap();1612 Satellite::viewportHalfspace = painter.getProjector()->getBoundingCap();
1615 foreach (const SatelliteP& sat, satellites)1613 foreach (const SatelliteP& sat, satellites)
@@ -1639,9 +1637,7 @@
1639 painter.setColor(0.4f,0.5f,0.8f);1637 painter.setColor(0.4f,0.5f,0.8f);
1640 texPointer->bind();1638 texPointer->bind();
16411639
1642 glEnable(GL_TEXTURE_2D);1640 painter.setBlending(true);
1643 glEnable(GL_BLEND);
1644 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
16451641
1646 // Size on screen1642 // Size on screen
1647 float size = obj->getAngularSize(core)*M_PI/180.*prj->getPixelPerRadAtCenter();1643 float size = obj->getAngularSize(core)*M_PI/180.*prj->getPixelPerRadAtCenter();
16481644
=== modified file 'plugins/Scenery3d/src/CMakeLists.txt'
--- plugins/Scenery3d/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/Scenery3d/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -60,14 +60,9 @@
60)60)
61QT5_WRAP_UI(Scenery3d_UIS_H ${Scenery3d_UIS})61QT5_WRAP_UI(Scenery3d_UIS_H ${Scenery3d_UIS})
6262
63SET(extLinkerOption ${QT_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES} )
64
65############### For building the static library ######################63############### For building the static library ######################
66ADD_LIBRARY(Scenery3d-static STATIC ${Scenery3d_SRCS} ${Scenery3d_RES_CXX} ${Scenery3d_UIS_H} ${Scenery3d_MOC_SRCS} )64ADD_LIBRARY(Scenery3d-static STATIC ${Scenery3d_SRCS} ${Scenery3d_RES_CXX} ${Scenery3d_UIS_H} ${Scenery3d_MOC_SRCS} )
67QT5_USE_MODULES(Scenery3d-static Core Concurrent Gui Widgets)65TARGET_LINK_LIBRARIES(Scenery3d-static Qt5::Core Qt5::Concurrent Qt5::Gui ${STEL_GLES_LIBS} Qt5::Widgets)
68SET_TARGET_PROPERTIES(Scenery3d-static PROPERTIES OUTPUT_NAME "Scenery3d")66SET_TARGET_PROPERTIES(Scenery3d-static PROPERTIES OUTPUT_NAME "Scenery3d")
69TARGET_LINK_LIBRARIES(Scenery3d-static ${extLinkerOption})
70SET_TARGET_PROPERTIES(Scenery3d-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")67SET_TARGET_PROPERTIES(Scenery3d-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
71ADD_DEPENDENCIES(AllStaticPlugins Scenery3d-static)68ADD_DEPENDENCIES(AllStaticPlugins Scenery3d-static)
72
73
7469
=== modified file 'plugins/Scenery3d/src/OBJ.cpp'
--- plugins/Scenery3d/src/OBJ.cpp 2016-11-21 21:04:36 +0000
+++ plugins/Scenery3d/src/OBJ.cpp 2017-01-12 21:08:38 +0000
@@ -100,12 +100,16 @@
100bool OBJ::vertexArraysSupported=false;100bool OBJ::vertexArraysSupported=false;
101GLenum OBJ::indexBufferType=GL_UNSIGNED_SHORT;101GLenum OBJ::indexBufferType=GL_UNSIGNED_SHORT;
102size_t OBJ::indexBufferTypeSize=0;102size_t OBJ::indexBufferTypeSize=0;
103QOpenGLFunctions* OBJ::gl=Q_NULLPTR;
103104
104//static function105//static function
105void OBJ::setupGL()106void OBJ::setupGL()
106{107{
108 QOpenGLContext* ctx = QOpenGLContext::currentContext();
109 gl = ctx->functions();
110
107 //disable VAOs on Intel because of serious bugs in their implemenation...111 //disable VAOs on Intel because of serious bugs in their implemenation...
108 QString vendor(reinterpret_cast<const char*>(glGetString(GL_VENDOR)));112 QString vendor(reinterpret_cast<const char*>(gl->glGetString(GL_VENDOR)));
109 if(vendor.contains("Intel",Qt::CaseInsensitive))113 if(vendor.contains("Intel",Qt::CaseInsensitive))
110 {114 {
111 OBJ::vertexArraysSupported = false;115 OBJ::vertexArraysSupported = false;
@@ -130,7 +134,6 @@
130 }134 }
131135
132 //check if we can enable int index buffers136 //check if we can enable int index buffers
133 QOpenGLContext* ctx = QOpenGLContext::currentContext();
134 if(ctx->isOpenGLES())137 if(ctx->isOpenGLES())
135 {138 {
136 //query for extension139 //query for extension
@@ -1709,19 +1712,19 @@
1709 //(but may be stored in a VAO to enable faster binding/unbinding)1712 //(but may be stored in a VAO to enable faster binding/unbinding)
17101713
1711 //enable the attrib arrays1714 //enable the attrib arrays
1712 glEnableVertexAttribArray(ShaderMgr::ATTLOC_VERTEX);1715 gl->glEnableVertexAttribArray(ShaderMgr::ATTLOC_VERTEX);
1713 glEnableVertexAttribArray(ShaderMgr::ATTLOC_NORMAL);1716 gl->glEnableVertexAttribArray(ShaderMgr::ATTLOC_NORMAL);
1714 glEnableVertexAttribArray(ShaderMgr::ATTLOC_TEXCOORD);1717 gl->glEnableVertexAttribArray(ShaderMgr::ATTLOC_TEXCOORD);
1715 glEnableVertexAttribArray(ShaderMgr::ATTLOC_TANGENT);1718 gl->glEnableVertexAttribArray(ShaderMgr::ATTLOC_TANGENT);
1716 glEnableVertexAttribArray(ShaderMgr::ATTLOC_BITANGENT);1719 gl->glEnableVertexAttribArray(ShaderMgr::ATTLOC_BITANGENT);
17171720
1718 const GLsizei stride = sizeof(Vertex);1721 const GLsizei stride = sizeof(Vertex);
17191722
1720 glVertexAttribPointer(ShaderMgr::ATTLOC_VERTEX, 3,GL_FLOAT,GL_FALSE,stride,reinterpret_cast<const void *>(offsetof(struct Vertex, position)));1723 gl->glVertexAttribPointer(ShaderMgr::ATTLOC_VERTEX, 3,GL_FLOAT,GL_FALSE,stride,reinterpret_cast<const void *>(offsetof(struct Vertex, position)));
1721 glVertexAttribPointer(ShaderMgr::ATTLOC_NORMAL, 3,GL_FLOAT,GL_FALSE,stride,reinterpret_cast<const void *>(offsetof(struct Vertex, normal)));1724 gl->glVertexAttribPointer(ShaderMgr::ATTLOC_NORMAL, 3,GL_FLOAT,GL_FALSE,stride,reinterpret_cast<const void *>(offsetof(struct Vertex, normal)));
1722 glVertexAttribPointer(ShaderMgr::ATTLOC_TEXCOORD, 2,GL_FLOAT,GL_FALSE,stride,reinterpret_cast<const void *>(offsetof(struct Vertex, texCoord)));1725 gl->glVertexAttribPointer(ShaderMgr::ATTLOC_TEXCOORD, 2,GL_FLOAT,GL_FALSE,stride,reinterpret_cast<const void *>(offsetof(struct Vertex, texCoord)));
1723 glVertexAttribPointer(ShaderMgr::ATTLOC_TANGENT, 4,GL_FLOAT,GL_FALSE,stride,reinterpret_cast<const void *>(offsetof(struct Vertex, tangent)));1726 gl->glVertexAttribPointer(ShaderMgr::ATTLOC_TANGENT, 4,GL_FLOAT,GL_FALSE,stride,reinterpret_cast<const void *>(offsetof(struct Vertex, tangent)));
1724 glVertexAttribPointer(ShaderMgr::ATTLOC_BITANGENT,3,GL_FLOAT,GL_FALSE,stride,reinterpret_cast<const void *>(offsetof(struct Vertex, bitangent)));1727 gl->glVertexAttribPointer(ShaderMgr::ATTLOC_BITANGENT,3,GL_FLOAT,GL_FALSE,stride,reinterpret_cast<const void *>(offsetof(struct Vertex, bitangent)));
17251728
1726 //vertex buffer does not need to remain bound, because the binding is stored by glVertexAttribPointer1729 //vertex buffer does not need to remain bound, because the binding is stored by glVertexAttribPointer
1727 m_vertexBuffer.release();1730 m_vertexBuffer.release();
@@ -1736,11 +1739,11 @@
1736 m_indexBuffer.release();1739 m_indexBuffer.release();
17371740
1738 //disable our attribute arrays1741 //disable our attribute arrays
1739 glDisableVertexAttribArray(ShaderMgr::ATTLOC_VERTEX);1742 gl->glDisableVertexAttribArray(ShaderMgr::ATTLOC_VERTEX);
1740 glDisableVertexAttribArray(ShaderMgr::ATTLOC_NORMAL);1743 gl->glDisableVertexAttribArray(ShaderMgr::ATTLOC_NORMAL);
1741 glDisableVertexAttribArray(ShaderMgr::ATTLOC_TEXCOORD);1744 gl->glDisableVertexAttribArray(ShaderMgr::ATTLOC_TEXCOORD);
1742 glDisableVertexAttribArray(ShaderMgr::ATTLOC_TANGENT);1745 gl->glDisableVertexAttribArray(ShaderMgr::ATTLOC_TANGENT);
1743 glDisableVertexAttribArray(ShaderMgr::ATTLOC_BITANGENT);1746 gl->glDisableVertexAttribArray(ShaderMgr::ATTLOC_BITANGENT);
1744}1747}
17451748
1746void OBJ::transform(QMatrix4x4 mat)1749void OBJ::transform(QMatrix4x4 mat)
17471750
=== modified file 'plugins/Scenery3d/src/OBJ.hpp'
--- plugins/Scenery3d/src/OBJ.hpp 2015-04-15 13:42:29 +0000
+++ plugins/Scenery3d/src/OBJ.hpp 2017-01-12 21:08:38 +0000
@@ -336,6 +336,8 @@
336 QOpenGLBuffer m_indexBuffer;336 QOpenGLBuffer m_indexBuffer;
337 QOpenGLVertexArrayObject* m_vertexArrayObject;337 QOpenGLVertexArrayObject* m_vertexArrayObject;
338338
339 static QOpenGLFunctions* gl;
340
339 //! Heightmap341 //! Heightmap
340 friend class Heightmap;342 friend class Heightmap;
341};343};
342344
=== modified file 'plugins/Scenery3d/src/Scenery3d.cpp'
--- plugins/Scenery3d/src/Scenery3d.cpp 2016-11-24 18:15:41 +0000
+++ plugins/Scenery3d/src/Scenery3d.cpp 2017-01-12 21:08:38 +0000
@@ -20,13 +20,7 @@
2020
21#include <QtGlobal>21#include <QtGlobal>
2222
23#if !defined(Q_OS_WIN)
24//exclude StelOpenGL here on windows because of conflicts with GLFuncs.hpp otherwise (uses QOpenGLFunctions_1_0 directly)
25#include "StelOpenGL.hpp"
26#endif
27//needs to be included before StelOpenGL on Windows
28#include "GLFuncs.hpp"23#include "GLFuncs.hpp"
29
30#include "Scenery3d.hpp"24#include "Scenery3d.hpp"
3125
32#include "StelApp.hpp"26#include "StelApp.hpp"
@@ -49,15 +43,8 @@
49#include <stdexcept>43#include <stdexcept>
50#include <cmath>44#include <cmath>
51#include <QOpenGLShaderProgram>45#include <QOpenGLShaderProgram>
52#include <QOpenGLFramebufferObject>
5346
54#define GET_GLERROR() \47#define GET_GLERROR() StelOpenGL::checkGLErrors(__FILE__,__LINE__);
55{ \
56 GLenum err = glGetError(); \
57 if (err != GL_NO_ERROR) { \
58 qWarning("[line %d] GL Error: %d",__LINE__, err); \
59 } \
60}
6148
62//macro for easier uniform setting49//macro for easier uniform setting
63#define SET_UNIFORM(shd,uni,val) shd->setUniformValue(shaderManager.uniformLocation(shd,uni),val)50#define SET_UNIFORM(shd,uni,val) shd->setUniformValue(shaderManager.uniformLocation(shd,uni),val)
@@ -112,6 +99,7 @@
112 shaderParameters.geometryShader = false;99 shaderParameters.geometryShader = false;
113 shaderParameters.torchLight = false;100 shaderParameters.torchLight = false;
114 shaderParameters.frustumSplits = 0;101 shaderParameters.frustumSplits = 0;
102 shaderParameters.hwShadowSamplers = false;
115103
116 sceneBoundingBox = AABB(Vec3f(0.0f), Vec3f(0.0f));104 sceneBoundingBox = AABB(Vec3f(0.0f), Vec3f(0.0f));
117105
@@ -253,6 +241,10 @@
253241
254void Scenery3d::finalizeLoad()242void Scenery3d::finalizeLoad()
255{243{
244 //must ensure the correct GL context is active!
245 //this is not guaranteed with the new QOpenGLWidget outside of init() and draw()!
246 StelApp::getInstance().ensureGLContextCurrent();
247
256 currentScene = loadingScene;248 currentScene = loadingScene;
257249
258 //move load data to current one250 //move load data to current one
@@ -594,7 +586,7 @@
594 {586 {
595 //send size of light ortho for each frustum587 //send size of light ortho for each frustum
596 loc = shaderManager.uniformLocation(shader,ShaderMgr::UNIFORM_VEC_LIGHTORTHOSCALE);588 loc = shaderManager.uniformLocation(shader,ShaderMgr::UNIFORM_VEC_LIGHTORTHOSCALE);
597 shader->setUniformValueArray(loc,shadowFrustumSize.constData(),4);589 shader->setUniformValueArray(loc,shadowFrustumSize.constData(),shaderParameters.frustumSplits);
598 }590 }
599 }591 }
600592
@@ -802,7 +794,7 @@
802 }794 }
803 }795 }
804796
805797 GET_GLERROR()
806 glDrawElements(GL_TRIANGLES, pStelModel->triangleCount * 3, indexDataType, reinterpret_cast<const void*>(pStelModel->startIndex * indexDataTypeSize));798 glDrawElements(GL_TRIANGLES, pStelModel->triangleCount * 3, indexDataType, reinterpret_cast<const void*>(pStelModel->startIndex * indexDataTypeSize));
807 drawnTriangles+=pStelModel->triangleCount;799 drawnTriangles+=pStelModel->triangleCount;
808 }800 }
@@ -1130,7 +1122,7 @@
11301122
11311123
1132 //Unbind1124 //Unbind
1133 glBindFramebuffer(GL_FRAMEBUFFER, 0);1125 glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
11341126
1135 //reset viewport (see StelPainter::setProjector)1127 //reset viewport (see StelPainter::setProjector)
1136 const Vec4i& vp = altAzProjector->getViewport();1128 const Vec4i& vp = altAzProjector->getViewport();
@@ -1576,7 +1568,7 @@
1576 }1568 }
15771569
1578 //cubemap fbo must be released1570 //cubemap fbo must be released
1579 glBindFramebuffer(GL_FRAMEBUFFER,0);1571 glBindFramebuffer(GL_FRAMEBUFFER,defaultFBO);
15801572
1581 //reset GL state1573 //reset GL state
1582 glDepthMask(GL_FALSE);1574 glDepthMask(GL_FALSE);
@@ -2052,9 +2044,11 @@
20522044
2053void Scenery3d::init()2045void Scenery3d::init()
2054{2046{
2047 initializeOpenGLFunctions();
2055 OBJ::setupGL();2048 OBJ::setupGL();
20562049
2057 QOpenGLContext* ctx = QOpenGLContext::currentContext();2050 QOpenGLContext* ctx = QOpenGLContext::currentContext();
2051 Q_ASSERT(ctx);
20582052
2059#ifndef QT_OPENGL_ES_22053#ifndef QT_OPENGL_ES_2
2060 //initialize additional functions needed and not provided through StelOpenGL2054 //initialize additional functions needed and not provided through StelOpenGL
@@ -2369,7 +2363,7 @@
2369 }2363 }
23702364
2371 //unbind last framebuffer2365 //unbind last framebuffer
2372 glBindFramebuffer(GL_FRAMEBUFFER,0);2366 glBindFramebuffer(GL_FRAMEBUFFER,defaultFBO);
23732367
2374 //initialize cube rotations... found by trial and error :)2368 //initialize cube rotations... found by trial and error :)
2375 QMatrix4x4 stackBase;2369 QMatrix4x4 stackBase;
@@ -2633,7 +2627,23 @@
2633 //for OpenGL ES2, type has to be UNSIGNED_SHORT or UNSIGNED_INT for depth textures, desktop does probably not care2627 //for OpenGL ES2, type has to be UNSIGNED_SHORT or UNSIGNED_INT for depth textures, desktop does probably not care
2634 glTexImage2D(GL_TEXTURE_2D, 0, (pcssEnabled ? depthPcss : depthNormal), shadowmapSize, shadowmapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL);2628 glTexImage2D(GL_TEXTURE_2D, 0, (pcssEnabled ? depthPcss : depthNormal), shadowmapSize, shadowmapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL);
26352629
2636 GLint filter = (shaderParameters.shadowFilterQuality == S3DEnum::SFQ_HARDWARE2630 //we use hardware-accelerated depth compare mode, unless pcss is used
2631 shaderParameters.hwShadowSamplers = false;
2632 //NOTE: cant use depth compare mode on ES2
2633 if(!pcssEnabled)
2634 {
2635#ifndef QT_OPENGL_ES_2
2636 if(!isEs)
2637 {
2638 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
2639 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
2640 shaderParameters.hwShadowSamplers = true;
2641 }
2642#endif
2643 }
2644
2645 //IF we support hw shadow sampling, then we may enable linear filtering, otherwise filtering depth values directly would not make much sense
2646 GLint filter = shaderParameters.hwShadowSamplers && (shaderParameters.shadowFilterQuality == S3DEnum::SFQ_HARDWARE
2637 || shaderParameters.shadowFilterQuality == S3DEnum::SFQ_LOW_HARDWARE2647 || shaderParameters.shadowFilterQuality == S3DEnum::SFQ_LOW_HARDWARE
2638 || shaderParameters.shadowFilterQuality == S3DEnum::SFQ_HIGH_HARDWARE) ? GL_LINEAR : GL_NEAREST;2648 || shaderParameters.shadowFilterQuality == S3DEnum::SFQ_HIGH_HARDWARE) ? GL_LINEAR : GL_NEAREST;
2639 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);2649 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
@@ -2649,18 +2659,6 @@
2649 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, ones);2659 glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, ones);
2650 }2660 }
2651#endif2661#endif
2652 //we use hardware-accelerated depth compare mode, unless pcss is used
2653 //NOTE: cant use depth compare mode on ES2
2654 if(!pcssEnabled)
2655 {
2656#ifndef QT_OPENGL_ES_2
2657 if(!isEs)
2658 {
2659 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
2660 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
2661 }
2662#endif
2663 }
26642662
2665 //Attach the depthmap to the Buffer2663 //Attach the depthmap to the Buffer
2666 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowMapsArray[i], 0);2664 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowMapsArray[i], 0);
@@ -2689,7 +2687,7 @@
2689 }2687 }
26902688
2691 //Done. Unbind and switch to normal texture unit 02689 //Done. Unbind and switch to normal texture unit 0
2692 glBindFramebuffer(GL_FRAMEBUFFER, 0);2690 glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
2693 glActiveTexture(GL_TEXTURE0);2691 glActiveTexture(GL_TEXTURE0);
26942692
2695 qDebug()<<"[Scenery3D] shadowmapping initialized";2693 qDebug()<<"[Scenery3D] shadowmapping initialized";
@@ -2713,6 +2711,9 @@
2713 if(!objModel || !objModel->hasStelModels())2711 if(!objModel || !objModel->hasStelModels())
2714 return;2712 return;
27152713
2714 //find out the default FBO
2715 defaultFBO = StelApp::getInstance().getDefaultFBO();
2716
2716 //reset render statistic2717 //reset render statistic
2717 drawnTriangles = drawnModels = materialSwitches = shaderSwitches = 0;2718 drawnTriangles = drawnModels = materialSwitches = shaderSwitches = 0;
27182719
27192720
=== modified file 'plugins/Scenery3d/src/Scenery3d.hpp'
--- plugins/Scenery3d/src/Scenery3d.hpp 2016-11-24 18:15:41 +0000
+++ plugins/Scenery3d/src/Scenery3d.hpp 2017-01-12 21:08:38 +0000
@@ -38,12 +38,11 @@
38#include <QMatrix4x4>38#include <QMatrix4x4>
3939
40//predeclarations40//predeclarations
41class QOpenGLFramebufferObject;
42class Scenery3dMgr;41class Scenery3dMgr;
43class LandscapeMgr;42class LandscapeMgr;
4443
45//! Representation of a complete 3D scenery44//! Representation of a complete 3D scenery
46class Scenery3d45class Scenery3d : protected QOpenGLFunctions
47{46{
48public:47public:
49 //! Initializes an empty Scenery3d object.48 //! Initializes an empty Scenery3d object.
@@ -178,6 +177,7 @@
178 bool supportsShadowFiltering; //if shadow filtering is supported177 bool supportsShadowFiltering; //if shadow filtering is supported
179 bool isANGLE; //true if running on ANGLE178 bool isANGLE; //true if running on ANGLE
180 unsigned int maximumFramebufferSize;179 unsigned int maximumFramebufferSize;
180 GLuint defaultFBO; //the default background FBO handle
181181
182 float torchBrightness; // toggle light brightness182 float torchBrightness; // toggle light brightness
183 float torchRange; // used to calculate attenuation like in the second form at http://framebunker.com/blog/lighting-2-attenuation/183 float torchRange; // used to calculate attenuation like in the second form at http://framebunker.com/blog/lighting-2-attenuation/
184184
=== modified file 'plugins/Scenery3d/src/ShaderManager.cpp'
--- plugins/Scenery3d/src/ShaderManager.cpp 2015-05-18 12:01:39 +0000
+++ plugins/Scenery3d/src/ShaderManager.cpp 2017-01-12 21:08:38 +0000
@@ -102,6 +102,7 @@
102 featureFlagsStrings["PCSS"] = PCSS;102 featureFlagsStrings["PCSS"] = PCSS;
103 featureFlagsStrings["SINGLE_SHADOW_FRUSTUM"] = SINGLE_SHADOW_FRUSTUM;103 featureFlagsStrings["SINGLE_SHADOW_FRUSTUM"] = SINGLE_SHADOW_FRUSTUM;
104 featureFlagsStrings["OGL_ES2"] = OGL_ES2;104 featureFlagsStrings["OGL_ES2"] = OGL_ES2;
105 featureFlagsStrings["HW_SHADOW_SAMPLERS"] = HW_SHADOW_SAMPLERS;
105 }106 }
106}107}
107108
@@ -437,8 +438,10 @@
437 //this enumerates all available uniforms of this shader, and stores their locations in a map438 //this enumerates all available uniforms of this shader, and stores their locations in a map
438 GLuint prog = program.programId();439 GLuint prog = program.programId();
439 GLint numUniforms=0,bufSize;440 GLint numUniforms=0,bufSize;
440 glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &numUniforms);441
441 glGetProgramiv(prog, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufSize);442 QOpenGLFunctions* gl = QOpenGLContext::currentContext()->functions();
443 GL(gl->glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &numUniforms));
444 GL(gl->glGetProgramiv(prog, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufSize));
442445
443 QByteArray buf(bufSize,'\0');446 QByteArray buf(bufSize,'\0');
444 GLsizei length;447 GLsizei length;
@@ -450,7 +453,7 @@
450#endif453#endif
451 for(int i =0;i<numUniforms;++i)454 for(int i =0;i<numUniforms;++i)
452 {455 {
453 glGetActiveUniform(prog,i,bufSize,&length,&size,&type,buf.data());456 GL(gl->glGetActiveUniform(prog,i,bufSize,&length,&size,&type,buf.data()));
454 QString str(buf);457 QString str(buf);
455 str = str.trimmed(); // no idea if this is required458 str = str.trimmed(); // no idea if this is required
456459
457460
=== modified file 'plugins/Scenery3d/src/ShaderManager.hpp'
--- plugins/Scenery3d/src/ShaderManager.hpp 2015-05-18 12:01:39 +0000
+++ plugins/Scenery3d/src/ShaderManager.hpp 2017-01-12 21:08:38 +0000
@@ -42,6 +42,7 @@
42 bool torchLight;42 bool torchLight;
43 //for now, only 1 or 4 really supported43 //for now, only 1 or 4 really supported
44 int frustumSplits;44 int frustumSplits;
45 bool hwShadowSamplers;
45};46};
4647
47//! A simple shader cache class that gives us the correct shader depending on desired configuration.48//! A simple shader cache class that gives us the correct shader depending on desired configuration.
@@ -199,6 +200,8 @@
199 SINGLE_SHADOW_FRUSTUM = (1<<18),200 SINGLE_SHADOW_FRUSTUM = (1<<18),
200 //set if opengl es2201 //set if opengl es2
201 OGL_ES2 = (1<<19),202 OGL_ES2 = (1<<19),
203 //true if shadow samplers (shadow2d) should be used for shadow maps instead of normal samplers (texture2d)
204 HW_SHADOW_SAMPLERS = (1<<20)
202 };205 };
203206
204 typedef QMap<QString,FeatureFlags> t_FeatureFlagStrings;207 typedef QMap<QString,FeatureFlags> t_FeatureFlagStrings;
@@ -238,7 +241,8 @@
238 if(globals.pixelLighting && globals.shadows) flags|= SHADOWS;241 if(globals.pixelLighting && globals.shadows) flags|= SHADOWS;
239 if(globals.pixelLighting && globals.shadows && globals.shadowFilterQuality>S3DEnum::SFQ_HARDWARE) flags|= SHADOW_FILTER;242 if(globals.pixelLighting && globals.shadows && globals.shadowFilterQuality>S3DEnum::SFQ_HARDWARE) flags|= SHADOW_FILTER;
240 if(globals.pixelLighting && globals.shadows && globals.shadowFilterQuality>S3DEnum::SFQ_LOW_HARDWARE) flags|= SHADOW_FILTER_HQ;243 if(globals.pixelLighting && globals.shadows && globals.shadowFilterQuality>S3DEnum::SFQ_LOW_HARDWARE) flags|= SHADOW_FILTER_HQ;
241 if(globals.pixelLighting && globals.shadows && (globals.shadowFilterQuality == S3DEnum::SFQ_LOW || globals.shadowFilterQuality == S3DEnum::SFQ_HIGH) && globals.pcss) flags|= PCSS;244 if(globals.pixelLighting && globals.shadows && !globals.hwShadowSamplers && (globals.shadowFilterQuality == S3DEnum::SFQ_LOW || globals.shadowFilterQuality == S3DEnum::SFQ_HIGH) && globals.pcss) flags|= PCSS;
245 if(globals.hwShadowSamplers) flags|=HW_SHADOW_SAMPLERS;
242 if(globals.geometryShader) flags|= GEOMETRY_SHADER;246 if(globals.geometryShader) flags|= GEOMETRY_SHADER;
243 if(globals.torchLight) flags|= TORCH;247 if(globals.torchLight) flags|= TORCH;
244 if(globals.frustumSplits == 1) flags|= SINGLE_SHADOW_FRUSTUM;248 if(globals.frustumSplits == 1) flags|= SINGLE_SHADOW_FRUSTUM;
245249
=== modified file 'plugins/SimpleDrawLine/src/CMakeLists.txt'
--- plugins/SimpleDrawLine/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/SimpleDrawLine/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -7,12 +7,11 @@
7 SimpleDrawLine.cpp7 SimpleDrawLine.cpp
8)8)
99
10SET(extLinkerOption ${OPENGL_LIBRARIES})10SET(SimpleDrawLine_Qt_Libraries Qt5::Core Qt5::Gui)
1111
12############### For building the dynamic library ######################12############### For building the dynamic library ######################
13IF(BUILD_DYNAMIC_PLUGIN)13IF(BUILD_DYNAMIC_PLUGIN)
14 ADD_LIBRARY(SimpleDrawLine MODULE ${SimpleDrawLine_SRCS})14 ADD_LIBRARY(SimpleDrawLine MODULE ${SimpleDrawLine_SRCS})
15 QT5_USE_MODULES(SimpleDrawLine-static Core OpenGL)
16 IF(APPLE)15 IF(APPLE)
17 FIND_LIBRARY(OPENGL_LIBRARY OpenGL)16 FIND_LIBRARY(OPENGL_LIBRARY OpenGL)
18 MARK_AS_ADVANCED(OPENGL_LIBRARY)17 MARK_AS_ADVANCED(OPENGL_LIBRARY)
@@ -26,15 +25,14 @@
26 SET(StelMain )25 SET(StelMain )
27 ENDIF(WIN32)26 ENDIF(WIN32)
2827
29 TARGET_LINK_LIBRARIES(SimpleDrawLine ${StelMain} ${extLinkerOption})28 TARGET_LINK_LIBRARIES(SimpleDrawLine ${StelMain} ${SimpleDrawLine_Qt_Libraries})
30 INSTALL(TARGETS SimpleDrawLine DESTINATION "modules/SimpleDrawLine")29 INSTALL(TARGETS SimpleDrawLine DESTINATION "modules/SimpleDrawLine")
31ELSE()30ELSE()
32############### For building the static library ######################31############### For building the static library ######################
33 ADD_LIBRARY(SimpleDrawLine-static STATIC ${SimpleDrawLine_SRCS})32 ADD_LIBRARY(SimpleDrawLine-static STATIC ${SimpleDrawLine_SRCS})
34 # The library target "SimpleDrawLine-static" has a default OUTPUT_NAME of "SimpleDrawLine-static", so change it.33 # The library target "SimpleDrawLine-static" has a default OUTPUT_NAME of "SimpleDrawLine-static", so change it.
35 QT5_USE_MODULES(SimpleDrawLine-static Core OpenGL)
36 SET_TARGET_PROPERTIES(SimpleDrawLine-static PROPERTIES OUTPUT_NAME "SimpleDrawLine")34 SET_TARGET_PROPERTIES(SimpleDrawLine-static PROPERTIES OUTPUT_NAME "SimpleDrawLine")
37 TARGET_LINK_LIBRARIES(SimpleDrawLine-static ${extLinkerOption})35 TARGET_LINK_LIBRARIES(SimpleDrawLine-static ${StelMain} ${SimpleDrawLine_Qt_Libraries})
38 SET_TARGET_PROPERTIES(SimpleDrawLine-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")36 SET_TARGET_PROPERTIES(SimpleDrawLine-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
39 ADD_DEPENDENCIES(AllStaticPlugins SimpleDrawLine-static)37 ADD_DEPENDENCIES(AllStaticPlugins SimpleDrawLine-static)
40ENDIF()38ENDIF()
4139
=== modified file 'plugins/SolarSystemEditor/src/CMakeLists.txt'
--- plugins/SolarSystemEditor/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/SolarSystemEditor/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -28,12 +28,8 @@
2828
29QT5_WRAP_UI(SolarSystemEditor_UIS_H ${SolarSystemEditor_UIS})29QT5_WRAP_UI(SolarSystemEditor_UIS_H ${SolarSystemEditor_UIS})
3030
31
32SET(extLinkerOption ${OPENGL_LIBRARIES})
33
34ADD_LIBRARY(SolarSystemEditor-static STATIC ${SolarSystemEditor_SRCS} ${SolarSystemEditor_RES_CXX} ${SolarSystemEditor_UIS_H})31ADD_LIBRARY(SolarSystemEditor-static STATIC ${SolarSystemEditor_SRCS} ${SolarSystemEditor_RES_CXX} ${SolarSystemEditor_UIS_H})
35QT5_USE_MODULES(SolarSystemEditor-static Core Network Widgets)32TARGET_LINK_LIBRARIES(SolarSystemEditor-static Qt5::Core Qt5::Network Qt5::Widgets)
36SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES OUTPUT_NAME "SolarSystemEditor")33SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES OUTPUT_NAME "SolarSystemEditor")
37TARGET_LINK_LIBRARIES(SolarSystemEditor-static ${extLinkerOption})
38SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")34SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
39ADD_DEPENDENCIES(AllStaticPlugins SolarSystemEditor-static)35ADD_DEPENDENCIES(AllStaticPlugins SolarSystemEditor-static)
4036
=== modified file 'plugins/Supernovae/src/CMakeLists.txt'
--- plugins/Supernovae/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/Supernovae/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -25,11 +25,8 @@
25SET(Supernovae_RES ../resources/Supernovae.qrc)25SET(Supernovae_RES ../resources/Supernovae.qrc)
26QT5_ADD_RESOURCES(Supernovae_RES_CXX ${Supernovae_RES})26QT5_ADD_RESOURCES(Supernovae_RES_CXX ${Supernovae_RES})
2727
28SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES})
29
30ADD_LIBRARY(Supernovae-static STATIC ${Supernovae_SRCS} ${Supernovae_RES_CXX} ${SupernovaeDialog_UIS_H})28ADD_LIBRARY(Supernovae-static STATIC ${Supernovae_SRCS} ${Supernovae_RES_CXX} ${SupernovaeDialog_UIS_H})
31QT5_USE_MODULES(Supernovae-static Core Network Widgets)29TARGET_LINK_LIBRARIES(Supernovae-static Qt5::Core Qt5::Network Qt5::Widgets)
32SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES OUTPUT_NAME "Supernovae")30SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES OUTPUT_NAME "Supernovae")
33TARGET_LINK_LIBRARIES(Supernovae-static ${extLinkerOption})
34SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")31SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
35ADD_DEPENDENCIES(AllStaticPlugins Supernovae-static)32ADD_DEPENDENCIES(AllStaticPlugins Supernovae-static)
3633
=== modified file 'plugins/Supernovae/src/Supernovae.cpp'
--- plugins/Supernovae/src/Supernovae.cpp 2016-08-07 10:10:32 +0000
+++ plugins/Supernovae/src/Supernovae.cpp 2017-01-12 21:08:38 +0000
@@ -227,9 +227,7 @@
227 const Vec3f& c(obj->getInfoColor());227 const Vec3f& c(obj->getInfoColor());
228 painter.setColor(c[0],c[1],c[2]);228 painter.setColor(c[0],c[1],c[2]);
229 texPointer->bind();229 texPointer->bind();
230 painter.enableTexture2d(true);230 painter.setBlending(true);
231 glEnable(GL_BLEND);
232 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
233 painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);231 painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);
234 }232 }
235}233}
236234
=== modified file 'plugins/TelescopeControl/src/CMakeLists.txt'
--- plugins/TelescopeControl/src/CMakeLists.txt 2015-11-12 12:38:13 +0000
+++ plugins/TelescopeControl/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -66,11 +66,15 @@
66SET(TelescopeControl_RES ../resources/TelescopeControl.qrc)66SET(TelescopeControl_RES ../resources/TelescopeControl.qrc)
67QT5_ADD_RESOURCES(TelescopeControl_RES_CXX ${TelescopeControl_RES})67QT5_ADD_RESOURCES(TelescopeControl_RES_CXX ${TelescopeControl_RES})
6868
69SET(extLinkerOption ${OPENGL_LIBRARIES})69#IF(WIN32 AND NOT MSVC)
70# TODO: Test if winsock is still necessary if the Telescope Control plug-in is disabled.
71# Because including it here seems to duplicate STELLARIUM_STATIC_PLUGINS_LIBRARIES
72# SET(extLinkerOption ${extLinkerOption} libwinmm.a -lws2_32)
73#ENDIF()
74#
7075
71ADD_LIBRARY(TelescopeControl-static STATIC ${TelescopeControl_SRCS} ${TelescopeControl_RES_CXX} ${TelescopeControl_UIS_H})76ADD_LIBRARY(TelescopeControl-static STATIC ${TelescopeControl_SRCS} ${TelescopeControl_RES_CXX} ${TelescopeControl_UIS_H})
72SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES OUTPUT_NAME "TelescopeControl")77SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES OUTPUT_NAME "TelescopeControl")
73TARGET_LINK_LIBRARIES(TelescopeControl-static ${extLinkerOption})78TARGET_LINK_LIBRARIES(TelescopeControl-static Qt5::Core Qt5::Network Qt5::Widgets Qt5::SerialPort)
74QT5_USE_MODULES(TelescopeControl-static Core Network Widgets SerialPort OpenGL)
75SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")79SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
76ADD_DEPENDENCIES(AllStaticPlugins TelescopeControl-static)80ADD_DEPENDENCIES(AllStaticPlugins TelescopeControl-static)
7781
=== modified file 'plugins/TelescopeControl/src/TelescopeControl.cpp'
--- plugins/TelescopeControl/src/TelescopeControl.cpp 2016-07-03 21:58:54 +0000
+++ plugins/TelescopeControl/src/TelescopeControl.cpp 2017-01-12 21:08:38 +0000
@@ -278,21 +278,16 @@
278 if (circleFader.getInterstate() >= 0)278 if (circleFader.getInterstate() >= 0)
279 {279 {
280 sPainter.setColor(circleColor[0], circleColor[1], circleColor[2], circleFader.getInterstate());280 sPainter.setColor(circleColor[0], circleColor[1], circleColor[2], circleFader.getInterstate());
281 glDisable(GL_TEXTURE_2D);
282 foreach (double circle, telescope->getOculars())281 foreach (double circle, telescope->getOculars())
283 {282 {
284 sPainter.drawCircle(XY[0], XY[1], 0.5 * prj->getPixelPerRadAtCenter() * (M_PI/180) * (circle));283 sPainter.drawCircle(XY[0], XY[1], 0.5 * prj->getPixelPerRadAtCenter() * (M_PI/180) * (circle));
285 }284 }
286 glEnable(GL_TEXTURE_2D);
287 }285 }
288 if (reticleFader.getInterstate() >= 0)286 if (reticleFader.getInterstate() >= 0)
289 {287 {
290 glEnable(GL_TEXTURE_2D);288 sPainter.setBlending(true, GL_SRC_ALPHA, GL_ONE);
291 glEnable(GL_BLEND);
292 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
293 sPainter.setColor(reticleColor[0], reticleColor[1], reticleColor[2], reticleFader.getInterstate());289 sPainter.setColor(reticleColor[0], reticleColor[1], reticleColor[2], reticleFader.getInterstate());
294 sPainter.drawSprite2dMode(XY[0],XY[1],15.f);290 sPainter.drawSprite2dMode(XY[0],XY[1],15.f);
295 glDisable(GL_TEXTURE_2D);
296 }291 }
297 if (labelFader.getInterstate() >= 0)292 if (labelFader.getInterstate() >= 0)
298 {293 {
@@ -423,9 +418,7 @@
423 const Vec3f& c(obj->getInfoColor());418 const Vec3f& c(obj->getInfoColor());
424 sPainter.setColor(c[0], c[1], c[2]);419 sPainter.setColor(c[0], c[1], c[2]);
425 selectionTexture->bind();420 selectionTexture->bind();
426 glEnable(GL_TEXTURE_2D);421 sPainter.setBlending(true);
427 glEnable(GL_BLEND);
428 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
429 sPainter.drawSprite2dMode(screenpos[0], screenpos[1], 25., StelApp::getInstance().getTotalRunTime() * 40.);422 sPainter.drawSprite2dMode(screenpos[0], screenpos[1], 25., StelApp::getInstance().getTotalRunTime() * 40.);
430 }423 }
431#endif //COMPATIBILITY_001002424#endif //COMPATIBILITY_001002
432425
=== modified file 'plugins/TextUserInterface/src/CMakeLists.txt'
--- plugins/TextUserInterface/src/CMakeLists.txt 2015-10-20 17:16:34 +0000
+++ plugins/TextUserInterface/src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -29,12 +29,9 @@
29 TextUserInterface.cpp29 TextUserInterface.cpp
30)30)
3131
32SET(extLinkerOption ${OPENGL_LIBRARIES})
33
34ADD_LIBRARY(TextUserInterface-static STATIC ${TextUserInterface_SRCS})32ADD_LIBRARY(TextUserInterface-static STATIC ${TextUserInterface_SRCS})
35QT5_USE_MODULES(TextUserInterface-static Core Widgets)33TARGET_LINK_LIBRARIES(TextUserInterface-static Qt5::Core Qt5::Widgets)
36# The library target "TextUserInterface-static" has a default OUTPUT_NAME of "TextUserInterface-static", so change it.34# The library target "TextUserInterface-static" has a default OUTPUT_NAME of "TextUserInterface-static", so change it.
37SET_TARGET_PROPERTIES(TextUserInterface-static PROPERTIES OUTPUT_NAME "TextUserInterface")35SET_TARGET_PROPERTIES(TextUserInterface-static PROPERTIES OUTPUT_NAME "TextUserInterface")
38TARGET_LINK_LIBRARIES(TextUserInterface-static ${extLinkerOption})
39SET_TARGET_PROPERTIES(TextUserInterface-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")36SET_TARGET_PROPERTIES(TextUserInterface-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
40ADD_DEPENDENCIES(AllStaticPlugins TextUserInterface-static)37ADD_DEPENDENCIES(AllStaticPlugins TextUserInterface-static)
4138
=== modified file 'plugins/TextUserInterface/src/TextUserInterface.cpp'
--- plugins/TextUserInterface/src/TextUserInterface.cpp 2017-01-10 15:51:22 +0000
+++ plugins/TextUserInterface/src/TextUserInterface.cpp 2017-01-12 21:08:38 +0000
@@ -61,9 +61,7 @@
61#include <QTime>61#include <QTime>
62#include <QProcess>62#include <QProcess>
63#include <QDir>63#include <QDir>
64#ifdef DISABLE_SCRIPTING64#include <QSettings>
65#include "QSettings" // WTF?
66#endif
6765
6866
69/*************************************************************************67/*************************************************************************
7068
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2016-12-18 22:26:48 +0000
+++ src/CMakeLists.txt 2017-01-12 21:08:38 +0000
@@ -1,65 +1,9 @@
1SET(glues_lib_SRCS1#add our external dependencies first
2 core/external/glues_stel/source/glues_error.c2add_subdirectory(external)
3 core/external/glues_stel/source/glues_error.h
4 core/external/glues_stel/source/glues.h
5 core/external/glues_stel/source/libtess/dict.h
6 core/external/glues_stel/source/libtess/dict.c
7 core/external/glues_stel/source/libtess/dict-list.h
8 core/external/glues_stel/source/libtess/geom.c
9 core/external/glues_stel/source/libtess/geom.h
10 core/external/glues_stel/source/libtess/memalloc.c
11 core/external/glues_stel/source/libtess/memalloc.h
12 core/external/glues_stel/source/libtess/mesh.c
13 core/external/glues_stel/source/libtess/mesh.h
14 core/external/glues_stel/source/libtess/normal.c
15 core/external/glues_stel/source/libtess/normal.h
16 core/external/glues_stel/source/libtess/priorityq.c
17 core/external/glues_stel/source/libtess/priorityq.h
18 core/external/glues_stel/source/libtess/priorityq-heap.h
19 core/external/glues_stel/source/libtess/priorityq-heap.i
20 core/external/glues_stel/source/libtess/priorityq-sort.h
21 core/external/glues_stel/source/libtess/render.c
22 core/external/glues_stel/source/libtess/render.h
23 core/external/glues_stel/source/libtess/sweep.c
24 core/external/glues_stel/source/libtess/sweep.h
25 core/external/glues_stel/source/libtess/tess.c
26 core/external/glues_stel/source/libtess/tess.h
27 core/external/glues_stel/source/libtess/tessmono.c
28 core/external/glues_stel/source/libtess/tessmono.h
29)
30
31SET(zlib_SRCS
32 core/external/zlib/adler32.c
33 core/external/zlib/compress.c
34 core/external/zlib/crc32.c
35 core/external/zlib/crc32.h
36 core/external/zlib/deflate.c
37 core/external/zlib/deflate.h
38 core/external/zlib/gzclose.c
39 core/external/zlib/gzguts.h
40 core/external/zlib/gzlib.c
41 core/external/zlib/gzread.c
42 core/external/zlib/gzwrite.c
43 core/external/zlib/infback.c
44 core/external/zlib/inffast.c
45 core/external/zlib/inffast.h
46 core/external/zlib/inffixed.h
47 core/external/zlib/inflate.c
48 core/external/zlib/inflate.h
49 core/external/zlib/inftrees.c
50 core/external/zlib/inftrees.h
51 core/external/zlib/trees.c
52 core/external/zlib/trees.h
53 core/external/zlib/uncompr.c
54 core/external/zlib/zconf.h
55 core/external/zlib/zlib.h
56 core/external/zlib/zutil.c
57 core/external/zlib/zutil.h
58)
593
60IF(ENABLE_SPOUT)4IF(ENABLE_SPOUT)
61 SET(spout_SRCS5 SET(spout_SRCS
62 core/external/SpoutLibrary.h6 external/SpoutLibrary.h
63 core/SpoutSender.hpp7 core/SpoutSender.hpp
64 core/SpoutSender.cpp8 core/SpoutSender.cpp
65 )9 )
@@ -171,10 +115,6 @@
171 core/StelPropertyMgr.hpp115 core/StelPropertyMgr.hpp
172 core/StelPropertyMgr.cpp116 core/StelPropertyMgr.cpp
173117
174 ${gl_lib_SRCS}
175
176 ${glues_lib_SRCS}
177
178 ${spout_SRCS}118 ${spout_SRCS}
179119
180 core/planetsephems/calc_interpolated_elements.c120 core/planetsephems/calc_interpolated_elements.c
@@ -295,14 +235,6 @@
295 )235 )
296ENDIF()236ENDIF()
297237
298SET(stellarium_lib_SRCS ${stellarium_lib_SRCS}
299 core/external/qtcompress/qzip.cpp
300 core/external/qtcompress/qzipreader.h
301 core/external/qtcompress/qzipwriter.h
302 core/external/qcustomplot/qcustomplot.cpp
303 core/external/qcustomplot/qcustomplot.h
304)
305
306IF(ENABLE_SCRIPTING)238IF(ENABLE_SCRIPTING)
307 SET(stellarium_lib_SRCS ${stellarium_lib_SRCS}239 SET(stellarium_lib_SRCS ${stellarium_lib_SRCS}
308 scripting/StelScriptOutput.hpp240 scripting/StelScriptOutput.hpp
@@ -318,12 +250,6 @@
318 )250 )
319ENDIF()251ENDIF()
320252
321IF(WIN32)
322 SET(stellarium_lib_SRCS ${stellarium_lib_SRCS}
323 ${zlib_SRCS}
324 )
325ENDIF()
326
327SET(stellarium_exe_SRCS main.cpp)253SET(stellarium_exe_SRCS main.cpp)
328254
329################# compiles resources files ############255################# compiles resources files ############
@@ -424,7 +350,6 @@
424 SET(stellarium_gui_RES ${CMAKE_SOURCE_DIR}/data/gui/guiRes.qrc)350 SET(stellarium_gui_RES ${CMAKE_SOURCE_DIR}/data/gui/guiRes.qrc)
425 QT5_ADD_RESOURCES(stellarium_gui_RES_CXX ${stellarium_gui_RES})351 QT5_ADD_RESOURCES(stellarium_gui_RES_CXX ${stellarium_gui_RES})
426352
427 SET(extLinkerOption ${extLinkerOption} ${QT_QTSCRIPT_LIBRARY} ${OPENGL_LIBRARIES})
428 SET(stellarium_lib_SRCS ${stellarium_lib_SRCS} ${stellarium_gui_SRCS} ${stellarium_UIS_H} ${stellarium_gui_RES_CXX})353 SET(stellarium_lib_SRCS ${stellarium_lib_SRCS} ${stellarium_gui_SRCS} ${stellarium_UIS_H} ${stellarium_gui_RES_CXX})
429ENDIF()354ENDIF()
430355
@@ -467,15 +392,9 @@
467################################ Build main program #########################################392################################ Build main program #########################################
468#############################################################################################393#############################################################################################
469394
470SET(extLinkerOption ${extLinkerOption} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES})
471IF(ENABLE_MEDIA)
472 # Forced linkage to Qt5MultimediaWidgets library when media support is enabled
473 SET(extLinkerOption ${extLinkerOption} ${Qt5MultimediaWidgets_LIBRARIES})
474ENDIF()
475IF(WIN32 AND NOT MSVC)395IF(WIN32 AND NOT MSVC)
476# TODO: Test if winsock is still necessary if the Telescope Control plug-in is disabled.396 # This library is required on MinGW builds for some native methods used in a fix in main.cpp
477# Because including it here seems to duplicate STELLARIUM_STATIC_PLUGINS_LIBRARIES397 SET(winMMLib libwinmm.a)
478 SET(extLinkerOption ${extLinkerOption} libwinmm.a -lws2_32)
479ENDIF()398ENDIF()
480399
481IF(WIN32 AND ENABLE_WINDOWS_EXE_ICON)400IF(WIN32 AND ENABLE_WINDOWS_EXE_ICON)
@@ -491,51 +410,37 @@
491 ENDIF()410 ENDIF()
492ENDIF()411ENDIF()
493412
413# Setup Qt5 dependencies
414SET(STELLARIUM_QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Gui ${STEL_GLES_LIBS} Qt5::Network Qt5::Widgets)
415IF(ENABLE_MEDIA)
416 SET(STELLARIUM_QT_LIBRARIES ${STELLARIUM_QT_LIBRARIES} Qt5::Multimedia Qt5::MultimediaWidgets)
417ENDIF()
418IF(ENABLE_SCRIPTING)
419 SET(STELLARIUM_QT_LIBRARIES ${STELLARIUM_QT_LIBRARIES} Qt5::Script)
420ENDIF()
421if(USE_OLD_QGLWIDGET)
422 # The Qt5OpenGL library is only required when using the legacy viewport
423 SET(STELLARIUM_QT_LIBRARIES ${STELLARIUM_QT_LIBRARIES} Qt5::OpenGL)
424endif()
425
494if(ENABLE_SPOUT AND SPOUT_LIBRARY_DLL)426if(ENABLE_SPOUT AND SPOUT_LIBRARY_DLL)
495 # automatically copy the spout .dll to the binary directory, if possible427 # automatically copy the spout .dll to the binary directory, if possible
496 configure_file(${SPOUT_LIBRARY_DLL} ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)428 configure_file(${SPOUT_LIBRARY_DLL} ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
497endif()429endif()
498430
431set(STELMAIN_DEPS ${ZLIB_LIBRARIES} qtcompress_stel glues_stel qcustomplot_stel ${STELLARIUM_STATIC_PLUGINS_LIBRARIES} ${STELLARIUM_QT_LIBRARIES} ${SPOUT_LIBRARY})
432
433# Main executable/library setup
499IF(GENERATE_STELMAINLIB)434IF(GENERATE_STELMAINLIB)
500 ADD_LIBRARY(stelMain SHARED ${stellarium_lib_SRCS} ${stellarium_RES_CXX})435 ADD_LIBRARY(stelMain SHARED ${stellarium_lib_SRCS} ${stellarium_RES_CXX})
501 TARGET_LINK_LIBRARIES(stelMain ${extLinkerOption} ${STELLARIUM_STATIC_PLUGINS_LIBRARIES})436 TARGET_LINK_LIBRARIES(stelMain ${STELMAIN_DEPS})
502 QT5_USE_MODULES(stelMain Core Concurrent Gui Network OpenGL Widgets PrintSupport)
503 IF(ENABLE_MEDIA)
504 QT5_USE_MODULES(stelMain Multimedia MultimediaWidgets)
505 ENDIF()
506 IF(ENABLE_SCRIPTING)
507 QT5_USE_MODULES(stelMain Script)
508 ENDIF()
509 IF(USE_PLUGIN_TELESCOPECONTROL)
510 QT5_USE_MODULES(stelMain SerialPort)
511 ENDIF()
512 IF(ENABLE_SPOUT)
513 TARGET_LINK_LIBRARIES(stelMain ${SPOUT_LIBRARY})
514 ENDIF(ENABLE_SPOUT)
515
516 INSTALL(TARGETS stelMain DESTINATION lib)437 INSTALL(TARGETS stelMain DESTINATION lib)
517 ADD_EXECUTABLE(stellarium ${stellarium_exe_SRCS})438 ADD_EXECUTABLE(stellarium ${stellarium_exe_SRCS})
518 #stelMain should be after the plug-ins, otherwise the build crashes439 #stelMain should be after the plug-ins, otherwise the build crashes
519 TARGET_LINK_LIBRARIES(stellarium ${STELLARIUM_STATIC_PLUGINS_LIBRARIES} stelMain ${extLinkerOption})440 TARGET_LINK_LIBRARIES(stellarium stelMain ${winMMLib})
520ELSE()441ELSE()
521 ADD_EXECUTABLE(stellarium ${stellarium_lib_SRCS} ${stellarium_RES_CXX} ${stellarium_exe_SRCS})442 ADD_EXECUTABLE(stellarium ${stellarium_lib_SRCS} ${stellarium_RES_CXX} ${stellarium_exe_SRCS})
522 TARGET_LINK_LIBRARIES(stellarium ${extLinkerOption} ${STELLARIUM_STATIC_PLUGINS_LIBRARIES})443 TARGET_LINK_LIBRARIES(stellarium ${winMMLib} ${STELMAIN_DEPS})
523 # This will add the ANGLE lib if the Qt version supports it.
524 TARGET_LINK_LIBRARIES(stellarium ${Qt5Gui_LIBRARIES} ${Qt5Gui_OPENGL_LIBRARIES})
525
526 QT5_USE_MODULES(stellarium Core Concurrent Gui Network OpenGL Widgets PrintSupport)
527 IF(ENABLE_MEDIA)
528 QT5_USE_MODULES(stellarium Multimedia MultimediaWidgets)
529 ENDIF()
530 IF(ENABLE_SCRIPTING)
531 QT5_USE_MODULES(stellarium Script)
532 ENDIF()
533 IF(USE_PLUGIN_TELESCOPECONTROL)
534 QT5_USE_MODULES(stellarium SerialPort)
535 ENDIF()
536 IF(ENABLE_SPOUT)
537 TARGET_LINK_LIBRARIES(stellarium ${SPOUT_LIBRARY})
538 ENDIF(ENABLE_SPOUT)
539444
540 IF(APPLE)445 IF(APPLE)
541 SET_TARGET_PROPERTIES(stellarium PROPERTIES LINK_FLAGS " -framework Cocoa -framework OpenGL")446 SET_TARGET_PROPERTIES(stellarium PROPERTIES LINK_FLAGS " -framework Cocoa -framework OpenGL")
@@ -566,7 +471,7 @@
566 SET(STELLARIUM_TESTS ${STELLARIUM_TESTS} ${NAME})471 SET(STELLARIUM_TESTS ${STELLARIUM_TESTS} ${NAME})
567ENDMACRO()472ENDMACRO()
568473
569SET(extLinkerOptionTest ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES})474SET(TESTS_LIBRARIES ${ZLIB_LIBRARIES} Qt5::Core Qt5::Gui Qt5::Test)
570475
571# Custom target used to build all tests at once476# Custom target used to build all tests at once
572ADD_CUSTOM_TARGET(buildTests)477ADD_CUSTOM_TARGET(buildTests)
@@ -577,13 +482,8 @@
577 core/StelUtils.hpp482 core/StelUtils.hpp
578 core/StelUtils.cpp483 core/StelUtils.cpp
579)484)
580IF(WIN32)
581 # StelUtils required zlib sources
582 SET(tests_testDates_SRCS ${tests_testDates_SRCS} ${zlib_SRCS})
583ENDIF()
584ADD_EXECUTABLE(testDates EXCLUDE_FROM_ALL ${tests_testDates_SRCS})485ADD_EXECUTABLE(testDates EXCLUDE_FROM_ALL ${tests_testDates_SRCS})
585QT5_USE_MODULES(testDates Core Test)486TARGET_LINK_LIBRARIES(testDates ${TESTS_LIBRARIES})
586TARGET_LINK_LIBRARIES(testDates ${extLinkerOptionTest})
587ADD_DEPENDENCIES(buildTests testDates)487ADD_DEPENDENCIES(buildTests testDates)
588ADD_TEST(testDates)488ADD_TEST(testDates)
589489
@@ -594,8 +494,7 @@
594 core/StelFileMgr.cpp494 core/StelFileMgr.cpp
595)495)
596ADD_EXECUTABLE(testStelFileMgr EXCLUDE_FROM_ALL ${tests_testStelFileMgr_SRCS})496ADD_EXECUTABLE(testStelFileMgr EXCLUDE_FROM_ALL ${tests_testStelFileMgr_SRCS})
597QT5_USE_MODULES(testStelFileMgr Core Test)497TARGET_LINK_LIBRARIES(testStelFileMgr ${TESTS_LIBRARIES})
598TARGET_LINK_LIBRARIES(testStelFileMgr ${extLinkerOptionTest})
599ADD_DEPENDENCIES(buildTests testStelFileMgr)498ADD_DEPENDENCIES(buildTests testStelFileMgr)
600ADD_TEST(testStelFileMgr)499ADD_TEST(testStelFileMgr)
601500
@@ -618,50 +517,35 @@
618 core/StelFileMgr.cpp517 core/StelFileMgr.cpp
619 core/StelTranslator.hpp518 core/StelTranslator.hpp
620 core/StelTranslator.cpp519 core/StelTranslator.cpp
621 ${glues_lib_SRCS}
622)520)
623IF(WIN32)
624 # StelUtils required zlib sources
625 SET(tests_testStelSphereGeometry_SRCS ${tests_testStelSphereGeometry_SRCS} ${zlib_SRCS})
626ENDIF()
627ADD_EXECUTABLE(testStelSphereGeometry EXCLUDE_FROM_ALL ${tests_testStelSphereGeometry_SRCS})521ADD_EXECUTABLE(testStelSphereGeometry EXCLUDE_FROM_ALL ${tests_testStelSphereGeometry_SRCS})
628QT5_USE_MODULES(testStelSphereGeometry Core OpenGL Test)522TARGET_LINK_LIBRARIES(testStelSphereGeometry ${TESTS_LIBRARIES} glues_stel)
629TARGET_LINK_LIBRARIES(testStelSphereGeometry ${extLinkerOptionTest})
630ADD_DEPENDENCIES(buildTests testStelSphereGeometry)523ADD_DEPENDENCIES(buildTests testStelSphereGeometry)
631ADD_TEST(testStelSphereGeometry)524ADD_TEST(testStelSphereGeometry)
632525
633SET(tests_testStelSphericalIndex_SRCS526#SET(tests_testStelSphericalIndex_SRCS
634 tests/testStelSphericalIndex.hpp527# tests/testStelSphericalIndex.hpp
635 tests/testStelSphericalIndex.cpp528# tests/testStelSphericalIndex.cpp
636 core/StelSphericalIndex.hpp529# core/StelSphericalIndex.hpp
637 core/StelSphericalIndex.cpp530# core/StelSphericalIndex.cpp
638 core/StelSphereGeometry.hpp531# core/StelSphereGeometry.hpp
639 core/StelSphereGeometry.cpp532# core/StelSphereGeometry.cpp
640 core/StelVertexArray.hpp533# core/StelVertexArray.hpp
641 core/StelVertexArray.cpp534# core/StelVertexArray.cpp
642 core/OctahedronPolygon.hpp535# core/OctahedronPolygon.hpp
643 core/OctahedronPolygon.cpp536# core/OctahedronPolygon.cpp
644 core/StelJsonParser.hpp537# core/StelJsonParser.hpp
645 core/StelJsonParser.cpp538# core/StelJsonParser.cpp
646 core/StelUtils.cpp539# core/StelUtils.cpp
647 core/StelUtils.hpp540# core/StelUtils.hpp
648 core/StelProjector.cpp541# core/StelProjector.cpp
649 core/StelProjector.hpp542# core/StelProjector.hpp
650 core/StelTranslator.cpp543# core/StelTranslator.cpp
651 core/StelTranslator.hpp544# core/StelTranslator.hpp
652 core/StelFileMgr.cpp545# ${glues_lib_SRCS})
653 core/StelFileMgr.hpp546#ADD_EXECUTABLE(testStelSphericalIndex EXCLUDE_FROM_ALL ${tests_testStelSphericalIndex_SRCS})
654 ${glues_lib_SRCS}547#TARGET_LINK_LIBRARIES(testStelSphericalIndex ${TESTS_LIBRARIES})
655)548#ADD_DEPENDENCIES(buildTests testStelSphericalIndex)
656IF(WIN32)
657 # StelUtils required zlib sources
658 SET(tests_testStelSphericalIndex_SRCS ${tests_testStelSphericalIndex_SRCS} ${zlib_SRCS})
659ENDIF()
660ADD_EXECUTABLE(testStelSphericalIndex EXCLUDE_FROM_ALL ${tests_testStelSphericalIndex_SRCS})
661QT5_USE_MODULES(testStelSphericalIndex Core OpenGL Test)
662TARGET_LINK_LIBRARIES(testStelSphericalIndex ${extLinkerOptionTest})
663ADD_DEPENDENCIES(buildTests testStelSphericalIndex)
664ADD_TEST(testStelSphericalIndex)
665549
666SET(tests_testStelJsonParser_SRCS550SET(tests_testStelJsonParser_SRCS
667 tests/testStelJsonParser.hpp551 tests/testStelJsonParser.hpp
@@ -670,8 +554,7 @@
670 core/StelJsonParser.cpp554 core/StelJsonParser.cpp
671)555)
672ADD_EXECUTABLE(testStelJsonParser EXCLUDE_FROM_ALL ${tests_testStelJsonParser_SRCS})556ADD_EXECUTABLE(testStelJsonParser EXCLUDE_FROM_ALL ${tests_testStelJsonParser_SRCS})
673QT5_USE_MODULES(testStelJsonParser Core Test)557TARGET_LINK_LIBRARIES(testStelJsonParser ${TESTS_LIBRARIES})
674TARGET_LINK_LIBRARIES(testStelJsonParser ${extLinkerOptionTest})
675ADD_DEPENDENCIES(buildTests testStelJsonParser)558ADD_DEPENDENCIES(buildTests testStelJsonParser)
676ADD_TEST(testStelJsonParser)559ADD_TEST(testStelJsonParser)
677560
@@ -681,8 +564,7 @@
681 core/StelVertexArray.hpp564 core/StelVertexArray.hpp
682)565)
683ADD_EXECUTABLE(testStelVertexArray EXCLUDE_FROM_ALL ${tests_testStelVertexArray_SRCS})566ADD_EXECUTABLE(testStelVertexArray EXCLUDE_FROM_ALL ${tests_testStelVertexArray_SRCS})
684QT5_USE_MODULES(testStelVertexArray Core Test OpenGL)567TARGET_LINK_LIBRARIES(testStelVertexArray ${TESTS_LIBRARIES})
685TARGET_LINK_LIBRARIES(testStelVertexArray ${extLinkerOptionTest})
686ADD_DEPENDENCIES(buildTests testStelVertexArray)568ADD_DEPENDENCIES(buildTests testStelVertexArray)
687ADD_TEST(testStelVertexArray)569ADD_TEST(testStelVertexArray)
688570
@@ -692,13 +574,8 @@
692 core/StelUtils.hpp574 core/StelUtils.hpp
693 core/StelUtils.cpp575 core/StelUtils.cpp
694)576)
695IF(WIN32)
696 # StelUtils required zlib sources
697 SET(tests_testDeltaT_SRCS ${tests_testDeltaT_SRCS} ${zlib_SRCS})
698ENDIF()
699ADD_EXECUTABLE(testDeltaT EXCLUDE_FROM_ALL ${tests_testDeltaT_SRCS})577ADD_EXECUTABLE(testDeltaT EXCLUDE_FROM_ALL ${tests_testDeltaT_SRCS})
700QT5_USE_MODULES(testDeltaT Core Test)578TARGET_LINK_LIBRARIES(testDeltaT ${TESTS_LIBRARIES})
701TARGET_LINK_LIBRARIES(testDeltaT ${extLinkerOptionTest})
702ADD_DEPENDENCIES(buildTests testDeltaT)579ADD_DEPENDENCIES(buildTests testDeltaT)
703ADD_TEST(testDeltaT)580ADD_TEST(testDeltaT)
704581
@@ -708,13 +585,8 @@
708 core/StelUtils.hpp585 core/StelUtils.hpp
709 core/StelUtils.cpp586 core/StelUtils.cpp
710)587)
711IF(WIN32)
712 # StelUtils required zlib sources
713 SET(tests_testConversions_SRCS ${tests_testConversions_SRCS} ${zlib_SRCS})
714ENDIF()
715ADD_EXECUTABLE(testConversions EXCLUDE_FROM_ALL ${tests_testConversions_SRCS})588ADD_EXECUTABLE(testConversions EXCLUDE_FROM_ALL ${tests_testConversions_SRCS})
716QT5_USE_MODULES(testConversions Core Test)589TARGET_LINK_LIBRARIES(testConversions ${TESTS_LIBRARIES})
717TARGET_LINK_LIBRARIES(testConversions ${extLinkerOptionTest})
718ADD_DEPENDENCIES(buildTests testConversions)590ADD_DEPENDENCIES(buildTests testConversions)
719ADD_TEST(testConversions)591ADD_TEST(testConversions)
720592
@@ -725,8 +597,7 @@
725 core/RefractionExtinction.cpp597 core/RefractionExtinction.cpp
726)598)
727ADD_EXECUTABLE(testExtinction EXCLUDE_FROM_ALL ${tests_testExtinction_SRCS})599ADD_EXECUTABLE(testExtinction EXCLUDE_FROM_ALL ${tests_testExtinction_SRCS})
728QT5_USE_MODULES(testExtinction Core Test)600TARGET_LINK_LIBRARIES(testExtinction ${TESTS_LIBRARIES})
729TARGET_LINK_LIBRARIES(testExtinction ${extLinkerOptionTest})
730ADD_DEPENDENCIES(buildTests testExtinction)601ADD_DEPENDENCIES(buildTests testExtinction)
731ADD_TEST(testExtinction)602ADD_TEST(testExtinction)
732603
@@ -738,13 +609,8 @@
738 core/StelUtils.hpp609 core/StelUtils.hpp
739 core/StelUtils.cpp610 core/StelUtils.cpp
740)611)
741IF(WIN32)
742 # StelUtils required zlib sources
743 SET(tests_testRefraction_SRCS ${tests_testRefraction_SRCS} ${zlib_SRCS})
744ENDIF()
745ADD_EXECUTABLE(testRefraction EXCLUDE_FROM_ALL ${tests_testRefraction_SRCS})612ADD_EXECUTABLE(testRefraction EXCLUDE_FROM_ALL ${tests_testRefraction_SRCS})
746QT5_USE_MODULES(testRefraction Core Test)613TARGET_LINK_LIBRARIES(testRefraction ${TESTS_LIBRARIES})
747TARGET_LINK_LIBRARIES(testRefraction ${extLinkerOptionTest})
748ADD_DEPENDENCIES(buildTests testRefraction)614ADD_DEPENDENCIES(buildTests testRefraction)
749ADD_TEST(testRefraction)615ADD_TEST(testRefraction)
750616
@@ -756,13 +622,8 @@
756 core/StelUtils.hpp622 core/StelUtils.hpp
757 core/StelUtils.cpp623 core/StelUtils.cpp
758)624)
759IF(WIN32)
760 # StelUtils required zlib sources
761 SET(tests_testPrecession_SRCS ${tests_testPrecession_SRCS} ${zlib_SRCS})
762ENDIF()
763ADD_EXECUTABLE(testPrecession EXCLUDE_FROM_ALL ${tests_testPrecession_SRCS})625ADD_EXECUTABLE(testPrecession EXCLUDE_FROM_ALL ${tests_testPrecession_SRCS})
764QT5_USE_MODULES(testPrecession Core Test)626TARGET_LINK_LIBRARIES(testPrecession ${TESTS_LIBRARIES})
765TARGET_LINK_LIBRARIES(testPrecession ${extLinkerOptionTest})
766ADD_DEPENDENCIES(buildTests testPrecession)627ADD_DEPENDENCIES(buildTests testPrecession)
767ADD_TEST(testPrecession)628ADD_TEST(testPrecession)
768629
@@ -788,8 +649,7 @@
788 core/planetsephems/jpleph.cpp649 core/planetsephems/jpleph.cpp
789)650)
790ADD_EXECUTABLE(testEphemeris EXCLUDE_FROM_ALL ${tests_testEphemeris_SRCS})651ADD_EXECUTABLE(testEphemeris EXCLUDE_FROM_ALL ${tests_testEphemeris_SRCS})
791QT5_USE_MODULES(testEphemeris Core Test)652TARGET_LINK_LIBRARIES(testEphemeris ${TESTS_LIBRARIES})
792TARGET_LINK_LIBRARIES(testEphemeris ${extLinkerOptionTest})
793TARGET_COMPILE_DEFINITIONS(testEphemeris PRIVATE UNIT_TEST)653TARGET_COMPILE_DEFINITIONS(testEphemeris PRIVATE UNIT_TEST)
794ADD_DEPENDENCIES(buildTests testEphemeris)654ADD_DEPENDENCIES(buildTests testEphemeris)
795ADD_TEST(testEphemeris)655ADD_TEST(testEphemeris)
796656
=== modified file 'src/StelLogger.cpp'
--- src/StelLogger.cpp 2016-07-05 15:30:52 +0000
+++ src/StelLogger.cpp 2017-01-12 21:08:38 +0000
@@ -254,6 +254,8 @@
254254
255void StelLogger::debugLogHandler(QtMsgType type, const QMessageLogContext& ctx, const QString& msg)255void StelLogger::debugLogHandler(QtMsgType type, const QMessageLogContext& ctx, const QString& msg)
256{256{
257 // *** NOTE: see original Qt source in qlogging.cpp (qDefaultMessageHandler) for sensible default code
258
257#if (QT_VERSION>=QT_VERSION_CHECK(5,4,0))259#if (QT_VERSION>=QT_VERSION_CHECK(5,4,0))
258 //use Qt to format the log message, if possible260 //use Qt to format the log message, if possible
259 //this uses the format set by qSetMessagePattern261 //this uses the format set by qSetMessagePattern
@@ -268,24 +270,30 @@
268 if(fmt.isNull())270 if(fmt.isNull())
269 return;271 return;
270272
273 //always append newline
274 fmt.append(QLatin1Char('\n'));
275
271#ifdef Q_OS_WIN276#ifdef Q_OS_WIN
272 //Send debug messages to Debugger, if one is attached, instead of stderr277 //Send debug messages to Debugger, if one is attached, instead of stderr
273 //This seems to avoid output delays in Qt Creator, allowing for easier debugging278 //This seems to avoid output delays in Qt Creator, allowing for easier debugging
274 //Seems to work fine with MSVC and MinGW279 //Seems to work fine with MSVC and MinGW
275 if(IsDebuggerPresent())280 if (IsDebuggerPresent())
276 OutputDebugStringW(reinterpret_cast<LPCWSTR>(fmt.utf16()));281 {
282 OutputDebugStringW(reinterpret_cast<const wchar_t *>(fmt.utf16()));
283 }
277 else284 else
278#endif285#endif
279 //this does the same as the default handler in qlogging.cpp286 {
280 fprintf(stderr, "%s\n", qPrintable(fmt));287 //this does the same as the default handler in qlogging.cpp
281 fflush(stderr);288 fprintf(stderr, "%s", qPrintable(fmt));
289 fflush(stderr);
290 }
282 writeLog(fmt);291 writeLog(fmt);
283}292}
284293
285void StelLogger::writeLog(QString msg)294void StelLogger::writeLog(QString msg)
286{295{
287 fileMutex.lock();296 fileMutex.lock();
288 msg += "\n";
289 logFile.write(qPrintable(msg), msg.size());297 logFile.write(qPrintable(msg), msg.size());
290 log += msg;298 log += msg;
291 fileMutex.unlock();299 fileMutex.unlock();
292300
=== modified file 'src/StelMainView.cpp'
--- src/StelMainView.cpp 2016-12-11 22:57:16 +0000
+++ src/StelMainView.cpp 2017-01-12 21:08:38 +0000
@@ -32,10 +32,10 @@
3232
33#include <QDebug>33#include <QDebug>
34#include <QDir>34#include <QDir>
35#if STEL_USE_NEW_OPENGL_WIDGETS35#ifdef USE_OLD_QGLWIDGET
36#include <QGLWidget>
37#else
36#include <QOpenGLWidget>38#include <QOpenGLWidget>
37#else
38#include <QGLWidget>
39#endif39#endif
40#include <QApplication>40#include <QApplication>
41#include <QDesktopWidget>41#include <QDesktopWidget>
@@ -61,24 +61,199 @@
61#endif61#endif
62#include <QOpenGLShader>62#include <QOpenGLShader>
63#include <QOpenGLShaderProgram>63#include <QOpenGLShaderProgram>
64#include <QGLFramebufferObject>64#include <QOpenGLFramebufferObject>
65#include <QGLShaderProgram>65#include <QOpenGLPaintDevice>
66#ifdef OPENGL_DEBUG_LOGGING
67#include <QOpenGLDebugLogger>
68#endif
6669
67#include <clocale>70#include <clocale>
6871
69// Initialize static variables72// Initialize static variables
70StelMainView* StelMainView::singleton = NULL;73StelMainView* StelMainView::singleton = NULL;
7174
75#ifdef USE_OLD_QGLWIDGET
76class StelGLWidget : public QGLWidget
77#else
78class StelGLWidget : public QOpenGLWidget
79#endif
80{
81public:
82 StelGLWidget(StelMainView* parent)
83 :
84#ifdef USE_OLD_QGLWIDGET
85 QGLWidget(parent),
86#else
87 QOpenGLWidget(parent),
88#endif
89 parent(parent),
90 initialized(false)
91 {
92 qDebug()<<"StelGLWidget constructor";
93
94 //because we always draw the full background,
95 //lets skip drawing the system background
96 setAttribute(Qt::WA_OpaquePaintEvent);
97 setAutoFillBackground(false);
98 }
99
100 ~StelGLWidget()
101 {
102 qDebug()<<"StelGLWidget destroyed";
103 }
104
105 virtual void initializeGL() Q_DECL_OVERRIDE
106 {
107 if(initialized)
108 {
109 qWarning()<<"Double initialization, should not happen";
110 Q_ASSERT(false);
111 return;
112 }
113
114 //This seems to be the correct place to initialize all
115 //GL related stuff of the application
116 //this includes all the init() calls of the modules
117
118#ifdef USE_OLD_QGLWIDGET
119 QOpenGLContext* ctx = context()->contextHandle();
120#else
121 QOpenGLContext* ctx = context();
122#endif
123 Q_ASSERT(ctx == QOpenGLContext::currentContext());
124 StelOpenGL::mainContext = ctx; //throw an error when StelOpenGL functions are executed in another context
125
126 qDebug()<<"initializeGL";
127 qDebug() << "OpenGL supported version: " << QString((char*)ctx->functions()->glGetString(GL_VERSION));
128 qDebug() << "Current Format: " << this->format();
129
130 if (qApp->property("onetime_compat33")==true)
131 {
132 // This may not return the version number set previously!
133 qDebug() << "StelGLWidget context format version:" << ctx->format().majorVersion() << "." << context()->format().minorVersion();
134 qDebug() << "StelGLWidget has CompatibilityProfile:" << (ctx->format().profile()==QSurfaceFormat::CompatibilityProfile ? "yes" : "no") << "(" <<context()->format().profile() << ")";
135 }
136
137 parent->init();
138 initialized = true;
139 }
140
141protected:
142 virtual void paintGL() Q_DECL_OVERRIDE
143 {
144 //this is actually never called because the
145 //QGraphicsView intercepts the paint event
146 //we have to draw in the background of the scene
147 //or as a QGraphicsItem
148 qDebug()<<"paintGL";
149 }
150 virtual void resizeGL(int w, int h) Q_DECL_OVERRIDE
151 {
152 //we probably can ignore this method,
153 //it seems it is also never called
154 qDebug()<<"resizeGL"<<w<<h;
155 }
156
157private:
158 StelMainView* parent;
159 bool initialized;
160};
161
72// A custom QGraphicsEffect to apply the night mode on top of the screen.162// A custom QGraphicsEffect to apply the night mode on top of the screen.
73class NightModeGraphicsEffect : public QGraphicsEffect163class NightModeGraphicsEffect : public QGraphicsEffect
74{164{
75public:165public:
76 NightModeGraphicsEffect(QObject* parent = NULL);166 NightModeGraphicsEffect(StelMainView* parent = NULL)
167 : QGraphicsEffect(parent),
168 parent(parent), fbo(NULL)
169 {
170 Q_ASSERT(parent->glContext() == QOpenGLContext::currentContext());
171
172 program = new QOpenGLShaderProgram(this);
173 QString vertexCode =
174 "attribute highp vec4 a_pos;\n"
175 "attribute highp vec2 a_texCoord;\n"
176 "varying highp vec2 v_texCoord;\n"
177 "void main(void)\n"
178 "{\n"
179 "v_texCoord = a_texCoord;\n"
180 "gl_Position = a_pos;\n"
181 "}\n";
182 QString fragmentCode =
183 "varying highp vec2 v_texCoord;\n"
184 "uniform sampler2D u_source;\n"
185 "void main(void)\n"
186 "{\n"
187 " mediump vec3 color = texture2D(u_source, v_texCoord).rgb;\n"
188 " mediump float luminance = max(max(color.r, color.g), color.b);\n"
189 " gl_FragColor = vec4(luminance, 0.0, 0.0, 1.0);\n"
190 "}\n";
191 program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexCode);
192 program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentCode);
193 program->link();
194 vars.pos = program->attributeLocation("a_pos");
195 vars.texCoord = program->attributeLocation("a_texCoord");
196 vars.source = program->uniformLocation("u_source");
197 }
198
199 virtual ~NightModeGraphicsEffect()
200 {
201 Q_ASSERT(parent->glContext() == QOpenGLContext::currentContext());
202 //clean up fbo
203 delete fbo;
204 }
77protected:205protected:
78 virtual void draw(QPainter* painter);206 virtual void draw(QPainter* painter) Q_DECL_OVERRIDE
207 {
208 Q_ASSERT(parent->glContext() == QOpenGLContext::currentContext());
209 QOpenGLFunctions* gl = QOpenGLContext::currentContext()->functions();
210
211 int mainFBO;
212 gl->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &mainFBO);
213
214 int pixelRatio = painter->device()->devicePixelRatio();
215 QSize size(painter->device()->width() * pixelRatio, painter->device()->height() * pixelRatio);
216 if (fbo && fbo->size() != size)
217 {
218 delete fbo;
219 fbo = NULL;
220 }
221 if (!fbo)
222 {
223 QOpenGLFramebufferObjectFormat format;
224 format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
225 format.setInternalTextureFormat(GL_RGBA);
226 fbo = new QOpenGLFramebufferObject(size, format);
227 }
228
229 fbo->bind();
230 QOpenGLPaintDevice device(size);
231 QPainter fboPainter(&device);
232 drawSource(&fboPainter);
233 //dont use QOpenGLFramebufferObject::release here
234 gl->glBindFramebuffer(GL_FRAMEBUFFER,mainFBO);
235
236 painter->save();
237 painter->beginNativePainting();
238 program->bind();
239 const GLfloat pos[] = {-1, -1, +1, -1, -1, +1, +1, +1};
240 const GLfloat texCoord[] = {0, 0, 1, 0, 0, 1, 1, 1};
241 program->setUniformValue(vars.source, 0);
242 program->setAttributeArray(vars.pos, pos, 2);
243 program->setAttributeArray(vars.texCoord, texCoord, 2);
244 program->enableAttributeArray(vars.pos);
245 program->enableAttributeArray(vars.texCoord);
246 gl->glBindTexture(GL_TEXTURE_2D, fbo->texture());
247 gl->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
248 program->release();
249 painter->endNativePainting();
250 painter->restore();
251 }
252
79private:253private:
80 QGLFramebufferObject* fbo;254 StelMainView* parent;
81 QGLShaderProgram *program;255 QOpenGLFramebufferObject* fbo;
256 QOpenGLShaderProgram *program;
82 struct {257 struct {
83 int pos;258 int pos;
84 int texCoord;259 int texCoord;
@@ -86,355 +261,271 @@
86 } vars;261 } vars;
87};262};
88263
89NightModeGraphicsEffect::NightModeGraphicsEffect(QObject* parent) :264class StelGraphicsScene : public QGraphicsScene
90 QGraphicsEffect(parent)
91 , fbo(NULL)
92{
93 program = new QGLShaderProgram(this);
94 QString vertexCode =
95 "attribute highp vec4 a_pos;\n"
96 "attribute highp vec2 a_texCoord;\n"
97 "varying highp vec2 v_texCoord;\n"
98 "void main(void)\n"
99 "{\n"
100 "v_texCoord = a_texCoord;\n"
101 "gl_Position = a_pos;\n"
102 "}\n";
103 QString fragmentCode =
104 "varying highp vec2 v_texCoord;\n"
105 "uniform sampler2D u_source;\n"
106 "void main(void)\n"
107 "{\n"
108 " mediump vec3 color = texture2D(u_source, v_texCoord).rgb;\n"
109 " mediump float luminance = max(max(color.r, color.g), color.b);\n"
110 " gl_FragColor = vec4(luminance, 0.0, 0.0, 1.0);\n"
111 "}\n";
112 program->addShaderFromSourceCode(QGLShader::Vertex, vertexCode);
113 program->addShaderFromSourceCode(QGLShader::Fragment, fragmentCode);
114 program->link();
115 vars.pos = program->attributeLocation("a_pos");
116 vars.texCoord = program->attributeLocation("a_texCoord");
117 vars.source = program->uniformLocation("u_source");
118}
119
120// Qt 5.5 does not support setting the devicePixelRatio of a QGLFramebufferObject,
121// So here we make a sub class just so that we can return the correct ratio when
122// using the buffer on a retina display.
123class NightModeGraphicsEffectFbo : public QGLFramebufferObject
124{265{
125public:266public:
126 NightModeGraphicsEffectFbo(const QSize& s, const QGLFramebufferObjectFormat& f, int pixelRatio_) :267 StelGraphicsScene(StelMainView* parent)
127 QGLFramebufferObject(s, f), pixelRatio(pixelRatio_) {}268 : QGraphicsScene(parent), parent(parent)
269 {
270 qDebug()<<"StelGraphicsScene constructor";
271 }
272
128protected:273protected:
129 virtual int metric(PaintDeviceMetric m) const274
275 void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE
130 {276 {
131 if (m == QPaintDevice::PdmDevicePixelRatio) return pixelRatio;277 // Try to trigger a global shortcut.
132 return QGLFramebufferObject::metric(m);278 StelActionMgr* actionMgr = StelApp::getInstance().getStelActionManager();
279 if (actionMgr->pushKey(event->key() + event->modifiers(), true)) {
280 event->setAccepted(true);
281 parent->thereWasAnEvent(); // Refresh screen ASAP
282 return;
283 }
284 //pass event on to items otherwise
285 QGraphicsScene::keyPressEvent(event);
133 }286 }
287
134private:288private:
135 int pixelRatio;289 StelMainView* parent;
136};290};
137291
138void NightModeGraphicsEffect::draw(QPainter* painter)292class StelRootItem : public QGraphicsObject
139{
140 int pixelRatio = painter->device()->devicePixelRatio();
141 QSize size(painter->device()->width() * pixelRatio, painter->device()->height() * pixelRatio);
142 if (fbo && fbo->size() != size)
143 {
144 delete fbo;
145 fbo = NULL;
146 }
147 if (!fbo)
148 {
149 QGLFramebufferObjectFormat format;
150 format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
151 format.setInternalTextureFormat(GL_RGBA);
152 fbo = new NightModeGraphicsEffectFbo(size, format, pixelRatio);
153 }
154 QPainter fboPainter(fbo);
155 drawSource(&fboPainter);
156
157 painter->save();
158 painter->beginNativePainting();
159 program->bind();
160 const GLfloat pos[] = {-1, -1, +1, -1, -1, +1, +1, +1};
161 const GLfloat texCoord[] = {0, 0, 1, 0, 0, 1, 1, 1};
162 program->setUniformValue(vars.source, 0);
163 program->setAttributeArray(vars.pos, pos, 2);
164 program->setAttributeArray(vars.texCoord, texCoord, 2);
165 program->enableAttributeArray(vars.pos);
166 program->enableAttributeArray(vars.texCoord);
167 glBindTexture(GL_TEXTURE_2D, fbo->texture());
168 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
169 program->release();
170 painter->endNativePainting();
171 painter->restore();
172}
173
174//! Render Stellarium sky.
175class StelSkyItem : public QGraphicsWidget
176{293{
177public:294public:
178 StelSkyItem(QGraphicsItem* parent = NULL);295 StelRootItem(StelMainView* mainView, QGraphicsItem* parent = NULL)
179 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);296 : QGraphicsObject(parent), mainView(mainView)
297 {
298 setFlag(QGraphicsItem::ItemClipsToShape);
299 setFlag(QGraphicsItem::ItemClipsChildrenToShape);
300 setFlag(QGraphicsItem::ItemIsFocusable);
301
302 setAcceptHoverEvents(true);
303
304#ifdef Q_OS_WIN
305 setAcceptTouchEvents(true);
306 grabGesture(Qt::PinchGesture);
307#endif
308 setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton);
309 previousPaintTime = StelApp::getTotalRunTime();
310 }
311
312 void setSize(const QSize& size)
313 {
314 prepareGeometryChange();
315 rect.setSize(size);
316 }
317
180protected:318protected:
181 void mousePressEvent(QGraphicsSceneMouseEvent* event);319 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE
182 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);320 {
183 void mouseMoveEvent(QGraphicsSceneMouseEvent* event);321 Q_UNUSED(option);
184 void wheelEvent(QGraphicsSceneWheelEvent *event);322 Q_UNUSED(widget);
185 void keyPressEvent(QKeyEvent *event);323
186 void keyReleaseEvent(QKeyEvent *event);324 //a sanity check
187 void resizeEvent(QGraphicsSceneResizeEvent* event);325 Q_ASSERT(mainView->glContext() == QOpenGLContext::currentContext());
326
327 const double now = StelApp::getTotalRunTime();
328 double dt = now - previousPaintTime;
329 //qDebug()<<"dt"<<dt;
330 previousPaintTime = now;
331
332 //update and draw
333 StelApp& app = StelApp::getInstance();
334 app.update(dt);
335
336 //important to call this, or Qt may have invalid state after we have drawn (wrong textures, etc...)
337 painter->beginNativePainting();
338 app.draw();
339 painter->endNativePainting();
340
341 mainView->drawEnded();
342 }
343
344 virtual QRectF boundingRect() const Q_DECL_OVERRIDE
345 {
346 return rect;
347 }
348
349 //*** Main event handlers to pass on to StelApp ***//
350 void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
351 {
352 QMouseEvent ev = convertMouseEvent(event);
353 StelApp::getInstance().handleClick(&ev);
354 event->setAccepted(ev.isAccepted());
355 if(ev.isAccepted())
356 mainView->thereWasAnEvent();
357 }
358
359 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
360 {
361 QMouseEvent ev = convertMouseEvent(event);
362 StelApp::getInstance().handleClick(&ev);
363 event->setAccepted(ev.isAccepted());
364 if(ev.isAccepted())
365 mainView->thereWasAnEvent();
366 }
367
368 void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE
369 {
370 QMouseEvent ev = convertMouseEvent(event);
371 QPointF pos = ev.pos();
372 event->setAccepted(StelApp::getInstance().handleMove(pos.x(), pos.y(), ev.buttons()));
373 if(event->isAccepted())
374 mainView->thereWasAnEvent();
375 }
376
377 void wheelEvent(QGraphicsSceneWheelEvent *event) Q_DECL_OVERRIDE
378 {
379 QPointF pos = event->scenePos();
380 pos.setY(rect.height() - 1 - pos.y());
381 QWheelEvent newEvent(QPoint(pos.x(),pos.y()), event->delta(), event->buttons(), event->modifiers(), event->orientation());
382 StelApp::getInstance().handleWheel(&newEvent);
383 event->setAccepted(newEvent.isAccepted());
384 if(newEvent.isAccepted())
385 mainView->thereWasAnEvent();
386 }
387
388 void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE
389 {
390 StelApp::getInstance().handleKeys(event);
391 if(event->isAccepted())
392 mainView->thereWasAnEvent();
393 }
394
395 void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE
396 {
397 StelApp::getInstance().handleKeys(event);
398 if(event->isAccepted())
399 mainView->thereWasAnEvent();
400 }
401
402 //*** Gesture and touch support, currently only for Windows
188#ifdef Q_OS_WIN403#ifdef Q_OS_WIN
189 bool event(QEvent * e);404 bool event(QEvent * e) Q_DECL_OVERRIDE
405 {
406 switch (e->type()){
407 case QEvent::TouchBegin:
408 case QEvent::TouchUpdate:
409 case QEvent::TouchEnd:
410 {
411 QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e);
412 QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints();
413
414 if (touchPoints.count() == 1)
415 setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton);
416
417 return true;
418 break;
419 }
420
421 case QEvent::Gesture:
422 setAcceptedMouseButtons(0);
423 return gestureEvent(static_cast<QGestureEvent*>(e));
424 break;
425
426 default:
427 return QGraphicsObject::event(e);
428 }
429 }
430
431private:
432 bool gestureEvent(QGestureEvent *event)
433 {
434 if (QGesture *pinch = event->gesture(Qt::PinchGesture))
435 pinchTriggered(static_cast<QPinchGesture *>(pinch));
436
437 return true;
438 }
439
440 void pinchTriggered(QPinchGesture *gesture)
441 {
442 QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags();
443 if (changeFlags & QPinchGesture::ScaleFactorChanged) {
444 qreal zoom = gesture->scaleFactor();
445
446 if (zoom < 2 && zoom > 0.5){
447 StelApp::getInstance().handlePinch(zoom, true);
448 }
449 }
450 }
190#endif451#endif
452
191private:453private:
454 //! Helper function to convert a QGraphicsSceneMouseEvent to a QMouseEvent suitable for StelApp consumption
455 QMouseEvent convertMouseEvent(QGraphicsSceneMouseEvent *event) const
456 {
457 //convert graphics scene mouse event to widget style mouse event
458 QEvent::Type t = QEvent::None;
459 switch(event->type())
460 {
461 case QEvent::GraphicsSceneMousePress:
462 t = QEvent::MouseButtonPress;
463 break;
464 case QEvent::GraphicsSceneMouseRelease:
465 t = QEvent::MouseButtonRelease;
466 break;
467 case QEvent::GraphicsSceneMouseMove:
468 t = QEvent::MouseMove;
469 break;
470 default:
471 qFatal("Invalid mouse event type %d",event->type());
472 }
473
474 QPointF pos = event->scenePos();
475 //Y needs to be inverted
476 pos.setY(rect.height() - 1 - pos.y());
477 return QMouseEvent(t,pos,event->button(),event->buttons(),event->modifiers());
478 }
479
480 QRectF rect;
192 double previousPaintTime;481 double previousPaintTime;
193 // void onSizeChanged();482 StelMainView* mainView;
194#ifdef Q_OS_WIN
195 void pinchTriggered(QPinchGesture *gesture);
196 bool gestureEvent(QGestureEvent *event);
197#endif
198};483};
199484
200//! Initialize and render Stellarium gui.485//! Initialize and render Stellarium gui.
201class StelGuiItem : public QGraphicsWidget486class StelGuiItem : public QGraphicsWidget
202{487{
203public:488public:
204 StelGuiItem(QGraphicsItem* parent = NULL);489 StelGuiItem(QGraphicsItem* parent = NULL)
490 : QGraphicsWidget(parent)
491 {
492 StelApp::getInstance().getGui()->init(this);
493 }
494
205protected:495protected:
206 void resizeEvent(QGraphicsSceneResizeEvent* event);496 void resizeEvent(QGraphicsSceneResizeEvent* event) Q_DECL_OVERRIDE
497 {
498 Q_UNUSED(event);
499 //widget->setGeometry(0, 0, size().width(), size().height());
500 StelApp::getInstance().getGui()->forceRefreshGui();
501 }
207private:502private:
208 QGraphicsWidget *widget;503 //QGraphicsWidget *widget;
209 // void onSizeChanged();504 // void onSizeChanged();
210};505};
211506
212StelSkyItem::StelSkyItem(QGraphicsItem* parent)507StelMainView::StelMainView(QSettings* settings)
213{508 : QGraphicsView(),
214 Q_UNUSED(parent);509 guiItem(NULL),
215 setObjectName("SkyItem");
216 setFlag(QGraphicsItem::ItemHasNoContents, false);
217 setFlag(QGraphicsItem::ItemIsFocusable, true);
218 setAcceptHoverEvents(true);
219#ifdef Q_OS_WIN
220 setAcceptTouchEvents(true);
221 grabGesture(Qt::PinchGesture);
222#endif
223 setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton);
224 previousPaintTime = StelApp::getTotalRunTime();
225 setFocus();
226}
227
228void StelSkyItem::resizeEvent(QGraphicsSceneResizeEvent* event)
229{
230 QGraphicsWidget::resizeEvent(event);
231 StelApp::getInstance().glWindowHasBeenResized(scenePos().x(), scene()->sceneRect().height()-(scenePos().y()+geometry().height()), geometry().width(), geometry().height());
232}
233
234void StelSkyItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
235{
236 Q_UNUSED(option);
237 Q_UNUSED(widget);
238
239 const double now = StelApp::getTotalRunTime();
240 double dt = now - previousPaintTime;
241 previousPaintTime = now;
242
243 painter->beginNativePainting();
244 glClearColor(0, 0, 0, 1);
245 glClear(GL_COLOR_BUFFER_BIT);
246 StelApp::getInstance().update(dt);
247 StelApp::getInstance().draw();
248
249 painter->endNativePainting();
250}
251
252void StelSkyItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
253{
254 //To get back the focus from dialogs
255 setFocus();
256 QPointF pos = event->scenePos();
257 pos.setY(size().height() - 1 - pos.y());
258 QMouseEvent newEvent(QEvent::MouseButtonPress, QPoint(pos.x(), pos.y()), event->button(), event->buttons(), event->modifiers());
259 StelApp::getInstance().handleClick(&newEvent);
260}
261
262void StelSkyItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
263{
264 QPointF pos = event->scenePos();
265 pos.setY(size().height() - 1 - pos.y());
266 QMouseEvent newEvent(QEvent::MouseButtonRelease, QPoint(pos.x(), pos.y()), event->button(), event->buttons(), event->modifiers());
267 StelApp::getInstance().handleClick(&newEvent);
268}
269
270void StelSkyItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
271{
272 QPointF pos = event->scenePos();
273 pos.setY(size().height() - 1 - pos.y());
274 StelApp::getInstance().handleMove(pos.x(), pos.y(), event->buttons());
275}
276
277void StelSkyItem::wheelEvent(QGraphicsSceneWheelEvent *event)
278{
279 QPointF pos = event->scenePos();
280 pos.setY(size().height() - 1 - pos.y());
281 QWheelEvent newEvent(QPoint(pos.x(),pos.y()), event->delta(), event->buttons(), event->modifiers(), event->orientation());
282 StelApp::getInstance().handleWheel(&newEvent);
283}
284
285#ifdef Q_OS_WIN
286bool StelSkyItem::event(QEvent * e)
287{
288 switch (e->type()){
289 case QEvent::TouchBegin:
290 case QEvent::TouchUpdate:
291 case QEvent::TouchEnd:
292 {
293 QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e);
294 QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints();
295
296 if (touchPoints.count() == 1)
297 setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton);
298
299 return true;
300 break;
301 }
302
303 case QEvent::Gesture:
304 setAcceptedMouseButtons(0);
305 return gestureEvent(static_cast<QGestureEvent*>(e));
306 break;
307
308 default:
309 return QGraphicsWidget::event(e);
310 }
311}
312
313bool StelSkyItem::gestureEvent(QGestureEvent *event)
314{
315 if (QGesture *pinch = event->gesture(Qt::PinchGesture))
316 pinchTriggered(static_cast<QPinchGesture *>(pinch));
317
318 return true;
319}
320
321void StelSkyItem::pinchTriggered(QPinchGesture *gesture)
322{
323 QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags();
324 if (changeFlags & QPinchGesture::ScaleFactorChanged) {
325 qreal zoom = gesture->scaleFactor();
326
327 if (zoom < 2 && zoom > 0.5){
328 StelApp::getInstance().handlePinch(zoom, true);
329 }
330 }
331}
332#endif
333
334void StelSkyItem::keyPressEvent(QKeyEvent* event)
335{
336 StelApp::getInstance().handleKeys(event);
337}
338
339void StelSkyItem::keyReleaseEvent(QKeyEvent* event)
340{
341 StelApp::getInstance().handleKeys(event);
342}
343
344
345StelGuiItem::StelGuiItem(QGraphicsItem* parent) : QGraphicsWidget(parent)
346{
347 widget = new QGraphicsWidget(this);
348 StelApp::getInstance().getGui()->init(widget);
349}
350
351void StelGuiItem::resizeEvent(QGraphicsSceneResizeEvent* event)
352{
353 Q_UNUSED(event);
354 widget->setGeometry(0, 0, size().width(), size().height());
355 StelApp::getInstance().getGui()->forceRefreshGui();
356}
357
358#if STEL_USE_NEW_OPENGL_WIDGETS
359
360class StelQOpenGLWidget : public QOpenGLWidget
361{
362public:
363 StelQOpenGLWidget(QWidget* parent) : QOpenGLWidget(parent)
364 {
365 // TODO: Unclear if tese attributes make sense?
366 setAttribute(Qt::WA_PaintOnScreen);
367 setAttribute(Qt::WA_NoSystemBackground);
368 setAttribute(Qt::WA_OpaquePaintEvent);
369 }
370
371protected:
372 virtual void initializeGL()
373 {
374 qDebug() << "It appears this was never called?";
375 qDebug() << "OpenGL supported version: " << QString((char*)glGetString(GL_VERSION));
376
377 QOpenGLWidget::initializeGL();
378 this->makeCurrent(); // Do we need this?
379 // GZ I have no idea how to proceed, sorry.
380 QSurfaceFormat format=this->format();
381 qDebug() << "Current Format: " << this->format();
382 // TODO: Test something? The old tests may be obsolete as all OpenGL2 formats/contexts have these?
383 }
384 virtual void paintGL()
385 {
386 // TODO: what shall this do exactly?
387 }
388 virtual void resizeGL()
389 {
390 // TODO: what shall this do exactly?
391 }
392
393};
394
395#else
396class StelQGLWidget : public QGLWidget
397{
398public:
399 StelQGLWidget(QGLContext* ctx, QWidget* parent) : QGLWidget(ctx, parent)
400 {
401 setAttribute(Qt::WA_PaintOnScreen);
402 setAttribute(Qt::WA_NoSystemBackground);
403 setAttribute(Qt::WA_OpaquePaintEvent);
404 }
405
406protected:
407 virtual void initializeGL()
408 {
409 qDebug() << "It appears this is never called?";
410 Q_ASSERT(0);
411 qDebug() << "OpenGL supported version: " << QString((char*)glGetString(GL_VERSION));
412
413 QGLWidget::initializeGL();
414
415 qDebug() << "Current Context: " << this->format();
416 if (!format().stencil())
417 qWarning("Could not get stencil buffer; results will be suboptimal");
418 if (!format().depth())
419 qWarning("Could not get depth buffer; results will be suboptimal");
420 if (!format().doubleBuffer())
421 qWarning("Could not get double buffer; results will be suboptimal");
422 }
423
424};
425#endif
426
427
428StelMainView::StelMainView(QWidget* parent)
429 : QGraphicsView(parent), guiItem(NULL),
430 gui(NULL),510 gui(NULL),
511 stelApp(NULL),
512 updateQueued(false),
431 flagInvertScreenShotColors(false),513 flagInvertScreenShotColors(false),
432 flagOverwriteScreenshots(false),514 flagOverwriteScreenshots(false),
433 screenShotPrefix("stellarium-"),515 screenShotPrefix("stellarium-"),
434 screenShotDir(""),516 screenShotDir(""),
435 cursorTimeout(-1.f), flagCursorTimeout(false), minFpsTimer(NULL), maxfps(10000.f)517 cursorTimeout(-1.f), flagCursorTimeout(false), maxfps(10000.f)
436{518{
519 setAttribute(Qt::WA_OpaquePaintEvent);
520 setAutoFillBackground(false);
521
522 configuration = settings;
437 StelApp::initStatic();523 StelApp::initStatic();
524
525 minFpsTimer = new QTimer(this);
526 minFpsTimer->setTimerType(Qt::PreciseTimer);
527 minFpsTimer->setInterval(1000/minfps);
528 connect(minFpsTimer,SIGNAL(timeout()),this,SLOT(minFPSUpdate()));
438 529
439 // Can't create 2 StelMainView instances530 // Can't create 2 StelMainView instances
440 Q_ASSERT(!singleton);531 Q_ASSERT(!singleton);
@@ -444,83 +535,48 @@
444 initTitleI18n();535 initTitleI18n();
445 setObjectName("Mainview");536 setObjectName("Mainview");
446537
447 // Allows for precise FPS control
448 setViewportUpdateMode(QGraphicsView::NoViewportUpdate);538 setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
449 setFrameShape(QFrame::NoFrame);539 setFrameShape(QFrame::NoFrame);
450 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);540 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
451 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);541 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
452 setFocusPolicy(Qt::StrongFocus);542 //because we only want child elements to have focus, we turn it off here
543 setFocusPolicy(Qt::NoFocus);
453 connect(this, SIGNAL(screenshotRequested()), this, SLOT(doScreenshot()));544 connect(this, SIGNAL(screenshotRequested()), this, SLOT(doScreenshot()));
454545
455 lastEventTimeSec = 0;546 lastEventTimeSec = 0;
456547
457548#ifdef OPENGL_DEBUG_LOGGING
458#if STEL_USE_NEW_OPENGL_WIDGETS549 glLogger = new QOpenGLDebugLogger(this);
459 // Primary test for OpenGL existence550 connect(glLogger, SIGNAL(messageLogged(QOpenGLDebugMessage)), this, SLOT(logGLMessage(QOpenGLDebugMessage)));
460 if (QSurfaceFormat::defaultFormat().majorVersion() < 2)551#endif
461 {552
462 qWarning() << "No OpenGL 2 support on this system. Aborting.";553 // VSync control
463 QMessageBox::critical(0, "Stellarium", q_("No OpenGL 2 found on this system. Please upgrade hardware or use MESA or an older version."), QMessageBox::Abort, QMessageBox::Abort);554 bool vsync = configuration->value("video/vsync", true).toBool();
464 exit(0);555#if QT_VERSION >= QT_VERSION_CHECK(5,4,0)
465 }556 // with the QOpenGLWidget, this seems to be needed on the default surface format before creating any windows
466557 QSurfaceFormat defFmt = QSurfaceFormat::defaultFormat();
467 //QSurfaceFormat format();558 defFmt.setSwapInterval(vsync);
468 //// TBD: What options shall be default?559 QSurfaceFormat::setDefaultFormat(defFmt);
469 //QSurfaceFormat::setDefaultFormat(format);560#endif
470 ////QOpenGLContext* context=new QOpenGLContext::create();561
471 glWidget = new StelQOpenGLWidget(this);562 QSurfaceFormat widgetFormat = getDesiredGLFormat();
472 //glWidget->setFormat(format);563 widgetFormat.setSwapInterval(vsync);
564 glWidget = new StelGLWidget(this);
565 //Set the surface format BEFORE showing the widget
566 //We could also set this as default format instead of just the widget's format,
567 //but I don't know if some background Qt stuff needs another buffer configuration or something,
568 //so let's be safe and just set it here
569#ifdef USE_OLD_QGLWIDGET
570 glWidget->setFormat(QGLFormat::fromSurfaceFormat(widgetFormat));
473#else571#else
474 // Primary test for OpenGL existence572 glWidget->setFormat(widgetFormat);
475 if (QGLFormat::openGLVersionFlags() < QGLFormat::OpenGL_Version_2_1)
476 {
477 qWarning() << "No OpenGL 2.1 support on this system. Aborting.";
478 QMessageBox::critical(0, "Stellarium", q_("No OpenGL 2 found on this system. Please upgrade hardware or use MESA or an older version."), QMessageBox::Abort, QMessageBox::Abort);
479 exit(1);
480 }
481
482 // Create an openGL viewport
483 QGLFormat glFormat(QGL::StencilBuffer | QGL::DepthBuffer | QGL::DoubleBuffer);
484 // Even if setting a version here, it may not be accepted in StelQGLWidget()!
485 // Currently, not setting a version explicitly works on Windows and Linux.
486 // Apparently some Macs have problems however and default to 2.1.
487 // We try a new CLI flag here which requests 3.3 Compatibiliy Profile which modern Macs should deliver.
488 // OpenGL Specs say this will deliver at least the requested version, if possible.
489 // TBD: Maybe this must make a differentiation between OpenGL and OpenGL ES!
490 // TBD: If this works for Mac, it should be requested on all Macs without CLI option!
491 if (qApp->property("onetime_compat33")==true)
492 {
493 if (!(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_3_3))
494 {
495 qWarning() << "No OpenGL 3.3 found here. We will get whatever is available.";
496 qDebug() << "FYI: OpenGL Versions Supported: " << QGLFormat::openGLVersionFlags();
497 }
498 glFormat.setVersion(3, 3);
499 glFormat.setProfile(QGLFormat::CompatibilityProfile);
500 }
501 QGLContext* context=new QGLContext(glFormat);
502
503 if (context->format() != glFormat)
504 {
505 qWarning() << "Cannot provide requested OpenGL format. Apparently insufficient OpenGL resources on this system.";
506 QMessageBox::critical(0, "Stellarium", q_("Cannot acquire necessary OpenGL resources."), QMessageBox::Abort, QMessageBox::Abort);
507 exit(1);
508 }
509 glWidget = new StelQGLWidget(context, this);
510 if (qApp->property("onetime_compat33")==true)
511 {
512 // This may not return the version number set previously!
513 qDebug() << "StelQGLWidget context format version:" << glWidget->context()->format().majorVersion() << "." << glWidget->context()->format().minorVersion();
514 qDebug() << "StelQGLWidget has CompatibilityProfile:" << (glWidget->context()->format().profile()==QGLFormat::CompatibilityProfile ? "yes" : "no") << "(" <<glWidget->context()->format().profile() << ")";
515 }
516#endif573#endif
517
518 setViewport(glWidget);574 setViewport(glWidget);
519575
520 setScene(new QGraphicsScene(this));576 stelScene = new StelGraphicsScene(this);
577 setScene(stelScene);
521 scene()->setItemIndexMethod(QGraphicsScene::NoIndex);578 scene()->setItemIndexMethod(QGraphicsScene::NoIndex);
522 rootItem = new QGraphicsWidget();579 rootItem = new StelRootItem(this);
523 rootItem->setFocusPolicy(Qt::NoFocus);
524580
525 // Workaround (see Bug #940638) Although we have already explicitly set581 // Workaround (see Bug #940638) Although we have already explicitly set
526 // LC_NUMERIC to "C" in main.cpp there seems to be a bug in OpenGL where582 // LC_NUMERIC to "C" in main.cpp there seems to be a bug in OpenGL where
@@ -529,79 +585,157 @@
529 // circumstances, so here we set it again just to be on the safe side.585 // circumstances, so here we set it again just to be on the safe side.
530 setlocale(LC_NUMERIC, "C");586 setlocale(LC_NUMERIC, "C");
531 // End workaround587 // End workaround
588
589#ifdef USE_OLD_QGLWIDGET
590 // StelGLWidget::initializeGL is seemingly never called automatically with the QGLWidget, so we have to do it ourselves
591 //we have to force context creation here
592 glWidget->makeCurrent();
593 glWidget->initializeGL();
594#endif
532}595}
533596
534void StelMainView::resizeEvent(QResizeEvent* event)597void StelMainView::resizeEvent(QResizeEvent* event)
535{598{
536 scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));599 if(scene())
537 rootItem->setGeometry(0,0,event->size().width(),event->size().height());600 {
601 const QSize& sz = event->size();
602 scene()->setSceneRect(QRect(QPoint(0, 0), sz));
603 rootItem->setSize(sz);
604 if(guiItem)
605 guiItem->setGeometry(QRectF(0.0f,0.0f,sz.width(),sz.height()));
606 }
538 QGraphicsView::resizeEvent(event);607 QGraphicsView::resizeEvent(event);
539}608}
540609
541void StelMainView::focusSky() {610void StelMainView::focusSky() {
542 scene()->setActiveWindow(0);611 //scene()->setActiveWindow(0);
543 skyItem->setFocus();612 rootItem->setFocus();
544}613}
545614
546StelMainView::~StelMainView()615StelMainView::~StelMainView()
547{616{
617 //delete the night view graphic effect here while GL context is still valid
618 rootItem->setGraphicsEffect(Q_NULLPTR);
548 StelApp::deinitStatic();619 StelApp::deinitStatic();
549}620}
550621
551void StelMainView::init(QSettings* conf)622QSurfaceFormat StelMainView::getDesiredGLFormat() const
552{623{
624#if QT_VERSION < QT_VERSION_CHECK(5,4,0)
625 //default-constructed format
626 QSurfaceFormat fmt;
627#else
628 //use the default format as basis
629 QSurfaceFormat fmt = QSurfaceFormat::defaultFormat();
630 qDebug()<<"Default surface format: "<<fmt;
631#endif
632
633 //if on an GLES build, do not set the format
634#ifndef QT_OPENGL_ES_2
635 // OGL 2.1 + FBOs should basically be the minimum required for Stellarium
636 fmt.setRenderableType(QSurfaceFormat::OpenGL);
637 fmt.setMajorVersion(2);
638 fmt.setMinorVersion(1);
639
640 // The following is NOT needed (or even supported) when we request a 2.1 context
641 // The implementation may give us a newer context,
642 // but compatibility with 2.1 should be ensured automatically
643 //fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
644 //fmt.setOption(QSurfaceFormat::DeprecatedFunctions);
645#endif
646
647 //request some sane buffer formats
648 fmt.setRedBufferSize(8);
649 fmt.setGreenBufferSize(8);
650 fmt.setBlueBufferSize(8);
651 fmt.setAlphaBufferSize(8);
652 fmt.setDepthBufferSize(24);
653 //I dont think we use the stencil buffer for anything
654 //but maybe Qt needs it
655 fmt.setStencilBufferSize(8);
656
657#ifdef OPENGL_DEBUG_LOGGING
658 //try to enable GL debugging using GL_KHR_debug
659 fmt.setOption(QSurfaceFormat::DebugContext);
660#endif
661 //vsync needs to be set on the default format for it to work
662 //fmt.setSwapInterval(0);
663
664 qDebug()<<"Desired surface format: "<<fmt;
665 return fmt;
666}
667
668void StelMainView::init()
669{
670#ifdef OPENGL_DEBUG_LOGGING
671 if(!QOpenGLContext::currentContext()->hasExtension(QByteArrayLiteral("GL_KHR_debug")))
672 qWarning()<<"GL_KHR_debug extension missing, OpenGL debug logger will likely not work";
673 if(glLogger->initialize())
674 {
675 qDebug()<<"OpenGL debug logger initialized";
676 QVector<GLuint> disabledMsgs;
677 //if your GL implementation spams some output you are not interested in,
678 //you can disable their message IDs here
679 //disabledMsgs.append(100);
680 glLogger->disableMessages(disabledMsgs);
681 glLogger->startLogging(QOpenGLDebugLogger::SynchronousLogging);
682 //the internal log buffer may not be empty, so check it
683 foreach(const QOpenGLDebugMessage& msg, glLogger->loggedMessages())
684 {
685 logGLMessage(msg);
686 }
687 }
688 else
689 qWarning()<<"Failed to initialize OpenGL debug logger";
690
691 connect(QOpenGLContext::currentContext(),SIGNAL(aboutToBeDestroyed()),this,SLOT(contextDestroyed()));
692 //for easier debugging, print the adress of the main GL context
693 qDebug()<<"CurCtxPtr:"<<QOpenGLContext::currentContext();
694#endif
695
696 qDebug()<<"StelMainView::init";
697
698 glInfo.mainContext = QOpenGLContext::currentContext();
699 glInfo.functions = glInfo.mainContext->functions();
700 glInfo.vendor = QString(reinterpret_cast<const char*>(glInfo.functions->glGetString(GL_VENDOR)));
701 glInfo.renderer = QString(reinterpret_cast<const char*>(glInfo.functions->glGetString(GL_RENDERER)));
702
553 gui = new StelGui();703 gui = new StelGui();
554704
555#if STEL_USE_NEW_OPENGL_WIDGETS705 QSettings* conf = configuration;
556 //glWidget->initializeGL(); // protected...
557 //Q_ASSERT(glWidget->isValid());
558#else
559 Q_ASSERT(glWidget->isValid());
560 glWidget->makeCurrent();
561#endif
562706
563 // Should be check of requirements disabled?707 // Should be check of requirements disabled?
564 if (conf->value("main/check_requirements", true).toBool())708 if (conf->value("main/check_requirements", true).toBool())
565 {709 {
566 // Find out lots of debug info about supported version of OpenGL and vendor/renderer.710 // Find out lots of debug info about supported version of OpenGL and vendor/renderer.
567 processOpenGLdiagnosticsAndWarnings(conf, glWidget);711 processOpenGLdiagnosticsAndWarnings(conf, QOpenGLContext::currentContext());
568 }712 }
569713
570714 //create and initialize main app
571 stelApp= new StelApp();715 stelApp = new StelApp(this);
572 stelApp->setGui(gui);716 stelApp->setGui(gui);
573717
574 stelApp->init(conf);718 stelApp->init(conf);
719 //this makes sure the app knows how large the window is
720 connect(stelScene,SIGNAL(sceneRectChanged(QRectF)),stelApp,SLOT(glWindowHasBeenResized(QRectF)));
721 //also immediately set the current values
722 stelApp->glWindowHasBeenResized(stelScene->sceneRect());
723
575 StelActionMgr *actionMgr = stelApp->getStelActionManager();724 StelActionMgr *actionMgr = stelApp->getStelActionManager();
576 actionMgr->addAction("actionSave_Screenshot_Global", N_("Miscellaneous"), N_("Save screenshot"), this, "saveScreenShot()", "Ctrl+S");725 actionMgr->addAction("actionSave_Screenshot_Global", N_("Miscellaneous"), N_("Save screenshot"), this, "saveScreenShot()", "Ctrl+S");
577 actionMgr->addAction("actionSet_Full_Screen_Global", N_("Display Options"), N_("Full-screen mode"), this, "fullScreen", "F11");726 actionMgr->addAction("actionSet_Full_Screen_Global", N_("Display Options"), N_("Full-screen mode"), this, "fullScreen", "F11");
578 727
579 StelPainter::initGLShaders();728 StelPainter::initGLShaders();
580729
581 skyItem = new StelSkyItem();730 guiItem = new StelGuiItem(rootItem);
582 guiItem = new StelGuiItem();
583 QGraphicsAnchorLayout* l = new QGraphicsAnchorLayout(rootItem);
584 l->setSpacing(0);
585 l->setContentsMargins(0,0,0,0);
586 l->addCornerAnchors(skyItem, Qt::TopLeftCorner, l, Qt::TopLeftCorner);
587 l->addCornerAnchors(skyItem, Qt::BottomRightCorner, l, Qt::BottomRightCorner);
588 l->addCornerAnchors(guiItem, Qt::BottomLeftCorner, l, Qt::BottomLeftCorner);
589 l->addCornerAnchors(guiItem, Qt::TopRightCorner, l, Qt::TopRightCorner);
590 rootItem->setLayout(l);
591 scene()->addItem(rootItem);731 scene()->addItem(rootItem);
732 //set the default focus to the sky
733 focusSky();
592 nightModeEffect = new NightModeGraphicsEffect(this);734 nightModeEffect = new NightModeGraphicsEffect(this);
593 updateNightModeProperty(StelApp::getInstance().getVisionModeNight());735 updateNightModeProperty(StelApp::getInstance().getVisionModeNight());
736 //install the effect on the whole view
594 rootItem->setGraphicsEffect(nightModeEffect);737 rootItem->setGraphicsEffect(nightModeEffect);
595738
596 QSize size = glWidget->windowHandle()->screen()->size();
597 size = QSize(conf->value("video/screen_w", size.width()).toInt(),
598 conf->value("video/screen_h", size.height()).toInt());
599
600 bool fullscreen = conf->value("video/fullscreen", true).toBool();
601
602 // Without this, the screen is not shown on a Mac + we should use resize() for correct work of fullscreen/windowed mode switch. --AW WTF???
603 resize(size);
604
605 QDesktopWidget *desktop = QApplication::desktop();739 QDesktopWidget *desktop = QApplication::desktop();
606 int screen = conf->value("video/screen_number", 0).toInt();740 int screen = conf->value("video/screen_number", 0).toInt();
607 if (screen < 0 || screen >= desktop->screenCount())741 if (screen < 0 || screen >= desktop->screenCount())
@@ -611,6 +745,14 @@
611 }745 }
612 QRect screenGeom = desktop->screenGeometry(screen);746 QRect screenGeom = desktop->screenGeometry(screen);
613747
748 QSize size = QSize(conf->value("video/screen_w", screenGeom.width()).toInt(),
749 conf->value("video/screen_h", screenGeom.height()).toInt());
750
751 bool fullscreen = conf->value("video/fullscreen", true).toBool();
752
753 // Without this, the screen is not shown on a Mac + we should use resize() for correct work of fullscreen/windowed mode switch. --AW WTF???
754 resize(size);
755
614 if (fullscreen)756 if (fullscreen)
615 {757 {
616 // The "+1" below is to work around Linux/Gnome problem with mouse focus.758 // The "+1" below is to work around Linux/Gnome problem with mouse focus.
@@ -632,26 +774,23 @@
632 flagInvertScreenShotColors = conf->value("main/invert_screenshots_colors", false).toBool();774 flagInvertScreenShotColors = conf->value("main/invert_screenshots_colors", false).toBool();
633 setFlagCursorTimeout(conf->value("gui/flag_mouse_cursor_timeout", false).toBool());775 setFlagCursorTimeout(conf->value("gui/flag_mouse_cursor_timeout", false).toBool());
634 setCursorTimeout(conf->value("gui/mouse_cursor_timeout", 10.f).toFloat());776 setCursorTimeout(conf->value("gui/mouse_cursor_timeout", 10.f).toFloat());
635 maxfps = conf->value("video/maximum_fps",10000.f).toFloat();777 setMaxFps(conf->value("video/maximum_fps",10000.f).toFloat());
636 minfps = conf->value("video/minimum_fps",10000.f).toFloat();778 setMinFps(conf->value("video/minimum_fps",10000.f).toFloat());
637 flagMaxFpsUpdatePending = false;
638779
639 // XXX: This should be done in StelApp::init(), unfortunately for the moment we need to init the gui before the780 // XXX: This should be done in StelApp::init(), unfortunately for the moment we need to init the gui before the
640 // plugins, because the gui creates the QActions needed by some plugins.781 // plugins, because the gui creates the QActions needed by some plugins.
641 StelApp::getInstance().initPlugIns();782 stelApp->initPlugIns();
642
643 // activate DE430/431
644 StelApp::getInstance().getCore()->initEphemeridesFunctions();
645783
646 // The script manager can only be fully initialized after the plugins have loaded.784 // The script manager can only be fully initialized after the plugins have loaded.
647 StelApp::getInstance().initScriptMgr();785 stelApp->initScriptMgr();
648786
649 // Set the global stylesheet, this is only useful for the tooltips.787 // Set the global stylesheet, this is only useful for the tooltips.
650 StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());788 StelGui* gui = dynamic_cast<StelGui*>(stelApp->getGui());
651 if (gui!=NULL)789 if (gui!=NULL)
652 setStyleSheet(gui->getStelStyle().qtStyleSheet);790 setStyleSheet(gui->getStelStyle().qtStyleSheet);
653 connect(&StelApp::getInstance(), SIGNAL(visionNightModeChanged(bool)), this, SLOT(updateNightModeProperty(bool)));791 connect(stelApp, SIGNAL(visionNightModeChanged(bool)), this, SLOT(updateNightModeProperty(bool)));
654792
793 // I doubt this will have any effect on framerate, but may cause problems elsewhere?
655 QThread::currentThread()->setPriority(QThread::HighestPriority);794 QThread::currentThread()->setPriority(QThread::HighestPriority);
656#ifndef NDEBUG795#ifndef NDEBUG
657 // Get an overview of module callOrders796 // Get an overview of module callOrders
@@ -664,7 +803,6 @@
664 StelApp::getInstance().dumpModuleActionPriorities(StelModule::ActionHandleKeys);803 StelApp::getInstance().dumpModuleActionPriorities(StelModule::ActionHandleKeys);
665 }804 }
666#endif805#endif
667 startMainLoop();
668}806}
669807
670void StelMainView::updateNightModeProperty(bool b)808void StelMainView::updateNightModeProperty(bool b)
@@ -680,17 +818,11 @@
680// If problems are detected, warn the user one time, but continue. Warning panel will be suppressed on next start.818// If problems are detected, warn the user one time, but continue. Warning panel will be suppressed on next start.
681// Work in progress, as long as we get reports about bad systems or until OpenGL startup is finalized and safe.819// Work in progress, as long as we get reports about bad systems or until OpenGL startup is finalized and safe.
682// Several tests do not apply to MacOS X.820// Several tests do not apply to MacOS X.
683#if STEL_USE_NEW_OPENGL_WIDGETS821void StelMainView::processOpenGLdiagnosticsAndWarnings(QSettings *conf, QOpenGLContext *context) const
684 void StelMainView::processOpenGLdiagnosticsAndWarnings(QSettings *conf, StelQOpenGLWidget* glWidget) const
685#else
686 void StelMainView::processOpenGLdiagnosticsAndWarnings(QSettings *conf, StelQGLWidget* glWidget) const
687#endif
688{822{
689#ifdef Q_OS_MAC823#ifdef Q_OS_MAC
690 Q_UNUSED(conf);824 Q_UNUSED(conf);
691#endif825#endif
692
693 QOpenGLContext* context=glWidget->context()->contextHandle();
694 QSurfaceFormat format=context->format();826 QSurfaceFormat format=context->format();
695827
696 // These tests are not required on MacOS X828 // These tests are not required on MacOS X
@@ -706,12 +838,13 @@
706 qDebug() << "Neither OpenGL nor OpenGL ES detected: Unsupported Format!";838 qDebug() << "Neither OpenGL nor OpenGL ES detected: Unsupported Format!";
707 }839 }
708#endif840#endif
841 QOpenGLFunctions* gl = context->functions();
709842
710 QString glDriver(reinterpret_cast<const char*>(glGetString(GL_VERSION)));843 QString glDriver(reinterpret_cast<const char*>(gl->glGetString(GL_VERSION)));
711 qDebug() << "Driver version string:" << glDriver;844 qDebug() << "Driver version string:" << glDriver;
712 qDebug() << "GL vendor is" << QString(reinterpret_cast<const char*>(glGetString(GL_VENDOR)));845 qDebug() << "GL vendor is" << QString(reinterpret_cast<const char*>(gl->glGetString(GL_VENDOR)));
713 QString glRenderer(reinterpret_cast<const char*>(glGetString(GL_RENDERER)));846 QString glRenderer(reinterpret_cast<const char*>(gl->glGetString(GL_RENDERER)));
714 qDebug() << "GL renderer is" << glRenderer; 847 qDebug() << "GL renderer is" << glRenderer;
715848
716 // Minimal required version of OpenGL for Qt5 is 2.1 and OpenGL Shading Language may be 1.20 (or OpenGL ES is 2.0 and GLSL ES is 1.0).849 // Minimal required version of OpenGL for Qt5 is 2.1 and OpenGL Shading Language may be 1.20 (or OpenGL ES is 2.0 and GLSL ES is 1.0).
717 // As of V0.13.0..1, we use GLSL 1.10/GLSL ES 1.00 (implicitly, by omitting a #version line), but in case of using ANGLE we need hardware850 // As of V0.13.0..1, we use GLSL 1.10/GLSL ES 1.00 (implicitly, by omitting a #version line), but in case of using ANGLE we need hardware
@@ -739,7 +872,7 @@
739 qWarning() << "Oops... Insufficient OpenGL version. Mesa failed! Please send a bug report.";872 qWarning() << "Oops... Insufficient OpenGL version. Mesa failed! Please send a bug report.";
740873
741 QMessageBox::critical(0, "Stellarium", q_("Insufficient OpenGL version. Please update drivers, graphics hardware, or use --angle-mode (or --mesa-mode) option."), QMessageBox::Abort, QMessageBox::Abort);874 QMessageBox::critical(0, "Stellarium", q_("Insufficient OpenGL version. Please update drivers, graphics hardware, or use --angle-mode (or --mesa-mode) option."), QMessageBox::Abort, QMessageBox::Abort);
742 #else 875 #else
743 qWarning() << "Oops... Insufficient OpenGL version. Please update drivers, or graphics hardware.";876 qWarning() << "Oops... Insufficient OpenGL version. Please update drivers, or graphics hardware.";
744 QMessageBox::critical(0, "Stellarium", q_("Insufficient OpenGL version. Please update drivers, or graphics hardware."), QMessageBox::Abort, QMessageBox::Abort);877 QMessageBox::critical(0, "Stellarium", q_("Insufficient OpenGL version. Please update drivers, or graphics hardware."), QMessageBox::Abort, QMessageBox::Abort);
745 #endif878 #endif
@@ -747,7 +880,7 @@
747 }880 }
748#endif881#endif
749 // This call requires OpenGL2+.882 // This call requires OpenGL2+.
750 QString glslString(reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));883 QString glslString(reinterpret_cast<const char*>(gl->glGetString(GL_SHADING_LANGUAGE_VERSION)));
751 qDebug() << "GL Shading Language version is" << glslString;884 qDebug() << "GL Shading Language version is" << glslString;
752885
753 // Only give extended info if called on command line, for diagnostic.886 // Only give extended info if called on command line, for diagnostic.
@@ -1034,6 +1167,7 @@
10341167
1035void StelMainView::deinit()1168void StelMainView::deinit()
1036{1169{
1170 glContextMakeCurrent();
1037 deinitGL();1171 deinitGL();
1038 delete stelApp;1172 delete stelApp;
1039 stelApp = NULL;1173 stelApp = NULL;
@@ -1057,7 +1191,7 @@
1057 // Therefore moving is not possible. We must move to the stored position or at least defaults.1191 // Therefore moving is not possible. We must move to the stored position or at least defaults.
1058 if ( (x()<0) && (y()<0))1192 if ( (x()<0) && (y()<0))
1059 {1193 {
1060 QSettings *conf = StelApp::getInstance().getSettings();1194 QSettings *conf = stelApp->getSettings();
1061 QDesktopWidget *desktop = QApplication::desktop();1195 QDesktopWidget *desktop = QApplication::desktop();
1062 int screen = conf->value("video/screen_number", 0).toInt();1196 int screen = conf->value("video/screen_number", 0).toInt();
1063 if (screen < 0 || screen >= desktop->screenCount())1197 if (screen < 0 || screen >= desktop->screenCount())
@@ -1074,118 +1208,66 @@
1074 emit fullScreenChanged(b);1208 emit fullScreenChanged(b);
1075}1209}
10761210
1077void StelMainView::updateScene() {1211void StelMainView::drawEnded()
1078 // For some reason the skyItem is not updated when the night mode shader is on.1212{
1079 // To fix this we manually do it here.1213 updateQueued = false;
1080 skyItem->update();1214
1081 scene()->update();1215 //requeue the next draw
1082}1216 if(needsMaxFPS())
1217 {
1218 updateQueued = true;
1219 minFpsTimer->stop();
1220 glWidget->update();
1221 }
1222 else
1223 {
1224 if(!minFpsTimer->isActive())
1225 minFpsTimer->start();
1226 }
1227}
1228
1229void StelMainView::minFPSUpdate()
1230{
1231 if(!updateQueued)
1232 {
1233 updateQueued = true;
1234 //qDebug()<<"minFPSUpdate";
1235 glWidget->update();
1236 }
1237 else
1238 {
1239 //qDebug()<<"double update";
1240 }
1241}
1242
1243#ifdef OPENGL_DEBUG_LOGGING
1244void StelMainView::logGLMessage(const QOpenGLDebugMessage &debugMessage)
1245{
1246 qDebug()<<debugMessage;
1247}
1248
1249void StelMainView::contextDestroyed()
1250{
1251 qDebug()<<"Main OpenGL context destroyed";
1252}
1253#endif
10831254
1084void StelMainView::thereWasAnEvent()1255void StelMainView::thereWasAnEvent()
1085{1256{
1257 //qDebug()<<"event";
1086 lastEventTimeSec = StelApp::getTotalRunTime();1258 lastEventTimeSec = StelApp::getTotalRunTime();
1087}1259}
10881260
1089void StelMainView::maxFpsSceneUpdate()1261bool StelMainView::needsMaxFPS() const
1090{
1091 updateScene();
1092 flagMaxFpsUpdatePending = false;
1093}
1094
1095void StelMainView::drawBackground(QPainter*, const QRectF&)
1096{1262{
1097 const double now = StelApp::getTotalRunTime();1263 const double now = StelApp::getTotalRunTime();
1098 const double JD_SECOND=0.000011574074074074074074;
10991264
1100 // Determines when the next display will need to be triggered1265 // Determines when the next display will need to be triggered
1101 // The current policy is that after an event, the FPS is maximum for 2.5 seconds1266 // The current policy is that after an event, the FPS is maximum for 2.5 seconds
1102 // after that, it switches back to the default minfps value to save power.1267 // after that, it switches back to the default minfps value to save power.
1103 // The fps is also kept to max if the timerate is higher than normal speed.1268 // The fps is also kept to max if the timerate is higher than normal speed.
1104 const float timeRate = StelApp::getInstance().getCore()->getTimeRate();1269 const float timeRate = stelApp->getCore()->getTimeRate();
1105 const bool needMaxFps = (now - lastEventTimeSec < 2.5) || fabs(timeRate) > JD_SECOND;1270 return (now - lastEventTimeSec < 2.5) || fabs(timeRate) > StelCore::JD_SECOND;
1106 if (needMaxFps)
1107 {
1108 if (!flagMaxFpsUpdatePending)
1109 {
1110 double duration = 1./getMaxFps();
1111 int dur = (int)(duration*1000);
1112
1113 if (minFpsTimer!=NULL)
1114 {
1115 disconnect(minFpsTimer, SIGNAL(timeout()), 0, 0);
1116 delete minFpsTimer;
1117 minFpsTimer = NULL;
1118 }
1119 flagMaxFpsUpdatePending = true;
1120 QTimer::singleShot(dur<5 ? 5 : dur, this, SLOT(maxFpsSceneUpdate()));
1121 }
1122 } else if (minFpsTimer == NULL) {
1123 // Restart the minfps timer
1124 minFpsChanged();
1125 }
1126
1127 // Manage cursor timeout
1128 if (cursorTimeout>0.f && (now-lastEventTimeSec>cursorTimeout) && flagCursorTimeout)
1129 {
1130 if (QGuiApplication::overrideCursor()==0)
1131 QGuiApplication::setOverrideCursor(Qt::BlankCursor);
1132 }
1133 else
1134 {
1135 if (QGuiApplication::overrideCursor()!=0)
1136 QGuiApplication::restoreOverrideCursor();
1137 }
1138}
1139
1140void StelMainView::startMainLoop()
1141{
1142 // Set a timer refreshing for every minfps frames
1143 minFpsChanged();
1144}
1145
1146void StelMainView::minFpsChanged()
1147{
1148 if (minFpsTimer!=NULL)
1149 {
1150 disconnect(minFpsTimer, SIGNAL(timeout()), 0, 0);
1151 delete minFpsTimer;
1152 minFpsTimer = NULL;
1153 }
1154
1155 minFpsTimer = new QTimer(this);
1156 connect(minFpsTimer, SIGNAL(timeout()), this, SLOT(updateScene()));
1157
1158 minFpsTimer->start((int)(1./getMinFps()*1000.));
1159}
1160
1161
1162
1163void StelMainView::mouseMoveEvent(QMouseEvent* event)
1164{
1165 // We notify the application to increase the fps if a button has been
1166 // clicked, but also if the cursor is currently hidden, so that it gets
1167 // restored.
1168 if (event->buttons() || QGuiApplication::overrideCursor()!=0)
1169 thereWasAnEvent(); // Refresh screen ASAP
1170 QGraphicsView::mouseMoveEvent(event);
1171}
1172
1173void StelMainView::mousePressEvent(QMouseEvent* event)
1174{
1175 thereWasAnEvent(); // Refresh screen ASAP
1176 QGraphicsView::mousePressEvent(event);
1177}
1178
1179void StelMainView::mouseReleaseEvent(QMouseEvent* event)
1180{
1181 thereWasAnEvent(); // Refresh screen ASAP
1182 QGraphicsView::mouseReleaseEvent(event);
1183}
1184
1185void StelMainView::wheelEvent(QWheelEvent* event)
1186{
1187 thereWasAnEvent(); // Refresh screen ASAP
1188 QGraphicsView::wheelEvent(event);
1189}1271}
11901272
1191void StelMainView::moveEvent(QMoveEvent * event)1273void StelMainView::moveEvent(QMoveEvent * event)
@@ -1193,38 +1275,21 @@
1193 Q_UNUSED(event);1275 Q_UNUSED(event);
11941276
1195 // We use the glWidget instead of the event, as we want the screen that shows most of the widget.1277 // We use the glWidget instead of the event, as we want the screen that shows most of the widget.
1196 StelApp::getInstance().setDevicePixelsPerPixel(glWidget->windowHandle()->devicePixelRatio());1278 QWindow* win = glWidget->windowHandle();
1279 if(win)
1280 stelApp->setDevicePixelsPerPixel(win->devicePixelRatio());
1197}1281}
11981282
1199void StelMainView::closeEvent(QCloseEvent* event)1283void StelMainView::closeEvent(QCloseEvent* event)
1200{1284{
1201 Q_UNUSED(event);1285 Q_UNUSED(event);
1202 StelApp::getInstance().quit();1286 stelApp->quit();
1203}1287}
1204
1205void StelMainView::keyPressEvent(QKeyEvent* event)
1206{
1207 thereWasAnEvent(); // Refresh screen ASAP
1208 // Try to trigger a gobal shortcut.
1209 StelActionMgr* actionMgr = StelApp::getInstance().getStelActionManager();
1210 if (actionMgr->pushKey(event->key() + event->modifiers(), true)) {
1211 event->setAccepted(true);
1212 return;
1213 }
1214 QGraphicsView::keyPressEvent(event);
1215}
1216
1217void StelMainView::keyReleaseEvent(QKeyEvent* event)
1218{
1219 thereWasAnEvent(); // Refresh screen ASAP
1220 QGraphicsView::keyReleaseEvent(event);
1221}
1222
12231288
1224//! Delete openGL textures (to call before the GLContext disappears)1289//! Delete openGL textures (to call before the GLContext disappears)
1225void StelMainView::deinitGL()1290void StelMainView::deinitGL()
1226{1291{
1227 StelApp::getInstance().deinit();1292 stelApp->deinit();
1228 delete gui;1293 delete gui;
1229 gui = NULL;1294 gui = NULL;
1230}1295}
@@ -1240,11 +1305,12 @@
1240void StelMainView::doScreenshot(void)1305void StelMainView::doScreenshot(void)
1241{1306{
1242 QFileInfo shotDir;1307 QFileInfo shotDir;
1243#if STEL_USE_NEW_OPENGL_WIDGETS1308#ifdef USE_OLD_QGLWIDGET
1309 QImage im = glWidget->grabFrameBuffer();
1310#else
1244 QImage im = glWidget->grabFramebuffer();1311 QImage im = glWidget->grabFramebuffer();
1245#else
1246 QImage im = glWidget->grabFrameBuffer();
1247#endif1312#endif
1313
1248 if (flagInvertScreenShotColors)1314 if (flagInvertScreenShotColors)
1249 im.invertPixels();1315 im.invertPixels();
12501316
@@ -1289,7 +1355,21 @@
1289 return glWidget->mapFromGlobal(QCursor::pos());1355 return glWidget->mapFromGlobal(QCursor::pos());
1290}1356}
12911357
1292void StelMainView::setFocusOnSky()1358QOpenGLContext* StelMainView::glContext() const
1293{1359{
1294 skyItem->setFocus();1360#ifdef USE_OLD_QGLWIDGET
1361 return glWidget->context()->contextHandle();
1362#else
1363 return glWidget->context();
1364#endif
1365}
1366
1367void StelMainView::glContextMakeCurrent()
1368{
1369 glWidget->makeCurrent();
1370}
1371
1372void StelMainView::glContextDoneCurrent()
1373{
1374 glWidget->doneCurrent();
1295}1375}
12961376
=== modified file 'src/StelMainView.hpp'
--- src/StelMainView.hpp 2016-12-10 10:33:35 +0000
+++ src/StelMainView.hpp 2017-01-12 21:08:38 +0000
@@ -24,19 +24,13 @@
24#include <QGraphicsView>24#include <QGraphicsView>
25#include <QEventLoop>25#include <QEventLoop>
26#include <QOpenGLContext>26#include <QOpenGLContext>
2727#include <QTimer>
28// This define (only used here and in StelMainView.cpp) is temporarily used28#ifdef OPENGL_DEBUG_LOGGING
29// to allow uncompromised compiling while the migration to the new QOpenGL... classes29#include <QOpenGLDebugMessage>
30// has not been done. As soon as Qt5.4 is out, we should finish this migration process!
31#define STEL_USE_NEW_OPENGL_WIDGETS 0
32
33#if STEL_USE_NEW_OPENGL_WIDGETS
34class QOpenGLWidget;
35class StelQOpenGLWidget;
36#else
37class QGLWidget;
38class StelQGLWidget;
39#endif30#endif
31
32class StelGLWidget;
33class StelGraphicsScene;
40class QMoveEvent;34class QMoveEvent;
41class QResizeEvent;35class QResizeEvent;
42class StelGuiBase;36class StelGuiBase;
@@ -49,16 +43,27 @@
49class StelMainView : public QGraphicsView43class StelMainView : public QGraphicsView
50{44{
51 friend class StelGuiItem;45 friend class StelGuiItem;
52 friend class StelSkyItem;46 friend class StelRootItem;
47 friend class StelGraphicsScene;
48 friend class NightModeGraphicsEffect;
53 Q_OBJECT49 Q_OBJECT
54 Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged)50 Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged)
5551
56public:52public:
57 StelMainView(QWidget* parent = NULL);53 //! Contains some basic info about the OpenGL context used
54 struct GLInfo
55 {
56 QString vendor;
57 QString renderer;
58 QOpenGLContext* mainContext;
59 QOpenGLFunctions* functions;
60 };
61
62 StelMainView(QSettings* settings);
58 virtual ~StelMainView();63 virtual ~StelMainView();
5964
60 //! Start the main initialization of Stellarium65 //! Start the main initialization of Stellarium
61 void init(class QSettings* conf);66 void init();
62 void deinit();67 void deinit();
6368
64 //! Set the application title for the current language.69 //! Set the application title for the current language.
@@ -70,20 +75,33 @@
7075
71 //! Delete openGL textures (to call before the GLContext disappears)76 //! Delete openGL textures (to call before the GLContext disappears)
72 void deinitGL();77 void deinitGL();
73 //! Return focus to the sky item. To be used when we close a dialog.78
74 void focusSky();
75 //! Return the parent gui widget, this should be used as parent to all79 //! Return the parent gui widget, this should be used as parent to all
76 //! the StelDialog instances.80 //! the StelDialog instances.
77 QGraphicsWidget* getGuiWidget() const {return guiItem;}81 QGraphicsWidget* getGuiWidget() const {return guiItem;}
78 //! Return mouse position coordinates82 //! Return mouse position coordinates
79 QPoint getMousePos();83 QPoint getMousePos();
84
85 //! Returns the main application OpenGL context,
86 //! which should be used for all drawing Stellarium does
87 //! @sa glContextMakeCurrent()
88 //! @sa glContextDoneCurrent()
89 QOpenGLContext* glContext() const;
90 //! Make the main GL context (the one returned from glContext()) current
91 //! on the main view surface
92 void glContextMakeCurrent();
93 //! Releases the main GL context
94 void glContextDoneCurrent();
95
96 //! Returns the information about the GL context, this does not require the context to be active.
97 GLInfo getGLInformation() const { return glInfo; }
80public slots:98public slots:
8199
82 //! Set whether fullscreen is activated or not100 //! Set whether fullscreen is activated or not
83 void setFullScreen(bool);101 void setFullScreen(bool);
84102
85 //! Set focus on the sky103 //! Return focus to the sky item. To be used when we close a dialog.
86 void setFocusOnSky();104 void focusSky();
87105
88 ///////////////////////////////////////////////////////////////////////////106 ///////////////////////////////////////////////////////////////////////////
89 // Specific methods107 // Specific methods
@@ -119,82 +137,86 @@
119 //! user events for some seconds to save power. However, if can be useful to set this to a high137 //! user events for some seconds to save power. However, if can be useful to set this to a high
120 //! value to improve playing smoothness in scripts.138 //! value to improve playing smoothness in scripts.
121 //! @param m the new minimum fps setting.139 //! @param m the new minimum fps setting.
122 void setMinFps(float m) {minfps=m; minFpsChanged();}140 void setMinFps(float m) {minfps=m; minFpsTimer->setInterval(1000/minfps);}
123 //! Get the current minimum frames per second.141 //! Get the current minimum frames per second.
124 float getMinFps() {return minfps;}142 float getMinFps() {return minfps;}
125 //! Set the maximum frames per second.143 //! Set the maximum frames per second.
126 //! @param m the new maximum fps setting.144 //! @param m the new maximum fps setting.
145 //! @todo this setting currently does nothing
127 void setMaxFps(float m) {maxfps = m;}146 void setMaxFps(float m) {maxfps = m;}
128 //! Get the current maximum frames per second.147 //! Get the current maximum frames per second.
129 float getMaxFps() {return maxfps;}148 float getMaxFps() {return maxfps;}
130149
131 void maxFpsSceneUpdate();
132 //! Updates the scene and process all events
133 void updateScene();
134
135 //! Notify that an event was handled by the program and therefore the150 //! Notify that an event was handled by the program and therefore the
136 //! FPS should be maximized for a couple of seconds.151 //! FPS should be maximized for a couple of seconds.
137 void thereWasAnEvent();152 void thereWasAnEvent();
138153
154 //! Determines if we should render as fast as possible,
155 //! or limit the FPS. This depends on the time the last user event
156 //! happened.
157 bool needsMaxFPS() const;
158
139protected:159protected:
140 virtual void mouseMoveEvent(QMouseEvent* event);160 //! Hack to determine current monitor pixel ratio
141 virtual void mousePressEvent(QMouseEvent* event);161 //! @todo Find a better way to handle this
142 virtual void mouseReleaseEvent(QMouseEvent* event);162 virtual void moveEvent(QMoveEvent* event) Q_DECL_OVERRIDE;
143 virtual void keyPressEvent(QKeyEvent* event);163 //! Handle window closed event, calling StelApp::quit()
144 virtual void keyReleaseEvent(QKeyEvent* event);164 virtual void closeEvent(QCloseEvent* event) Q_DECL_OVERRIDE;
145 virtual void wheelEvent(QWheelEvent* wheelEvent);165 //! Handle window resized events, and change the size of the underlying
146 virtual void moveEvent(QMoveEvent* event);166 //! QGraphicsScene to be the same
147 virtual void closeEvent(QCloseEvent* event);167 virtual void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE;
148 virtual void resizeEvent(QResizeEvent* event);
149
150 //! Update the mouse pointer state and schedule next redraw.
151 //! This method is called automatically by Qt.
152 virtual void drawBackground(QPainter* painter, const QRectF &rect);
153
154signals:168signals:
155 //! emitted when saveScreenShot is requested with saveScreenShot().169 //! emitted when saveScreenShot is requested with saveScreenShot().
156 //! doScreenshot() does the actual work (it has to do it in the main170 //! doScreenshot() does the actual work (it has to do it in the main
157 //! thread, where as saveScreenShot() might get called from another one.171 //! thread, where as saveScreenShot() might get called from another one.
172 //!
173 //! @remark FS: is threaded access here even a possibility anymore, or a remnant of older code?
158 void screenshotRequested(void);174 void screenshotRequested(void);
159 void fullScreenChanged(bool b);175 void fullScreenChanged(bool b);
160
161private slots:176private slots:
162 // Do the actual screenshot generation in the main thread with this method.177 // Do the actual screenshot generation in the main thread with this method.
163 void doScreenshot(void);178 void doScreenshot(void);
164 void minFpsChanged();179 void minFPSUpdate();
180#ifdef OPENGL_DEBUG_LOGGING
181 void logGLMessage(const QOpenGLDebugMessage& debugMessage);
182 void contextDestroyed();
183#endif
165 void updateNightModeProperty(bool b);184 void updateNightModeProperty(bool b);
166185
167private:186private:
168 //! Start the display loop187 //! The graphics scene notifies us when a draw finished, so that we can queue the next one
169 void startMainLoop();188 void drawEnded();
170 189 //! Returns the desired OpenGL format settings,
190 //! on desktop this corresponds to a GL 2.1 context,
191 //! with 32bit RGBA buffer and 24/8 depth/stencil buffer
192 QSurfaceFormat getDesiredGLFormat() const;
171 //! provide extended OpenGL diagnostics in logfile.193 //! provide extended OpenGL diagnostics in logfile.
172 void dumpOpenGLdiagnostics() const;194 void dumpOpenGLdiagnostics() const;
173 //! Startup diagnostics, providing test for various circumstances of bad OS/OpenGL driver combinations195 //! Startup diagnostics, providing test for various circumstances of bad OS/OpenGL driver combinations
174 //! to provide feedback to the user about bad OpenGL drivers.196 //! to provide feedback to the user about bad OpenGL drivers.
175#if STEL_USE_NEW_OPENGL_WIDGETS197 void processOpenGLdiagnosticsAndWarnings(QSettings *conf, QOpenGLContext* context) const;
176 void processOpenGLdiagnosticsAndWarnings(QSettings *conf, StelQOpenGLWidget* glWidget) const;
177#else
178 void processOpenGLdiagnosticsAndWarnings(QSettings *conf, StelQGLWidget* glWidget) const;
179#endif
180198
181 //! The StelMainView singleton199 //! The StelMainView singleton
182 static StelMainView* singleton;200 static StelMainView* singleton;
183201
184 QGraphicsWidget* rootItem;202 GLInfo glInfo;
185 QGraphicsWidget* skyItem;203
204 QSettings* configuration;
205
206 class StelRootItem* rootItem;
186 QGraphicsWidget* guiItem;207 QGraphicsWidget* guiItem;
187 QGraphicsEffect* nightModeEffect;208 QGraphicsEffect* nightModeEffect;
188209
189 //! The openGL window210 //! The openGL viewport of the graphics scene
190#if STEL_USE_NEW_OPENGL_WIDGETS211 //! Responsible for main GL setup, rendering is done in the scene background
191 StelQOpenGLWidget* glWidget;212 StelGLWidget* glWidget;
192#else213 //! Custom QGraphicsScene, this renders our scene background
193 StelQGLWidget* glWidget;214 StelGraphicsScene* stelScene;
194#endif215
195 StelGuiBase* gui;216 StelGuiBase* gui;
196 class StelApp* stelApp;217 class StelApp* stelApp;
197218
219 bool updateQueued;
198 bool flagInvertScreenShotColors;220 bool flagInvertScreenShotColors;
199 bool flagOverwriteScreenshots; //! if set to true, screenshot is named exactly screenShotPrefix.png and overwrites existing file221 bool flagOverwriteScreenshots; //! if set to true, screenshot is named exactly screenShotPrefix.png and overwrites existing file
200222
@@ -207,12 +229,15 @@
207229
208 double lastEventTimeSec;230 double lastEventTimeSec;
209231
210 QTimer* minFpsTimer;
211 bool flagMaxFpsUpdatePending;
212 //! The minimum desired frame rate in frame per second.232 //! The minimum desired frame rate in frame per second.
213 float minfps;233 float minfps;
214 //! The maximum desired frame rate in frame per second.234 //! The maximum desired frame rate in frame per second.
215 float maxfps;235 float maxfps;
236 QTimer* minFpsTimer;
237
238#ifdef OPENGL_DEBUG_LOGGING
239 QOpenGLDebugLogger* glLogger;
240#endif
216};241};
217242
218243
219244
=== modified file 'src/core/OctahedronPolygon.cpp'
--- src/core/OctahedronPolygon.cpp 2015-03-24 16:31:04 +0000
+++ src/core/OctahedronPolygon.cpp 2017-01-12 21:08:38 +0000
@@ -91,7 +91,7 @@
91 }91 }
92 res[res.size()-1]=']';92 res[res.size()-1]=']';
93 return res;93 return res;
94};94}
9595
96OctahedronPolygon::OctahedronPolygon(const QVector<Vec3d>& contour) : fillCachedVertexArray(StelVertexArray::Triangles), outlineCachedVertexArray(StelVertexArray::Lines)96OctahedronPolygon::OctahedronPolygon(const QVector<Vec3d>& contour) : fillCachedVertexArray(StelVertexArray::Triangles), outlineCachedVertexArray(StelVertexArray::Lines)
97{97{
9898
=== modified file 'src/core/SpoutSender.cpp'
--- src/core/SpoutSender.cpp 2016-12-18 22:26:48 +0000
+++ src/core/SpoutSender.cpp 2017-01-12 21:08:38 +0000
@@ -18,7 +18,7 @@
18 */18 */
1919
20#include "SpoutSender.hpp"20#include "SpoutSender.hpp"
21#include "SpoutLibrary.h"21#include "../../external/SpoutLibrary.h"
2222
23Q_LOGGING_CATEGORY(spout,"stel.spout")23Q_LOGGING_CATEGORY(spout,"stel.spout")
2424
2525
=== modified file 'src/core/StelApp.cpp'
--- src/core/StelApp.cpp 2017-01-09 17:24:41 +0000
+++ src/core/StelApp.cpp 2017-01-12 21:08:38 +0000
@@ -20,6 +20,7 @@
20#include "StelApp.hpp"20#include "StelApp.hpp"
2121
22#include "StelCore.hpp"22#include "StelCore.hpp"
23#include "StelMainView.hpp"
23#include "StelUtils.hpp"24#include "StelUtils.hpp"
24#include "StelTextureMgr.hpp"25#include "StelTextureMgr.hpp"
25#include "StelObjectMgr.hpp"26#include "StelObjectMgr.hpp"
@@ -202,9 +203,10 @@
202/*************************************************************************203/*************************************************************************
203 Create and initialize the main Stellarium application.204 Create and initialize the main Stellarium application.
204*************************************************************************/205*************************************************************************/
205StelApp::StelApp(QObject* parent)206StelApp::StelApp(StelMainView *parent)
206 : QObject(parent)207 : QObject(parent)
207 , core(NULL) 208 , mainWin(parent)
209 , core(NULL)
208 , moduleMgr(NULL)210 , moduleMgr(NULL)
209 , localeMgr(NULL)211 , localeMgr(NULL)
210 , skyCultureMgr(NULL)212 , skyCultureMgr(NULL)
@@ -226,8 +228,7 @@
226 , globalScalingRatio(1.f)228 , globalScalingRatio(1.f)
227 , fps(0)229 , fps(0)
228 , frame(0)230 , frame(0)
229 , timefr(0.)231 , frameTimeAccum(0.)
230 , timeBase(0.)
231 , flagNightVision(false)232 , flagNightVision(false)
232 , confSettings(NULL)233 , confSettings(NULL)
233 , initialized(false)234 , initialized(false)
@@ -390,6 +391,7 @@
390391
391void StelApp::init(QSettings* conf)392void StelApp::init(QSettings* conf)
392{393{
394 gl = QOpenGLContext::currentContext()->functions();
393 confSettings = conf;395 confSettings = conf;
394396
395 devicePixelsPerPixel = QOpenGLContext::currentContext()->screen()->devicePixelRatio();397 devicePixelsPerPixel = QOpenGLContext::currentContext()->screen()->devicePixelRatio();
@@ -632,13 +634,13 @@
632 return;634 return;
633635
634 ++frame;636 ++frame;
635 timefr+=deltaTime;637 frameTimeAccum+=deltaTime;
636 if (timefr-timeBase > 1.)638 if (frameTimeAccum > 1.)
637 {639 {
638 // Calc the FPS rate every seconds640 // Calc the FPS rate every seconds
639 fps=(double)frame/(timefr-timeBase);641 fps=(double)frame/frameTimeAccum;
640 frame = 0;642 frame = 0;
641 timeBase+=1.;643 frameTimeAccum=0.;
642 }644 }
643 645
644 core->update(deltaTime);646 core->update(deltaTime);
@@ -668,11 +670,10 @@
668 renderBuffer->bind();670 renderBuffer->bind();
669}671}
670672
671void StelApp::applyRenderBuffer(int drawFbo)673void StelApp::applyRenderBuffer(GLuint drawFbo)
672{674{
673 if (!renderBuffer) return;675 if (!renderBuffer) return;
674 renderBuffer->release();676 GL(gl->glBindFramebuffer(GL_FRAMEBUFFER, drawFbo));
675 if (drawFbo) GL(glBindFramebuffer(GL_FRAMEBUFFER, drawFbo));
676 viewportEffect->paintViewportBuffer(renderBuffer);677 viewportEffect->paintViewportBuffer(renderBuffer);
677}678}
678679
@@ -682,11 +683,18 @@
682 if (!initialized)683 if (!initialized)
683 return;684 return;
684685
685 int drawFbo;686 //find out which framebuffer is the current one
686 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &drawFbo);687 //this is usually NOT the "zero" FBO, but one provided by QOpenGLWidget
688 GLint drawFbo;
689 GL(gl->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &drawFbo));
687690
688 prepareRenderBuffer();691 prepareRenderBuffer();
692 currentFbo = renderBuffer ? renderBuffer->handle() : drawFbo;
693
689 core->preDraw();694 core->preDraw();
695 // Clear areas not redrawn by main viewport (i.e. fisheye square viewport)
696 GL(gl->glClearColor(0,0,0,0));
697 GL(gl->glClear(GL_COLOR_BUFFER_BIT));
690698
691 const QList<StelModule*> modules = moduleMgr->getCallOrders(StelModule::ActionDraw);699 const QList<StelModule*> modules = moduleMgr->getCallOrders(StelModule::ActionDraw);
692 foreach(StelModule* module, modules)700 foreach(StelModule* module, modules)
@@ -706,23 +714,24 @@
706/*************************************************************************714/*************************************************************************
707 Call this when the size of the GL window has changed715 Call this when the size of the GL window has changed
708*************************************************************************/716*************************************************************************/
709void StelApp::glWindowHasBeenResized(float x, float y, float w, float h)717void StelApp::glWindowHasBeenResized(const QRectF& rect)
710{718{
711 if (core)719 if (core)
712 core->windowHasBeenResized(x, y, w, h);720 core->windowHasBeenResized(rect.x(), rect.y(), rect.width(), rect.height());
713 else721 else
714 {722 {
715 saveProjW = w;723 saveProjW = rect.width();
716 saveProjH = h;724 saveProjH = rect.height();
717 }725 }
718 if (renderBuffer)726 if (renderBuffer)
719 {727 {
728 ensureGLContextCurrent();
720 delete renderBuffer;729 delete renderBuffer;
721 renderBuffer = NULL;730 renderBuffer = NULL;
722 }731 }
723#ifdef ENABLE_SPOUT732#ifdef ENABLE_SPOUT
724 if (spoutSender)733 if (spoutSender)
725 spoutSender->resize(w,h);734 spoutSender->resize(rect.width(),rect.height());
726#endif735#endif
727}736}
728737
@@ -788,7 +797,7 @@
788}797}
789798
790// Handle mouse move799// Handle mouse move
791void StelApp::handleMove(float x, float y, Qt::MouseButtons b)800bool StelApp::handleMove(float x, float y, Qt::MouseButtons b)
792{801{
793 if (viewportEffect)802 if (viewportEffect)
794 viewportEffect->distortXY(x, y);803 viewportEffect->distortXY(x, y);
@@ -796,8 +805,9 @@
796 foreach (StelModule* i, moduleMgr->getCallOrders(StelModule::ActionHandleMouseMoves))805 foreach (StelModule* i, moduleMgr->getCallOrders(StelModule::ActionHandleMouseMoves))
797 {806 {
798 if (i->handleMouseMoves(x*devicePixelsPerPixel, y*devicePixelsPerPixel, b))807 if (i->handleMouseMoves(x*devicePixelsPerPixel, y*devicePixelsPerPixel, b))
799 return;808 return true;
800 }809 }
810 return false;
801}811}
802812
803// Handle key press and release813// Handle key press and release
@@ -857,6 +867,11 @@
857#endif867#endif
858}868}
859869
870void StelApp::ensureGLContextCurrent()
871{
872 mainWin->glContextMakeCurrent();
873}
874
860// Return the time since when stellarium is running in second.875// Return the time since when stellarium is running in second.
861double StelApp::getTotalRunTime()876double StelApp::getTotalRunTime()
862{877{
@@ -907,6 +922,7 @@
907 if (name == getViewportEffect()) return;922 if (name == getViewportEffect()) return;
908 if (renderBuffer)923 if (renderBuffer)
909 {924 {
925 ensureGLContextCurrent();
910 delete renderBuffer;926 delete renderBuffer;
911 renderBuffer = NULL;927 renderBuffer = NULL;
912 }928 }
913929
=== modified file 'src/core/StelApp.hpp'
--- src/core/StelApp.hpp 2016-12-18 22:26:48 +0000
+++ src/core/StelApp.hpp 2017-01-12 21:08:38 +0000
@@ -30,9 +30,11 @@
30class StelObjectMgr;30class StelObjectMgr;
31class StelLocaleMgr;31class StelLocaleMgr;
32class StelModuleMgr;32class StelModuleMgr;
33class StelMainView;
33class StelSkyCultureMgr;34class StelSkyCultureMgr;
34class StelViewportEffect;35class StelViewportEffect;
35class QOpenGLFramebufferObject;36class QOpenGLFramebufferObject;
37class QOpenGLFunctions;
36class QSettings;38class QSettings;
37class QNetworkAccessManager;39class QNetworkAccessManager;
38class QNetworkReply;40class QNetworkReply;
@@ -70,14 +72,14 @@
7072
71public:73public:
72 friend class StelAppGraphicsWidget;74 friend class StelAppGraphicsWidget;
73 friend class StelSkyItem;75 friend class StelRootItem;
7476
75 //! Create and initialize the main Stellarium application.77 //! Create and initialize the main Stellarium application.
76 //! @param parent the QObject parent78 //! @param parent the QObject parent
77 //! The configFile will be search for in the search path by the StelFileMgr,79 //! The configFile will be search for in the search path by the StelFileMgr,
78 //! it is therefor possible to specify either just a file name or path within the80 //! it is therefor possible to specify either just a file name or path within the
79 //! search path, or use a full path or even a relative path to an existing file81 //! search path, or use a full path or even a relative path to an existing file
80 StelApp(QObject* parent=NULL);82 StelApp(StelMainView* parent);
8183
82 //! Deinitialize and destroy the main Stellarium application.84 //! Deinitialize and destroy the main Stellarium application.
83 virtual ~StelApp();85 virtual ~StelApp();
@@ -160,9 +162,6 @@
160 // @return the max squared distance in pixels that any object has travelled since the last update.162 // @return the max squared distance in pixels that any object has travelled since the last update.
161 void draw();163 void draw();
162164
163 //! Call this when the size of the GL window has changed.
164 void glWindowHasBeenResized(float x, float y, float w, float h);
165
166 //! Get the ratio between real device pixel and "Device Independent Pixel".165 //! Get the ratio between real device pixel and "Device Independent Pixel".
167 //! Usually this value is 1, but for a mac with retina screen this will be value 2.166 //! Usually this value is 1, but for a mac with retina screen this will be value 2.
168 float getDevicePixelsPerPixel() const {return devicePixelsPerPixel;}167 float getDevicePixelsPerPixel() const {return devicePixelsPerPixel;}
@@ -212,6 +211,8 @@
212 ///////////////////////////////////////////////////////////////////////////211 ///////////////////////////////////////////////////////////////////////////
213 // Scriptable methods212 // Scriptable methods
214public slots:213public slots:
214 //! Call this when the size of the GL window has changed.
215 void glWindowHasBeenResized(const QRectF &rect);
215216
216 //! Set flag for activating night vision mode.217 //! Set flag for activating night vision mode.
217 void setVisionModeNight(bool);218 void setVisionModeNight(bool);
@@ -240,6 +241,17 @@
240 //! @return the FPS averaged on the last second241 //! @return the FPS averaged on the last second
241 float getFps() const {return fps;}242 float getFps() const {return fps;}
242243
244 //! Returns the default FBO handle, to be used when StelModule instances want to release their own FBOs.
245 //! Note that this is usually not the same as QOpenGLContext::defaultFramebufferObject(),
246 //! so use this call instead of the Qt version!
247 //! Valid through a StelModule::draw() call, do not use elsewhere.
248 quint32 getDefaultFBO() const { return currentFbo; }
249
250 //! Makes sure the correct GL context used for main drawing is made current.
251 //! This is always the case during init() and draw() calls, but if OpenGL access is required elsewhere,
252 //! this MUST be called before using any GL functions.
253 void ensureGLContextCurrent();
254
243 //! Return the time since when stellarium is running in second.255 //! Return the time since when stellarium is running in second.
244 static double getTotalRunTime();256 static double getTotalRunTime();
245257
@@ -263,7 +275,6 @@
263 void progressBarRemoved(const StelProgressController*);275 void progressBarRemoved(const StelProgressController*);
264 //! Called just before we exit Qt mainloop.276 //! Called just before we exit Qt mainloop.
265 void aboutToQuit();277 void aboutToQuit();
266
267private:278private:
268279
269 //! Handle mouse clics.280 //! Handle mouse clics.
@@ -271,7 +282,7 @@
271 //! Handle mouse wheel.282 //! Handle mouse wheel.
272 void handleWheel(class QWheelEvent* event);283 void handleWheel(class QWheelEvent* event);
273 //! Handle mouse move.284 //! Handle mouse move.
274 void handleMove(float x, float y, Qt::MouseButtons b);285 bool handleMove(float x, float y, Qt::MouseButtons b);
275 //! Handle key press and release.286 //! Handle key press and release.
276 void handleKeys(class QKeyEvent* event);287 void handleKeys(class QKeyEvent* event);
277 //! Handle pinch on multi touch devices.288 //! Handle pinch on multi touch devices.
@@ -281,11 +292,14 @@
281 void prepareRenderBuffer();292 void prepareRenderBuffer();
282 //! Used internally to set the viewport effects.293 //! Used internally to set the viewport effects.
283 //! @param drawFbo the OpenGL fbo we need to render into.294 //! @param drawFbo the OpenGL fbo we need to render into.
284 void applyRenderBuffer(int drawFbo=0);295 void applyRenderBuffer(quint32 drawFbo=0);
285296
286 // The StelApp singleton297 // The StelApp singleton
287 static StelApp* singleton;298 static StelApp* singleton;
288299
300 //! The main window which is the parent of this object
301 StelMainView* mainWin;
302
289 // The associated StelCore instance303 // The associated StelCore instance
290 StelCore* core;304 StelCore* core;
291305
@@ -354,7 +368,7 @@
354368
355 float fps;369 float fps;
356 int frame;370 int frame;
357 double timefr, timeBase; // Used for fps counter371 double frameTimeAccum; // Used for fps counter
358372
359 //! Define whether we are in night vision mode373 //! Define whether we are in night vision mode
360 bool flagNightVision;374 bool flagNightVision;
@@ -388,8 +402,8 @@
388402
389 // Framebuffer object used for viewport effects.403 // Framebuffer object used for viewport effects.
390 QOpenGLFramebufferObject* renderBuffer;404 QOpenGLFramebufferObject* renderBuffer;
391
392 StelViewportEffect* viewportEffect;405 StelViewportEffect* viewportEffect;
406 QOpenGLFunctions* gl;
393 407
394 bool flagShowDecimalDegrees;408 bool flagShowDecimalDegrees;
395 // flag to indicate we want calculate azimuth from south towards west (as in old astronomical literature)409 // flag to indicate we want calculate azimuth from south towards west (as in old astronomical literature)
@@ -398,6 +412,9 @@
398 SpoutSender* spoutSender;412 SpoutSender* spoutSender;
399#endif413#endif
400414
415 // The current main FBO/render target handle, without requiring GL queries. Valid through a draw() call
416 quint32 currentFbo;
417
401};418};
402419
403#endif // _STELAPP_HPP_420#endif // _STELAPP_HPP_
404421
=== modified file 'src/core/StelCore.cpp'
--- src/core/StelCore.cpp 2017-01-06 13:26:03 +0000
+++ src/core/StelCore.cpp 2017-01-12 21:08:38 +0000
@@ -244,6 +244,9 @@
244 setCurrentProjectionTypeKey(getDefaultProjectionTypeKey());244 setCurrentProjectionTypeKey(getDefaultProjectionTypeKey());
245 updateMaximumFov();245 updateMaximumFov();
246246
247 // activate DE430/431
248 initEphemeridesFunctions();
249
247 // Register all the core actions.250 // Register all the core actions.
248 QString timeGroup = N_("Date and Time");251 QString timeGroup = N_("Date and Time");
249 QString movementGroup = N_("Movement and Selection");252 QString movementGroup = N_("Movement and Selection");
@@ -503,10 +506,6 @@
503 currentProjectorParams.zFar = 500.;506 currentProjectorParams.zFar = 500.;
504507
505 skyDrawer->preDraw();508 skyDrawer->preDraw();
506
507 // Clear areas not redrawn by main viewport (i.e. fisheye square viewport)
508 glClearColor(0,0,0,0);
509 glClear(GL_COLOR_BUFFER_BIT);
510}509}
511510
512511
513512
=== modified file 'src/core/StelOpenGL.cpp'
--- src/core/StelOpenGL.cpp 2014-06-11 15:48:31 +0000
+++ src/core/StelOpenGL.cpp 2017-01-12 21:08:38 +0000
@@ -16,10 +16,12 @@
16 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.16 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17 */17 */
1818
19#include <cstdio>
20#include "StelOpenGL.hpp"19#include "StelOpenGL.hpp"
2120#include <QDebug>
22const char* getGLErrorText(int code) {21
22QOpenGLContext* StelOpenGL::mainContext = NULL;
23
24const char* StelOpenGL::getGLErrorText(GLenum code) {
23 switch (code) {25 switch (code) {
24 case GL_INVALID_ENUM:26 case GL_INVALID_ENUM:
25 return "GL_INVALID_ENUM";27 return "GL_INVALID_ENUM";
@@ -32,20 +34,18 @@
32 case GL_OUT_OF_MEMORY:34 case GL_OUT_OF_MEMORY:
33 return "GL_OUT_OF_MEMORY";35 return "GL_OUT_OF_MEMORY";
34 default:36 default:
35 return "undefined error";37 return "unknown GL error type";
36 }38 }
37}39}
3840
39int checkGLErrors(const char *file, int line)41int StelOpenGL::checkGLErrors(const char *file, int line)
40{42{
41 int errors = 0;43 int errors = 0;
42 while (true)44 for(GLenum x; (x=mainContext->functions()->glGetError())!=GL_NO_ERROR; )
43 {45 {
44 GLenum x = glGetError();46 ++errors;
45 if (x == GL_NO_ERROR)47 qCritical("%s:%d: OpenGL error: %d (%s)\n",
46 return errors;48 file, line, x, getGLErrorText(x));
47 printf("%s:%d: OpenGL error: %d (%s)\n",
48 file, line, x, getGLErrorText(x));
49 errors++;
50 }49 }
50 return errors;
51}51}
5252
=== modified file 'src/core/StelOpenGL.hpp'
--- src/core/StelOpenGL.hpp 2016-12-10 10:33:35 +0000
+++ src/core/StelOpenGL.hpp 2017-01-12 21:08:38 +0000
@@ -1,6 +1,7 @@
1/*1/*
2 * Stellarium2 * Stellarium
3 * Copyright (C) 2014 Fabien Chereau3 * Copyright (C) 2014 Fabien Chereau
4 * Copyright (C) 2016 Florian Schaukowitsch
4 *5 *
5 * This program is free software; you can redistribute it and/or6 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License7 * modify it under the terms of the GNU General Public License
@@ -20,185 +21,29 @@
20#ifndef _STELOPENGL_HPP_21#ifndef _STELOPENGL_HPP_
21#define _STELOPENGL_HPP_22#define _STELOPENGL_HPP_
2223
23#define GL_GLEXT_PROTOTYPES
24#include <qopengl.h>
25
26#include <QOpenGLFunctions>24#include <QOpenGLFunctions>
2725
28// On windows without ANGLE support, we should not directly call some26#ifndef QT_NO_DEBUG
29// of the OpenGL functions, instead we have to use QOpenGLFunctions.
30//
31// Here we replace the functions with a macro that will invoke the proper
32// calls.
33#if defined(Q_OS_WIN) && !defined(Q_NO_OPENGL)
34# define GLFUNC_(x) QOpenGLContext::currentContext()->functions()->x
35#else
36# define GLFUNC_(x) x
37#endif
38
39#define glActiveTexture(...) GLFUNC_(glActiveTexture(__VA_ARGS__))
40#define glAttachShader(...) GLFUNC_(glAttachShader(__VA_ARGS__))
41#define glBindAttribLocation(...) GLFUNC_(glBindAttribLocation(__VA_ARGS__))
42#define glBindBuffer(...) GLFUNC_(glBindBuffer(__VA_ARGS__))
43#define glBindFramebuffer(...) GLFUNC_(glBindFramebuffer(__VA_ARGS__))
44#define glBindRenderbuffer(...) GLFUNC_(glBindRenderbuffer(__VA_ARGS__))
45#define glBlendColor(...) GLFUNC_(glBlendColor(__VA_ARGS__))
46#define glBlendEquation(...) GLFUNC_(glBlendEquation(__VA_ARGS__))
47#define glBlendEquationSeparate(...) GLFUNC_(glBlendEquationSeparate(__VA_ARGS__))
48#define glBlendFuncSeparate(...) GLFUNC_(glBlendFuncSeparate(__VA_ARGS__))
49#define glBufferData(...) GLFUNC_(glBufferData(__VA_ARGS__))
50#define glBufferSubData(...) GLFUNC_(glBufferSubData(__VA_ARGS__))
51#define glCheckFramebufferStatus(...) GLFUNC_(glCheckFramebufferStatus(__VA_ARGS__))
52#define glClearDepthf(...) GLFUNC_(glClearDepthf(__VA_ARGS__))
53#define glCompileShader(...) GLFUNC_(glCompileShader(__VA_ARGS__))
54#define glCompressedTexImage2D(...) GLFUNC_(glCompressedTexImage2D(__VA_ARGS__))
55#define glCompressedTexSubImage2D(...) GLFUNC_(glCompressedTexSubImage2D(__VA_ARGS__))
56#define glCopyTexSubImage2D(...) GLFUNC_(glCopyTexSubImage2D(__VA_ARGS__)) // new for spout
57#define glCreateProgram(...) GLFUNC_(glCreateProgram(__VA_ARGS__))
58#define glCreateShader(...) GLFUNC_(glCreateShader(__VA_ARGS__))
59#define glDeleteBuffers(...) GLFUNC_(glDeleteBuffers(__VA_ARGS__))
60#define glDeleteFramebuffers(...) GLFUNC_(glDeleteFramebuffers(__VA_ARGS__))
61#define glDeleteProgram(...) GLFUNC_(glDeleteProgram(__VA_ARGS__))
62#define glDeleteRenderbuffers(...) GLFUNC_(glDeleteRenderbuffers(__VA_ARGS__))
63#define glDeleteShader(...) GLFUNC_(glDeleteShader(__VA_ARGS__))
64#define glDepthRangef(...) GLFUNC_(glDepthRangef(__VA_ARGS__))
65#define glDetachShader(...) GLFUNC_(glDetachShader(__VA_ARGS__))
66#define glDisableVertexAttribArray(...) GLFUNC_(glDisableVertexAttribArray(__VA_ARGS__))
67#define glEnableVertexAttribArray(...) GLFUNC_(glEnableVertexAttribArray(__VA_ARGS__))
68#define glFramebufferRenderbuffer(...) GLFUNC_(glFramebufferRenderbuffer(__VA_ARGS__))
69#define glFramebufferTexture2D(...) GLFUNC_(glFramebufferTexture2D(__VA_ARGS__))
70#define glGenBuffers(...) GLFUNC_(glGenBuffers(__VA_ARGS__))
71#define glGenerateMipmap(...) GLFUNC_(glGenerateMipmap(__VA_ARGS__))
72#define glGenFramebuffers(...) GLFUNC_(glGenFramebuffers(__VA_ARGS__))
73#define glGenRenderbuffers(...) GLFUNC_(glGenRenderbuffers(__VA_ARGS__))
74#define glGetActiveAttrib(...) GLFUNC_(glGetActiveAttrib(__VA_ARGS__))
75#define glGetActiveUniform(...) GLFUNC_(glGetActiveUniform(__VA_ARGS__))
76#define glGetAttachedShaders(...) GLFUNC_(glGetAttachedShaders(__VA_ARGS__))
77#define glGetAttribLocation(...) GLFUNC_(glGetAttribLocation(__VA_ARGS__))
78#define glGetBufferParameteriv(...) GLFUNC_(glGetBufferParameteriv(__VA_ARGS__))
79#define glGetFramebufferAttachmentParameteriv(...) GLFUNC_(glGetFramebufferAttachmentParameteriv(__VA_ARGS__))
80#define glGetProgramiv(...) GLFUNC_(glGetProgramiv(__VA_ARGS__))
81#define glGetProgramInfoLog(...) GLFUNC_(glGetProgramInfoLog(__VA_ARGS__))
82#define glGetRenderbufferParameteriv(...) GLFUNC_(glGetRenderbufferParameteriv(__VA_ARGS__))
83#define glGetShaderiv(...) GLFUNC_(glGetShaderiv(__VA_ARGS__))
84#define glGetShaderInfoLog(...) GLFUNC_(glGetShaderInfoLog(__VA_ARGS__))
85#define glGetShaderPrecisionFormat(...) GLFUNC_(glGetShaderPrecisionFormat(__VA_ARGS__))
86#define glGetShaderSource(...) GLFUNC_(glGetShaderSource(__VA_ARGS__))
87#define glGetUniformfv(...) GLFUNC_(glGetUniformfv(__VA_ARGS__))
88#define glGetUniformiv(...) GLFUNC_(glGetUniformiv(__VA_ARGS__))
89#define glGetUniformLocation(...) GLFUNC_(glGetUniformLocation(__VA_ARGS__))
90#define glGetVertexAttribfv(...) GLFUNC_(glGetVertexAttribfv(__VA_ARGS__))
91#define glGetVertexAttribiv(...) GLFUNC_(glGetVertexAttribiv(__VA_ARGS__))
92#define glGetVertexAttribPointerv(...) GLFUNC_(glGetVertexAttribPointerv(__VA_ARGS__))
93#define glIsBuffer(...) GLFUNC_(glIsBuffer(__VA_ARGS__))
94#define glIsFramebuffer(...) GLFUNC_(glIsFramebuffer(__VA_ARGS__))
95#define glIsProgram(...) GLFUNC_(glIsProgram(__VA_ARGS__))
96#define glIsRenderbuffer(...) GLFUNC_(glIsRenderbuffer(__VA_ARGS__))
97#define glIsShader(...) GLFUNC_(glIsShader(__VA_ARGS__))
98#define glLinkProgram(...) GLFUNC_(glLinkProgram(__VA_ARGS__))
99#define glProgramParameteri(...) GLFUNC_(glProgramParameteri(__VA_ARGS__)) // GZ TRIAL
100#define glProgramParameteriEXT(...) GLFUNC_(glProgramParameteriEXT(__VA_ARGS__)) // GZ TRIAL
101#define glReleaseShaderCompiler(...) GLFUNC_(glReleaseShaderCompiler(__VA_ARGS__))
102#define glRenderbufferStorage(...) GLFUNC_(glRenderbufferStorage(__VA_ARGS__))
103#define glSampleCoverage(...) GLFUNC_(glSampleCoverage(__VA_ARGS__))
104#define glShaderBinary(...) GLFUNC_(glShaderBinary(__VA_ARGS__))
105#define glShaderSource(...) GLFUNC_(glShaderSource(__VA_ARGS__))
106#define glStencilFuncSeparate(...) GLFUNC_(glStencilFuncSeparate(__VA_ARGS__))
107#define glStencilMaskSeparate(...) GLFUNC_(glStencilMaskSeparate(__VA_ARGS__))
108#define glStencilOpSeparate(...) GLFUNC_(glStencilOpSeparate(__VA_ARGS__))
109#define glUniform1f(...) GLFUNC_(glUniform1f(__VA_ARGS__))
110#define glUniform1fv(...) GLFUNC_(glUniform1fv(__VA_ARGS__))
111#define glUniform1i(...) GLFUNC_(glUniform1i(__VA_ARGS__))
112#define glUniform1iv(...) GLFUNC_(glUniform1iv(__VA_ARGS__))
113#define glUniform2f(...) GLFUNC_(glUniform2f(__VA_ARGS__))
114#define glUniform2fv(...) GLFUNC_(glUniform2fv(__VA_ARGS__))
115#define glUniform2i(...) GLFUNC_(glUniform2i(__VA_ARGS__))
116#define glUniform2iv(...) GLFUNC_(glUniform2iv(__VA_ARGS__))
117#define glUniform3f(...) GLFUNC_(glUniform3f(__VA_ARGS__))
118#define glUniform3fv(...) GLFUNC_(glUniform3fv(__VA_ARGS__))
119#define glUniform3i(...) GLFUNC_(glUniform3i(__VA_ARGS__))
120#define glUniform3iv(...) GLFUNC_(glUniform3iv(__VA_ARGS__))
121#define glUniform4f(...) GLFUNC_(glUniform4f(__VA_ARGS__))
122#define glUniform4fv(...) GLFUNC_(glUniform4fv(__VA_ARGS__))
123#define glUniform4i(...) GLFUNC_(glUniform4i(__VA_ARGS__))
124#define glUniform4iv(...) GLFUNC_(glUniform4iv(__VA_ARGS__))
125#define glUniformMatrix2fv(...) GLFUNC_(glUniformMatrix2fv(__VA_ARGS__))
126#define glUniformMatrix3fv(...) GLFUNC_(glUniformMatrix3fv(__VA_ARGS__))
127#define glUniformMatrix4fv(...) GLFUNC_(glUniformMatrix4fv(__VA_ARGS__))
128#define glUseProgram(...) GLFUNC_(glUseProgram(__VA_ARGS__))
129#define glValidateProgram(...) GLFUNC_(glValidateProgram(__VA_ARGS__))
130#define glVertexAttrib1f(...) GLFUNC_(glVertexAttrib1f(__VA_ARGS__))
131#define glVertexAttrib1fv(...) GLFUNC_(glVertexAttrib1fv(__VA_ARGS__))
132#define glVertexAttrib2f(...) GLFUNC_(glVertexAttrib2f(__VA_ARGS__))
133#define glVertexAttrib2fv(...) GLFUNC_(glVertexAttrib2fv(__VA_ARGS__))
134#define glVertexAttrib3f(...) GLFUNC_(glVertexAttrib3f(__VA_ARGS__))
135#define glVertexAttrib3fv(...) GLFUNC_(glVertexAttrib3fv(__VA_ARGS__))
136#define glVertexAttrib4f(...) GLFUNC_(glVertexAttrib4f(__VA_ARGS__))
137#define glVertexAttrib4fv(...) GLFUNC_(glVertexAttrib4fv(__VA_ARGS__))
138#define glVertexAttribPointer(...) GLFUNC_(glVertexAttribPointer(__VA_ARGS__))
139
140#if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)
141#define glGetString(...) GLFUNC_(glGetString(__VA_ARGS__))
142#endif
143
144#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
145#define glBindTexture(...) GLFUNC_(glBindTexture(__VA_ARGS__))
146#define glBlendFunc(...) GLFUNC_(glBlendFunc(__VA_ARGS__))
147#define glClear(...) GLFUNC_(glClear(__VA_ARGS__))
148#define glClearColor(...) GLFUNC_(glClearColor(__VA_ARGS__))
149#define glCullFace(...) GLFUNC_(glCullFace(__VA_ARGS__))
150#define glDeleteTextures(...) GLFUNC_(glDeleteTextures(__VA_ARGS__))
151#define glDepthMask(...) GLFUNC_(glDepthMask(__VA_ARGS__))
152#define glDisable(...) GLFUNC_(glDisable(__VA_ARGS__))
153#define glDrawArrays(...) GLFUNC_(glDrawArrays(__VA_ARGS__))
154#define glDrawElements(...) GLFUNC_(glDrawElements(__VA_ARGS__))
155#define glEnable(...) GLFUNC_(glEnable(__VA_ARGS__))
156#define glGenTextures(...) GLFUNC_(glGenTextures(__VA_ARGS__))
157#define glGetError(...) GLFUNC_(glGetError(__VA_ARGS__))
158#define glGetIntegerv(...) GLFUNC_(glGetIntegerv(__VA_ARGS__))
159#define glFrontFace(...) GLFUNC_(glFrontFace(__VA_ARGS__))
160#define glIsEnabled(...) GLFUNC_(glIsEnabled(__VA_ARGS__))
161#define glIsTexture(...) GLFUNC_(glIsTexture(__VA_ARGS__))
162#define glLineWidth(...) GLFUNC_(glLineWidth(__VA_ARGS__))
163#define glPixelStorei(...) GLFUNC_(glPixelStorei(__VA_ARGS__))
164#define glPolygonOffset(...) GLFUNC_(glPolygonOffset(__VA_ARGS__))
165#define glStencilMask(...) GLFUNC_(glStencilMask(__VA_ARGS__))
166#define glTexImage2D(...) GLFUNC_(glTexImage2D(__VA_ARGS__))
167#define glTexParameterf(...) GLFUNC_(glTexParameterf(__VA_ARGS__))
168#define glTexParameterfv(...) GLFUNC_(glTexParameterfv(__VA_ARGS__))
169#define glTexParameteri(...) GLFUNC_(glTexParameteri(__VA_ARGS__))
170#define glTexParameteriv(...) GLFUNC_(glTexParameteriv(__VA_ARGS__))
171#define glViewport(...) GLFUNC_(glViewport(__VA_ARGS__))
172#endif
173
174#ifndef NDEBUG
175# define GL(line) do { \27# define GL(line) do { \
28 /*for debugging, we make sure we use our main context*/\
29 Q_ASSERT(StelOpenGL::mainContext == QOpenGLContext::currentContext());\
176 line;\30 line;\
177 if (checkGLErrors(__FILE__, __LINE__))\31 Q_ASSERT_X(!StelOpenGL::checkGLErrors(__FILE__, __LINE__), "GL macro", "OpenGL errors encountered");\
178 exit(-1);\
179 } while(0)32 } while(0)
180#else33#else
181# define GL(line) line34# define GL(line) line
182#endif35#endif
18336
184// In ANGLE and other OpenGL ES systems, GL_LINE_SMOOTH is undefined.37//! Namespace containing some OpenGL helpers
185// We can define it here to not break compilation, but must test for real OpenGL context before calling.38namespace StelOpenGL
186# ifndef GL_LINE_SMOOTH39{
187# define GL_LINE_SMOOTH 0x0B2040 //! The main context as created by the StelMainView (only used for debugging)
188# endif41 extern QOpenGLContext* mainContext;
18942
190const char* getGLErrorText(int code);43 //! Converts a GLenum from glGetError to a string
191int checkGLErrors(const char *file, int line);44 const char* getGLErrorText(GLenum code);
19245 //! Retrieves and prints all current OpenGL errors to console (glGetError in a loop)
193// To build on arm platforms we need to re-introduce the Qt 5.4 removed46 int checkGLErrors(const char *file, int line);
194// typedefs and defines of GLdouble/GL_DOUBLE, which are not present in GLES47}
195#if defined(QT_OPENGL_ES_2)
196# ifndef GL_DOUBLE
197# define GL_DOUBLE GL_FLOAT
198# endif
199# ifndef GLdouble
200typedef double GLdouble;
201# endif
202#endif
20348
204#endif // _STELOPENGL_HPP_49#endif // _STELOPENGL_HPP_
20550
=== modified file 'src/core/StelPainter.cpp'
--- src/core/StelPainter.cpp 2017-01-06 16:52:05 +0000
+++ src/core/StelPainter.cpp 2017-01-12 21:08:38 +0000
@@ -55,26 +55,50 @@
55StelPainter::BasicShaderVars StelPainter::colorShaderVars;55StelPainter::BasicShaderVars StelPainter::colorShaderVars;
56StelPainter::TexturesColorShaderVars StelPainter::texturesColorShaderVars;56StelPainter::TexturesColorShaderVars StelPainter::texturesColorShaderVars;
5757
58StelPainter::GLState::GLState()58StelPainter::GLState::GLState(QOpenGLFunctions* gl)
59{59 : blend(false),
60 blend = glIsEnabled(GL_BLEND);60 blendSrc(GL_SRC_ALPHA), blendDst(GL_ONE_MINUS_SRC_ALPHA),
61 glGetIntegerv(GL_BLEND_SRC_RGB, &blendSrcRGB);61 depthTest(false),
62 glGetIntegerv(GL_BLEND_DST_RGB, &blendDstRGB);62 depthMask(false),
63 glGetIntegerv(GL_BLEND_SRC_ALPHA, &blendSrcAlpha);63 cullFace(false),
64 glGetIntegerv(GL_BLEND_DST_ALPHA, &blendDstAlpha);64 lineSmooth(false),
65}65 lineWidth(1.0f),
6666 gl(gl)
67StelPainter::GLState::~GLState()67{
68{68
69 if (blend)69}
70 {70
71 glEnable(GL_BLEND);71void StelPainter::GLState::apply()
72 glBlendFuncSeparate(blendSrcRGB, blendDstRGB, blendSrcAlpha, blendDstAlpha);72{
73 }73 if(blend)
74 else74 gl->glEnable(GL_BLEND);
75 {75 else
76 glDisable(GL_BLEND);76 gl->glDisable(GL_BLEND);
77 }77 gl->glBlendFunc(blendSrc,blendDst);
78 if(depthTest)
79 gl->glEnable(GL_DEPTH_TEST);
80 else
81 gl->glDisable(GL_DEPTH_TEST);
82 gl->glDepthMask(depthMask);
83 if(cullFace)
84 gl->glEnable(GL_CULL_FACE);
85 else
86 gl->glDisable(GL_CULL_FACE);
87#ifdef GL_LINE_SMOOTH
88 if(!QOpenGLContext::currentContext()->isOpenGLES())
89 {
90 if (lineSmooth)
91 gl->glEnable(GL_LINE_SMOOTH);
92 else
93 gl->glDisable(GL_LINE_SMOOTH);
94 }
95#endif
96}
97
98void StelPainter::GLState::reset()
99{
100 *this = GLState(gl);
101 apply();
78}102}
79103
80bool StelPainter::linkProg(QOpenGLShaderProgram* prog, const QString& name)104bool StelPainter::linkProg(QOpenGLShaderProgram* prog, const QString& name)
@@ -85,7 +109,7 @@
85 return ret;109 return ret;
86}110}
87111
88StelPainter::StelPainter(const StelProjectorP& proj) : prj(proj)112StelPainter::StelPainter(const StelProjectorP& proj) : QOpenGLFunctions(QOpenGLContext::currentContext()), glState(this)
89{113{
90 Q_ASSERT(proj);114 Q_ASSERT(proj);
91115
@@ -106,13 +130,10 @@
106 }130 }
107#endif131#endif
108132
109 glDisable(GL_DEPTH_TEST);133 //TODO: is this still required, and is there some Qt way to fix it? 0x11111111 is a bit peculiar, how was it chosen?
110 glDisable(GL_CULL_FACE);
111 // Fix some problem when using Qt OpenGL2 engine134 // Fix some problem when using Qt OpenGL2 engine
112 glStencilMask(0x11111111);135 glStencilMask(0x11111111);
113 // Deactivate drawing in depth buffer by default136 glState.apply(); //apply default OpenGL state
114 glDepthMask(GL_FALSE);
115 enableTexture2d(false);
116 setProjector(proj);137 setProjector(proj);
117}138}
118139
@@ -126,6 +147,9 @@
126147
127StelPainter::~StelPainter()148StelPainter::~StelPainter()
128{149{
150 //reset opengl state
151 glState.reset();
152
129#ifndef NDEBUG153#ifndef NDEBUG
130 GLenum er = glGetError();154 GLenum er = glGetError();
131 if (er!=GL_NO_ERROR)155 if (er!=GL_NO_ERROR)
@@ -160,6 +184,87 @@
160 return QFontMetrics(currentFont);184 return QFontMetrics(currentFont);
161}185}
162186
187void StelPainter::setBlending(bool enableBlending, GLenum blendSrc, GLenum blendDst)
188{
189 if(enableBlending != glState.blend)
190 {
191 glState.blend = enableBlending;
192 if(enableBlending)
193 glEnable(GL_BLEND);
194 else
195 glDisable(GL_BLEND);
196 }
197 if(enableBlending)
198 {
199 if(blendSrc!=glState.blendSrc||blendDst!=glState.blendDst)
200 {
201 glState.blendSrc = blendSrc;
202 glState.blendDst = blendDst;
203 glBlendFunc(blendSrc,blendDst);
204 }
205 }
206}
207
208void StelPainter::setDepthTest(bool enable)
209{
210 if(glState.depthTest != enable)
211 {
212 glState.depthTest = enable;
213 if(enable)
214 glEnable(GL_DEPTH_TEST);
215 else
216 glDisable(GL_DEPTH_TEST);
217 }
218}
219
220void StelPainter::setDepthMask(bool enable)
221{
222 if(glState.depthMask != enable)
223 {
224 glState.depthMask = enable;
225 if(enable)
226 glDepthMask(GL_TRUE);
227 else
228 glDepthMask(GL_FALSE);
229 }
230}
231
232void StelPainter::setCullFace(bool enable)
233{
234 if(glState.cullFace!=enable)
235 {
236 glState.cullFace = enable;
237 if(enable)
238 glEnable(GL_CULL_FACE);
239 else
240 glDisable(GL_CULL_FACE);
241 }
242}
243
244void StelPainter::setLineSmooth(bool enable)
245{
246#ifdef GL_LINE_SMOOTH
247 if (!QOpenGLContext::currentContext()->isOpenGLES() && enable!=glState.lineSmooth)
248 {
249 glState.lineSmooth = enable;
250 if(enable)
251 glEnable(GL_LINE_SMOOTH);
252 else
253 glDisable(GL_LINE_SMOOTH);
254 }
255#else
256 Q_UNUSED(enable); //noop
257#endif
258}
259
260void StelPainter::setLineWidth(float width)
261{
262 if(glState.lineWidth != width)
263 {
264 glState.lineWidth = width;
265 glLineWidth(width);
266 }
267}
163268
164///////////////////////////////////////////////////////////////////////////269///////////////////////////////////////////////////////////////////////////
165// Standard methods for drawing primitives270// Standard methods for drawing primitives
@@ -170,6 +275,7 @@
170 if (prj->maskType != StelProjector::MaskDisk)275 if (prj->maskType != StelProjector::MaskDisk)
171 return;276 return;
172277
278 bool oldBlendState = glState.blend;
173 glDisable(GL_BLEND);279 glDisable(GL_BLEND);
174 setColor(0.f,0.f,0.f);280 setColor(0.f,0.f,0.f);
175281
@@ -219,6 +325,8 @@
219 }325 }
220 drawFromArray(TriangleStrip, (slices+1)*2, 0, false);326 drawFromArray(TriangleStrip, (slices+1)*2, 0, false);
221 enableClientStates(false);327 enableClientStates(false);
328 if(oldBlendState)
329 glEnable(GL_BLEND);
222}330}
223331
224void StelPainter::computeFanDisk(float radius, int innerFanSlices, int level, QVector<double>& vertexArr, QVector<float>& texCoordArr)332void StelPainter::computeFanDisk(float radius, int innerFanSlices, int level, QVector<double>& vertexArr, QVector<float>& texCoordArr)
@@ -530,7 +638,6 @@
530638
531void StelPainter::drawText(float x, float y, const QString& str, float angleDeg, float xshift, float yshift, bool noGravity)639void StelPainter::drawText(float x, float y, const QString& str, float angleDeg, float xshift, float yshift, bool noGravity)
532{640{
533 //StelPainter::GLState state; // Will restore the opengl state at the end of the function.
534 if (prj->gravityLabels && !noGravity)641 if (prj->gravityLabels && !noGravity)
535 {642 {
536 drawTextGravity180(x, y, str, xshift, yshift);643 drawTextGravity180(x, y, str, xshift, yshift);
@@ -545,7 +652,6 @@
545 angleDeg += prj->defaultAngleForGravityText;652 angleDeg += prj->defaultAngleForGravityText;
546 tex->texture->bind();653 tex->texture->bind();
547654
548 enableTexture2d(true);
549 static float vertexData[8];655 static float vertexData[8];
550 // compute the vertex coordinates applying the translation and the rotation656 // compute the vertex coordinates applying the translation and the rotation
551 static const float vertexBase[] = {0., 0., 1., 0., 0., 1., 1., 1.};657 static const float vertexBase[] = {0., 0., 1., 0., 0., 1., 1., 1.};
@@ -579,11 +685,15 @@
579 texCoords[i*2+1] = tex->getTexSize().height() * (1 - i / 2);685 texCoords[i*2+1] = tex->getTexSize().height() * (1 - i / 2);
580 }686 }
581 setTexCoordPointer(2, GL_FLOAT, texCoords);687 setTexCoordPointer(2, GL_FLOAT, texCoords);
582 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);688
583 glEnable(GL_BLEND);689 //text drawing requires blending, but we reset GL state afterwards if necessary
690 bool oldBlending = glState.blend;
691 GLenum oldSrc = glState.blendSrc, oldDst = glState.blendDst;
692 setBlending(true);
584 enableClientStates(true, true);693 enableClientStates(true, true);
585 setVertexPointer(2, GL_FLOAT, vertexData);694 setVertexPointer(2, GL_FLOAT, vertexData);
586 drawFromArray(TriangleStrip, 4, 0, false);695 drawFromArray(TriangleStrip, 4, 0, false);
696 setBlending(oldBlending, oldSrc, oldDst);
587 enableClientStates(false, false);697 enableClientStates(false, false);
588 tex->texture->release();698 tex->texture->release();
589 delete[] texCoords;699 delete[] texCoords;
@@ -598,7 +708,6 @@
598 // painter.setFont(currentFont);708 // painter.setFont(currentFont);
599 709
600 QPainter painter(&device);710 QPainter painter(&device);
601 painter.beginNativePainting();
602 711
603 QFont tmpFont = currentFont;712 QFont tmpFont = currentFont;
604 tmpFont.setPixelSize(currentFont.pixelSize()*prj->getDevicePixelsPerPixel()*StelApp::getInstance().getGlobalScalingRatio());713 tmpFont.setPixelSize(currentFont.pixelSize()*prj->getDevicePixelsPerPixel()*StelApp::getInstance().getGlobalScalingRatio());
@@ -629,7 +738,11 @@
629 painter.drawText(x+xshift, y+yshift, str);738 painter.drawText(x+xshift, y+yshift, str);
630 }739 }
631 740
632 painter.endNativePainting();741 //important to call this before GL state restore
742 painter.end();
743
744 //QPainter messes up some GL state, begin/endNativePainting or save/restore does not help
745 glState.apply();
633 }746 }
634}747}
635748
@@ -1462,6 +1575,8 @@
1462 if (!prj->getBoundingCap().intersects(poly->getBoundingCap()))1575 if (!prj->getBoundingCap().intersects(poly->getBoundingCap()))
1463 return;1576 return;
14641577
1578 bool oldCullFace = glState.cullFace;
1579
1465 switch (drawMode)1580 switch (drawMode)
1466 {1581 {
1467 case SphericalPolygonDrawModeBoundary:1582 case SphericalPolygonDrawModeBoundary:
@@ -1473,7 +1588,7 @@
1473 case SphericalPolygonDrawModeFill:1588 case SphericalPolygonDrawModeFill:
1474 case SphericalPolygonDrawModeTextureFill:1589 case SphericalPolygonDrawModeTextureFill:
1475 case SphericalPolygonDrawModeTextureFillColormodulated:1590 case SphericalPolygonDrawModeTextureFillColormodulated:
1476 glEnable(GL_CULL_FACE);1591 setCullFace(true);
1477 // The polygon is already tesselated as triangles1592 // The polygon is already tesselated as triangles
1478 if (doSubDivise || prj->intersectViewportDiscontinuity(poly->getBoundingCap()))1593 if (doSubDivise || prj->intersectViewportDiscontinuity(poly->getBoundingCap()))
1479 // flag for color-modulated textured mode (e.g. for Milky Way/extincted)1594 // flag for color-modulated textured mode (e.g. for Milky Way/extincted)
@@ -1481,7 +1596,7 @@
1481 else1596 else
1482 drawStelVertexArray(poly->getFillVertexArray(), false);1597 drawStelVertexArray(poly->getFillVertexArray(), false);
14831598
1484 glDisable(GL_CULL_FACE);1599 setCullFace(oldCullFace);
1485 break;1600 break;
1486 default:1601 default:
1487 Q_ASSERT(0);1602 Q_ASSERT(0);
@@ -1822,11 +1937,6 @@
1822 glCullFace(GL_BACK);1937 glCullFace(GL_BACK);
1823}1938}
18241939
1825void StelPainter::enableTexture2d(bool b)
1826{
1827 texture2dEnabled = b;
1828}
1829
1830void StelPainter::initGLShaders()1940void StelPainter::initGLShaders()
1831{1941{
1832 qDebug() << "Initializing basic GL shaders... ";1942 qDebug() << "Initializing basic GL shaders... ";
18331943
=== modified file 'src/core/StelPainter.hpp'
--- src/core/StelPainter.hpp 2016-05-01 05:52:39 +0000
+++ src/core/StelPainter.hpp 2017-01-12 21:08:38 +0000
@@ -1,4 +1,4 @@
1/*1/*
2 * Stellarium2 * Stellarium
3 * Copyright (C) 2008 Fabien Chereau3 * Copyright (C) 2008 Fabien Chereau
4 *4 *
@@ -37,7 +37,7 @@
37//! Because openGL is not thread safe, only one instance of StelPainter can exist at a time, enforcing thread safety.37//! Because openGL is not thread safe, only one instance of StelPainter can exist at a time, enforcing thread safety.
38//! As a coding rule, no openGL calls should be performed when no instance of StelPainter exist.38//! As a coding rule, no openGL calls should be performed when no instance of StelPainter exist.
39//! Typical usage is to create a local instance of StelPainter where drawing operations are needed.39//! Typical usage is to create a local instance of StelPainter where drawing operations are needed.
40class StelPainter40class StelPainter : protected QOpenGLFunctions
41{41{
42public:42public:
43 friend class VertexArrayProjector;43 friend class VertexArrayProjector;
@@ -66,6 +66,11 @@
66 explicit StelPainter(const StelProjectorP& prj);66 explicit StelPainter(const StelProjectorP& prj);
67 ~StelPainter();67 ~StelPainter();
6868
69 //! Returns a QOpenGLFunctions object suitable for drawing directly with OpenGL while this StelPainter is active.
70 //! This is recommended to be used instead of QOpenGLContext::currentContext()->functions() when a StelPainter is available,
71 //! and you only need to call a few GL functions directly.
72 inline QOpenGLFunctions* glFuncs() { return this; }
73
69 //! Return the instance of projector associated to this painter74 //! Return the instance of projector associated to this painter
70 const StelProjectorP& getProjector() const {return prj;}75 const StelProjectorP& getProjector() const {return prj;}
71 void setProjector(const StelProjectorP& p);76 void setProjector(const StelProjectorP& p);
@@ -227,6 +232,25 @@
227 //! Get the font metrics for the current font.232 //! Get the font metrics for the current font.
228 QFontMetrics getFontMetrics() const;233 QFontMetrics getFontMetrics() const;
229234
235 //! Enable OpenGL blending. By default, blending is disabled.
236 //! The additional parameters specify the blending mode, the default parameters are suitable for
237 //! "normal" blending operations that you want in most cases. Blending will be automatically disabled when
238 //! the StelPainter is destroyed.
239 void setBlending(bool enableBlending, GLenum blendSrc = GL_SRC_ALPHA, GLenum blendDst = GL_ONE_MINUS_SRC_ALPHA);
240
241 void setDepthTest(bool enable);
242
243 void setDepthMask(bool enable);
244
245 //! Set the OpenGL GL_CULL_FACE state, by default face culling is disabled
246 void setCullFace(bool enable);
247
248 //! Enables/disables line smoothing. By default, smoothing is disabled.
249 void setLineSmooth(bool enable);
250
251 //! Sets the line width. Default is 1.0f.
252 void setLineWidth(float width);
253
230 //! Create the OpenGL shaders programs used by the StelPainter.254 //! Create the OpenGL shaders programs used by the StelPainter.
231 //! This method needs to be called once at init.255 //! This method needs to be called once at init.
232 static void initGLShaders();256 static void initGLShaders();
@@ -235,9 +259,6 @@
235 //! This method needs to be called once before exit.259 //! This method needs to be called once before exit.
236 static void deinitGLShaders();260 static void deinitGLShaders();
237261
238 //! Set whether texturing is enabled.
239 void enableTexture2d(bool b);
240
241 // Thoses methods should eventually be replaced by a single setVertexArray262 // Thoses methods should eventually be replaced by a single setVertexArray
242 //! use instead of glVertexPointer263 //! use instead of glVertexPointer
243 void setVertexPointer(int size, int type, const void* pointer) {264 void setVertexPointer(int size, int type, const void* pointer) {
@@ -262,7 +283,7 @@
262 normalArray.size = 3; normalArray.type = type; normalArray.pointer = pointer;283 normalArray.size = 3; normalArray.type = type; normalArray.pointer = pointer;
263 }284 }
264285
265 //! use instead of glEnableClient286 //! Simulates glEnableClientState, basically you describe what data the ::drawFromArray call has available
266 void enableClientStates(bool vertex, bool texture=false, bool color=false, bool normal=false);287 void enableClientStates(bool vertex, bool texture=false, bool color=false, bool normal=false);
267288
268 //! convenience method that enable and set all the given arrays.289 //! convenience method that enable and set all the given arrays.
@@ -290,17 +311,27 @@
290 friend class StelTextureMgr;311 friend class StelTextureMgr;
291 friend class StelTexture;312 friend class StelTexture;
292313
293 //! RAII class used to store and restore the opengl state.314 //! Helper struct to track the GL state and restore it to canonical values on StelPainter creation/destruction
294 //! to use it we just need to instanciate it at the beginning of a method that might change the state.315 struct GLState
295 class GLState
296 {316 {
297 public:317 GLState(QOpenGLFunctions *gl);
298 GLState();318
299 ~GLState();319 bool blend;
320 GLenum blendSrc, blendDst;
321 bool depthTest;
322 bool depthMask;
323 bool cullFace;
324 bool lineSmooth;
325 GLfloat lineWidth;
326
327 //! Applies the values stored here to set the GL state
328 void apply();
329 //! Resets the state to the default values (like a GLState was newly constructed)
330 //! and calls apply()
331 void reset();
300 private:332 private:
301 bool blend;333 QOpenGLFunctions* gl;
302 int blendSrcRGB, blendDstRGB, blendSrcAlpha, blendDstAlpha;334 } glState;
303 };
304335
305 // From text-use-opengl-buffer336 // From text-use-opengl-buffer
306 static QCache<QByteArray, struct StringTexture> texCache;337 static QCache<QByteArray, struct StringTexture> texCache;
@@ -352,7 +383,6 @@
352 QFont currentFont;383 QFont currentFont;
353384
354 Vec4f currentColor;385 Vec4f currentColor;
355 bool texture2dEnabled;
356 386
357 static QOpenGLShaderProgram* basicShaderProgram;387 static QOpenGLShaderProgram* basicShaderProgram;
358 struct BasicShaderVars {388 struct BasicShaderVars {
359389
=== modified file 'src/core/StelSkyDrawer.cpp'
--- src/core/StelSkyDrawer.cpp 2017-01-06 02:19:00 +0000
+++ src/core/StelSkyDrawer.cpp 2017-01-12 21:08:38 +0000
@@ -17,12 +17,6 @@
17 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.17 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18 */18 */
1919
20#ifndef GL_POINT_SPRITE
21 #define GL_POINT_SPRITE 0x8861
22#endif
23#ifndef GL_VERTEX_PROGRAM_POINT_SIZE
24 #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
25#endif
2620
27#include "StelSkyDrawer.hpp"21#include "StelSkyDrawer.hpp"
28#include "StelProjector.hpp"22#include "StelProjector.hpp"
@@ -156,6 +150,8 @@
156// Init parameters from config file150// Init parameters from config file
157void StelSkyDrawer::init()151void StelSkyDrawer::init()
158{152{
153 initializeOpenGLFunctions();
154
159 // Load star texture no mipmap:155 // Load star texture no mipmap:
160 texHalo = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/star16x16.png");156 texHalo = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/star16x16.png");
161 texBigHalo = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/haloLune.png");157 texBigHalo = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/haloLune.png");
@@ -382,9 +378,7 @@
382378
383 // Blending is really important. Otherwise faint stars in the vicinity of379 // Blending is really important. Otherwise faint stars in the vicinity of
384 // bright star will cause tiny black squares on the bright star, e.g. see Procyon.380 // bright star will cause tiny black squares on the bright star, e.g. see Procyon.
The diff has been truncated for viewing.