Merge lp:~fschauk/stellarium/qopenglwidget into lp:stellarium
- qopenglwidget
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Fabien Chéreau | Approve | ||
gzotti | Approve | ||
Review via email: mp+314653@code.launchpad.net |
Commit message
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.
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?
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.
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
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2017-01-03 08:56:34 +0000 | |||
3 | +++ CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
4 | @@ -16,6 +16,9 @@ | |||
5 | 16 | CMAKE_POLICY(SET CMP0054 OLD) | 16 | CMAKE_POLICY(SET CMP0054 OLD) |
6 | 17 | ENDIF() | 17 | ENDIF() |
7 | 18 | 18 | ||
8 | 19 | # warn about deprecated stuff so that we may try fixing it | ||
9 | 20 | SET(CMAKE_WARN_DEPRECATED 1) | ||
10 | 21 | |||
11 | 19 | ########### Project name ########### | 22 | ########### Project name ########### |
12 | 20 | PROJECT(Stellarium) | 23 | PROJECT(Stellarium) |
13 | 21 | # Use integer versions instead of strings for easier handling if required | 24 | # Use integer versions instead of strings for easier handling if required |
14 | @@ -37,6 +40,7 @@ | |||
15 | 37 | # Write version of Stellarium to Stellarium User Guide | 40 | # Write version of Stellarium to Stellarium User Guide |
16 | 38 | FILE(WRITE ${PROJECT_SOURCE_DIR}/guide/version.tex "\\newcommand{\\StelVersion}{${VERSION}}\n") | 41 | FILE(WRITE ${PROJECT_SOURCE_DIR}/guide/version.tex "\\newcommand{\\StelVersion}{${VERSION}}\n") |
17 | 39 | 42 | ||
18 | 43 | # currently Qt 5.4 - 5.6 is recommended, we can still build with Qt 5.3, and 5.7 may have some bugs | ||
19 | 40 | SET(MINIMAL_QT_VERSION "5.3.0") | 44 | SET(MINIMAL_QT_VERSION "5.3.0") |
20 | 41 | 45 | ||
21 | 42 | # Use customized cmake macros | 46 | # Use customized cmake macros |
22 | @@ -58,6 +62,13 @@ | |||
23 | 58 | ADD_DEFINITIONS(-DQT_NO_DEBUG -DNDEBUG) | 62 | ADD_DEFINITIONS(-DQT_NO_DEBUG -DNDEBUG) |
24 | 59 | endif() | 63 | endif() |
25 | 60 | 64 | ||
26 | 65 | set(OPENGL_DEBUG_LOGGING 0 CACHE BOOL "Enable to log OpenGL information using the GL_KHR_debug extension/QOpenGLLogger") | ||
27 | 66 | if(OPENGL_DEBUG_LOGGING) | ||
28 | 67 | add_definitions(-DOPENGL_DEBUG_LOGGING) | ||
29 | 68 | # This enables logging of QOpenGLFunctions through forced glGetError after each call | ||
30 | 69 | add_definitions(-DQ_ENABLE_OPENGL_FUNCTIONS_DEBUG) | ||
31 | 70 | endif() | ||
32 | 71 | |||
33 | 61 | # Use ccache if possible | 72 | # Use ccache if possible |
34 | 62 | find_program(CCACHE_PROGRAM ccache) | 73 | find_program(CCACHE_PROGRAM ccache) |
35 | 63 | if(CCACHE_PROGRAM) | 74 | if(CCACHE_PROGRAM) |
36 | @@ -276,6 +287,7 @@ | |||
37 | 276 | ADD_PLUGIN(Exoplanets 1) | 287 | ADD_PLUGIN(Exoplanets 1) |
38 | 277 | ADD_PLUGIN(EquationOfTime 1) | 288 | ADD_PLUGIN(EquationOfTime 1) |
39 | 278 | ADD_PLUGIN(FOV 1) | 289 | ADD_PLUGIN(FOV 1) |
40 | 290 | # TODO: Logbook build is broken for quite some time | ||
41 | 279 | ADD_PLUGIN(LogBook 0) | 291 | ADD_PLUGIN(LogBook 0) |
42 | 280 | ADD_PLUGIN(MeteorShowers 1) | 292 | ADD_PLUGIN(MeteorShowers 1) |
43 | 281 | ADD_PLUGIN(NavStars 1) | 293 | ADD_PLUGIN(NavStars 1) |
44 | @@ -318,8 +330,9 @@ | |||
45 | 318 | FIND_PACKAGE(Qt5Concurrent REQUIRED) | 330 | FIND_PACKAGE(Qt5Concurrent REQUIRED) |
46 | 319 | FIND_PACKAGE(Qt5Gui REQUIRED) | 331 | FIND_PACKAGE(Qt5Gui REQUIRED) |
47 | 320 | FIND_PACKAGE(Qt5Network REQUIRED) | 332 | FIND_PACKAGE(Qt5Network REQUIRED) |
48 | 321 | FIND_PACKAGE(Qt5OpenGL REQUIRED) | ||
49 | 322 | FIND_PACKAGE(Qt5Widgets REQUIRED) | 333 | FIND_PACKAGE(Qt5Widgets REQUIRED) |
50 | 334 | # required for qcustomplot external dependency | ||
51 | 335 | # not used elsewhere | ||
52 | 323 | FIND_PACKAGE(Qt5PrintSupport REQUIRED) | 336 | FIND_PACKAGE(Qt5PrintSupport REQUIRED) |
53 | 324 | IF(USE_PLUGIN_TELESCOPECONTROL) | 337 | IF(USE_PLUGIN_TELESCOPECONTROL) |
54 | 325 | FIND_PACKAGE(Qt5SerialPort REQUIRED) | 338 | FIND_PACKAGE(Qt5SerialPort REQUIRED) |
55 | @@ -355,6 +368,38 @@ | |||
56 | 355 | ENDIF() | 368 | ENDIF() |
57 | 356 | ENDIF() | 369 | ENDIF() |
58 | 357 | 370 | ||
59 | 371 | # when using Qt 5.3, default to using the old QGLWidget, but warn | ||
60 | 372 | if(${Qt5Core_VERSION_STRING} VERSION_LESS "5.4") | ||
61 | 373 | set(USE_OLD_QGLWIDGET 1) | ||
62 | 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.") | ||
63 | 375 | else() | ||
64 | 376 | # offer the old widget as an alternative, default off | ||
65 | 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") | ||
66 | 378 | endif() | ||
67 | 379 | |||
68 | 380 | if(USE_OLD_QGLWIDGET) | ||
69 | 381 | add_definitions(-DUSE_OLD_QGLWIDGET) | ||
70 | 382 | find_package(Qt5OpenGL REQUIRED) | ||
71 | 383 | endif() | ||
72 | 384 | |||
73 | 385 | # Since Qt 5.4, linking to OpenGL is basically not required anymore, | ||
74 | 386 | # because the QtGui module re-implements the GL functions, and perhaps even | ||
75 | 387 | # dispatches the calls to a dynamically selected GL library. | ||
76 | 388 | # | ||
77 | 389 | # The only exception where this does not work with CMake is for | ||
78 | 390 | # ES2-only/ANGLE-only builds, which are seemingly not included in | ||
79 | 391 | # official Qt downloads, but may be required as a custom build | ||
80 | 392 | # for some embedded systems. Interestingly, this works with qmake, | ||
81 | 393 | # but CMake needs an explicit link definition. | ||
82 | 394 | # See also this bug: https://bugreports.qt.io/browse/QTBUG-29132 | ||
83 | 395 | |||
84 | 396 | # Check if we have a GLES-only build | ||
85 | 397 | # On dynamic builds, this property is also "GL" | ||
86 | 398 | if(${Qt5Gui_OPENGL_IMPLEMENTATION} MATCHES "GLES") | ||
87 | 399 | message(STATUS "Building an OpenGL ES build (${Qt5Gui_OPENGL_IMPLEMENTATION})") | ||
88 | 400 | set(STEL_GLES_LIBS Qt5::Gui_EGL Qt5::Gui_GLESv2) | ||
89 | 401 | endif() | ||
90 | 402 | |||
91 | 358 | 403 | ||
92 | 359 | # Tell CMake to run moc when necessary: | 404 | # Tell CMake to run moc when necessary: |
93 | 360 | set(CMAKE_AUTOMOC ON) | 405 | set(CMAKE_AUTOMOC ON) |
94 | @@ -362,31 +407,38 @@ | |||
95 | 362 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | 407 | set(CMAKE_INCLUDE_CURRENT_DIR ON) |
96 | 363 | 408 | ||
97 | 364 | IF(ENABLE_SCRIPTING) | 409 | IF(ENABLE_SCRIPTING) |
98 | 365 | SET(QT_USE_QTSCRIPT TRUE) | ||
99 | 366 | FIND_PACKAGE(Qt5Script REQUIRED) | 410 | FIND_PACKAGE(Qt5Script REQUIRED) |
100 | 367 | INCLUDE_DIRECTORIES(${Qt5Script_INCLUDE_DIRS}) | ||
101 | 368 | ENDIF() | 411 | ENDIF() |
102 | 369 | IF(ENABLE_MEDIA) | 412 | IF(ENABLE_MEDIA) |
103 | 370 | ADD_DEFINITIONS(-DENABLE_MEDIA) | 413 | ADD_DEFINITIONS(-DENABLE_MEDIA) |
104 | 371 | FIND_PACKAGE(Qt5Multimedia REQUIRED) | 414 | FIND_PACKAGE(Qt5Multimedia REQUIRED) |
105 | 372 | FIND_PACKAGE(Qt5MultimediaWidgets REQUIRED) | 415 | FIND_PACKAGE(Qt5MultimediaWidgets REQUIRED) |
106 | 373 | INCLUDE_DIRECTORIES(${Qt5Multimedia_INCLUDE_DIRS}) | ||
107 | 374 | INCLUDE_DIRECTORIES(${Qt5MultimediaWidgets_INCLUDE_DIRS}) | ||
108 | 375 | ENDIF() | ||
109 | 376 | |||
110 | 377 | # I add this test because on Windows with angle we should not link | ||
111 | 378 | # with OpenGL. Maybe there is a better way to do that. | ||
112 | 379 | IF("${Qt5Gui_OPENGL_LIBRARIES}" MATCHES "opengl") | ||
113 | 380 | FIND_PACKAGE(OpenGL REQUIRED) | ||
114 | 381 | ENDIF() | ||
115 | 382 | IF(NOT WIN32) | ||
116 | 383 | FIND_PACKAGE(ZLIB) | ||
117 | 384 | ELSE() | ||
118 | 385 | SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/core/external/zlib) | ||
119 | 386 | ENDIF() | 416 | ENDIF() |
120 | 387 | 417 | ||
121 | 388 | FIND_PACKAGE(Qt5Test) | 418 | FIND_PACKAGE(Qt5Test) |
123 | 389 | INCLUDE_DIRECTORIES(${Qt5Test_INCLUDE_DIRS}) | 419 | |
124 | 420 | ### Setup external packages | ||
125 | 421 | |||
126 | 422 | find_package(ZLIB QUIET) #quiet warnings about not found, we have our own version anyway | ||
127 | 423 | |||
128 | 424 | # if a system zlib is found, let the user choose if to instead use our bundled version | ||
129 | 425 | if(ZLIB_FOUND) | ||
130 | 426 | if(WIN32) #on win, we default to "no" | ||
131 | 427 | set(USE_SYSTEM_ZLIB 0 CACHE BOOL "Use system-provided zlib instead of the bundled version") | ||
132 | 428 | else() #else, we default to "yes" | ||
133 | 429 | set(USE_SYSTEM_ZLIB 1 CACHE BOOL "Use system-provided zlib instead of the bundled version") | ||
134 | 430 | endif() | ||
135 | 431 | else() | ||
136 | 432 | set(USE_SYSTEM_ZLIB 0) | ||
137 | 433 | endif() | ||
138 | 434 | |||
139 | 435 | if(NOT USE_SYSTEM_ZLIB) | ||
140 | 436 | #use our own zlib | ||
141 | 437 | message(STATUS "Using bundled zlib version at ${CMAKE_SOURCE_DIR}/src/external/zlib") | ||
142 | 438 | set(ZLIB_LIBRARIES zlib_stel) | ||
143 | 439 | else() | ||
144 | 440 | message(STATUS "Using system-provided zlib at ${ZLIB_LIBRARIES}") | ||
145 | 441 | endif() | ||
146 | 390 | 442 | ||
147 | 391 | ########### Set some global variables ########### | 443 | ########### Set some global variables ########### |
148 | 392 | IF(UNIX AND NOT WIN32) | 444 | IF(UNIX AND NOT WIN32) |
149 | @@ -408,7 +460,6 @@ | |||
150 | 408 | ADD_DEFINITIONS(-DINSTALL_LOCALEDIR_FOR_DEBUG="${CMAKE_SOURCE_DIR}") | 460 | ADD_DEFINITIONS(-DINSTALL_LOCALEDIR_FOR_DEBUG="${CMAKE_SOURCE_DIR}") |
151 | 409 | endif() | 461 | endif() |
152 | 410 | 462 | ||
153 | 411 | |||
154 | 412 | ########### Get revision number for non-release builds ########### | 463 | ########### Get revision number for non-release builds ########### |
155 | 413 | IF(NOT STELLARIUM_RELEASE_BUILD) | 464 | IF(NOT STELLARIUM_RELEASE_BUILD) |
156 | 414 | # Hack until CMake detection for Bazaar is finished | 465 | # Hack until CMake detection for Bazaar is finished |
157 | @@ -502,12 +553,12 @@ | |||
158 | 502 | GET_TARGET_PROPERTY(QtConcurrent_location Qt5::Concurrent LOCATION) | 553 | GET_TARGET_PROPERTY(QtConcurrent_location Qt5::Concurrent LOCATION) |
159 | 503 | GET_TARGET_PROPERTY(QtCore_location Qt5::Core LOCATION) | 554 | GET_TARGET_PROPERTY(QtCore_location Qt5::Core LOCATION) |
160 | 504 | GET_TARGET_PROPERTY(QtGui_location Qt5::Gui LOCATION) | 555 | GET_TARGET_PROPERTY(QtGui_location Qt5::Gui LOCATION) |
161 | 505 | GET_TARGET_PROPERTY(QtOpenGL_location Qt5::OpenGL LOCATION) | ||
162 | 506 | GET_TARGET_PROPERTY(QtNetwork_location Qt5::Network LOCATION) | 556 | GET_TARGET_PROPERTY(QtNetwork_location Qt5::Network LOCATION) |
163 | 507 | GET_TARGET_PROPERTY(QtWidgets_location Qt5::Widgets LOCATION) | 557 | GET_TARGET_PROPERTY(QtWidgets_location Qt5::Widgets LOCATION) |
164 | 508 | GET_TARGET_PROPERTY(QtSql_location Qt5::Sql LOCATION) | 558 | GET_TARGET_PROPERTY(QtSql_location Qt5::Sql LOCATION) |
165 | 509 | GET_TARGET_PROPERTY(QtXmlPatterns_location Qt5::XmlPatterns LOCATION) | 559 | GET_TARGET_PROPERTY(QtXmlPatterns_location Qt5::XmlPatterns LOCATION) |
166 | 510 | GET_TARGET_PROPERTY(QtPrintSupport_location Qt5::PrintSupport LOCATION) | 560 | GET_TARGET_PROPERTY(QtPrintSupport_location Qt5::PrintSupport LOCATION) |
167 | 561 | SET(ISS_QT_PRINTSUPPORT "Source: \"${QtPrintSupport_location}\"; DestDir: \"{app}\";") | ||
168 | 511 | IF(ENABLE_SCRIPTING) | 562 | IF(ENABLE_SCRIPTING) |
169 | 512 | GET_TARGET_PROPERTY(QtScript_location Qt5::Script LOCATION) | 563 | GET_TARGET_PROPERTY(QtScript_location Qt5::Script LOCATION) |
170 | 513 | SET(ISS_QT_SCRIPT "Source: \"${QtScript_location}\"; DestDir: \"{app}\";") | 564 | SET(ISS_QT_SCRIPT "Source: \"${QtScript_location}\"; DestDir: \"{app}\";") |
171 | @@ -685,16 +736,10 @@ | |||
172 | 685 | ${CMAKE_SOURCE_DIR}/src/core | 736 | ${CMAKE_SOURCE_DIR}/src/core |
173 | 686 | ${CMAKE_SOURCE_DIR}/src/core/modules | 737 | ${CMAKE_SOURCE_DIR}/src/core/modules |
174 | 687 | ${CMAKE_SOURCE_DIR}/src/core/planetsephems | 738 | ${CMAKE_SOURCE_DIR}/src/core/planetsephems |
175 | 688 | ${CMAKE_SOURCE_DIR}/src/core/external | ||
176 | 689 | ${CMAKE_SOURCE_DIR}/src/core/external/qtcompress | ||
177 | 690 | ${CMAKE_SOURCE_DIR}/src/core/external/qcustomplot | ||
178 | 691 | ${CMAKE_SOURCE_DIR}/src/core/external/glues_stel/source/ | ||
179 | 692 | ${CMAKE_SOURCE_DIR}/src/core/external/glues_stel/source/libtess | ||
180 | 693 | ${CMAKE_SOURCE_DIR}/src/gui | 739 | ${CMAKE_SOURCE_DIR}/src/gui |
181 | 694 | ${CMAKE_SOURCE_DIR}/src/scripting | 740 | ${CMAKE_SOURCE_DIR}/src/scripting |
182 | 695 | ${INTL_INCLUDE_DIR} | 741 | ${INTL_INCLUDE_DIR} |
183 | 696 | ${CMAKE_BINARY_DIR}/src | 742 | ${CMAKE_BINARY_DIR}/src |
184 | 697 | ${ZLIB_INCLUDE_DIR} | ||
185 | 698 | ) | 743 | ) |
186 | 699 | 744 | ||
187 | 700 | ########### Subdirectories ############### | 745 | ########### Subdirectories ############### |
188 | 701 | 746 | ||
189 | === modified file 'cmake/default_config.ini.cmake' | |||
190 | --- cmake/default_config.ini.cmake 2016-10-29 12:45:33 +0000 | |||
191 | +++ cmake/default_config.ini.cmake 2017-01-12 21:08:38 +0000 | |||
192 | @@ -22,6 +22,7 @@ | |||
193 | 22 | maximum_fps = 10000 | 22 | maximum_fps = 10000 |
194 | 23 | #viewport_effect = sphericMirrorDistorter | 23 | #viewport_effect = sphericMirrorDistorter |
195 | 24 | viewport_effect = none | 24 | viewport_effect = none |
196 | 25 | vsync = true | ||
197 | 25 | 26 | ||
198 | 26 | [projection] | 27 | [projection] |
199 | 27 | type = ProjectionStereographic | 28 | type = ProjectionStereographic |
200 | 28 | 29 | ||
201 | === modified file 'cmake/stellarium.iss.cmake' | |||
202 | --- cmake/stellarium.iss.cmake 2017-01-03 08:56:34 +0000 | |||
203 | +++ cmake/stellarium.iss.cmake 2017-01-12 21:08:38 +0000 | |||
204 | @@ -47,13 +47,12 @@ | |||
205 | 47 | Source: "@CMAKE_SOURCE_DIR@\ChangeLog"; DestDir: "{app}"; Flags: ignoreversion; DestName: "ChangeLog.rtf" | 47 | Source: "@CMAKE_SOURCE_DIR@\ChangeLog"; DestDir: "{app}"; Flags: ignoreversion; DestName: "ChangeLog.rtf" |
206 | 48 | Source: "@QtCore_location@"; DestDir: "{app}"; | 48 | Source: "@QtCore_location@"; DestDir: "{app}"; |
207 | 49 | Source: "@QtGui_location@"; DestDir: "{app}"; | 49 | Source: "@QtGui_location@"; DestDir: "{app}"; |
208 | 50 | Source: "@QtOpenGL_location@"; DestDir: "{app}"; | ||
209 | 51 | Source: "@QtNetwork_location@"; DestDir: "{app}"; | 50 | Source: "@QtNetwork_location@"; DestDir: "{app}"; |
210 | 52 | Source: "@QtWidgets_location@"; DestDir: "{app}"; | 51 | Source: "@QtWidgets_location@"; DestDir: "{app}"; |
211 | 53 | Source: "@QtSql_location@"; DestDir: "{app}"; | 52 | Source: "@QtSql_location@"; DestDir: "{app}"; |
212 | 54 | Source: "@QtXmlPatterns_location@"; DestDir: "{app}"; | 53 | Source: "@QtXmlPatterns_location@"; DestDir: "{app}"; |
213 | 55 | Source: "@QtConcurrent_location@"; DestDir: "{app}"; | 54 | Source: "@QtConcurrent_location@"; DestDir: "{app}"; |
215 | 56 | Source: "@QtPrintSupport_location@"; DestDir: "{app}"; | 55 | @ISS_QT_PRINTSUPPORT@ |
216 | 57 | @ISS_QT_SCRIPT@ | 56 | @ISS_QT_SCRIPT@ |
217 | 58 | @ISS_QT_MULTIMEDIA@ | 57 | @ISS_QT_MULTIMEDIA@ |
218 | 59 | @ISS_QT_SERIALPORT@ | 58 | @ISS_QT_SERIALPORT@ |
219 | 60 | 59 | ||
220 | === modified file 'data/shaders/s3d_pixellit.frag' | |||
221 | --- data/shaders/s3d_pixellit.frag 2015-09-11 16:34:17 +0000 | |||
222 | +++ data/shaders/s3d_pixellit.frag 2017-01-12 21:08:38 +0000 | |||
223 | @@ -32,6 +32,7 @@ | |||
224 | 32 | #define SHADOW_FILTER 0 | 32 | #define SHADOW_FILTER 0 |
225 | 33 | #define SHADOW_FILTER_HQ 0 | 33 | #define SHADOW_FILTER_HQ 0 |
226 | 34 | #define SINGLE_SHADOW_FRUSTUM 1 | 34 | #define SINGLE_SHADOW_FRUSTUM 1 |
227 | 35 | #define HW_SHADOW_SAMPLERS 0 | ||
228 | 35 | #define PCSS 0 | 36 | #define PCSS 0 |
229 | 36 | #define MAT_DIFFUSETEX 1 | 37 | #define MAT_DIFFUSETEX 1 |
230 | 37 | #define MAT_EMISSIVETEX 1 | 38 | #define MAT_EMISSIVETEX 1 |
231 | @@ -254,10 +255,10 @@ | |||
232 | 254 | #endif | 255 | #endif |
233 | 255 | //shadow related uniforms | 256 | //shadow related uniforms |
234 | 256 | uniform vec4 u_vSplits; //the frustum splits | 257 | uniform vec4 u_vSplits; //the frustum splits |
236 | 257 | #if PCSS | 258 | #if HW_SHADOW_SAMPLERS |
237 | 259 | #define SHADOWSAMPLER sampler2DShadow | ||
238 | 260 | #else | ||
239 | 258 | #define SHADOWSAMPLER sampler2D | 261 | #define SHADOWSAMPLER sampler2D |
240 | 259 | #else | ||
241 | 260 | #define SHADOWSAMPLER sampler2DShadow | ||
242 | 261 | #endif | 262 | #endif |
243 | 262 | 263 | ||
244 | 263 | //for some reason, Intel does absolutely not like it if the shadowmaps are passed as an array | 264 | //for some reason, Intel does absolutely not like it if the shadowmaps are passed as an array |
245 | @@ -311,23 +312,29 @@ | |||
246 | 311 | { | 312 | { |
247 | 312 | vec2 offset = poissonDisk[i] * filterRadiusUV; | 313 | vec2 offset = poissonDisk[i] * filterRadiusUV; |
248 | 313 | //TODO offsets should probably depend on light ortho size? | 314 | //TODO offsets should probably depend on light ortho size? |
250 | 314 | #if PCSS | 315 | #if HW_SHADOW_SAMPLERS |
251 | 316 | sum+=shadow2D(tex,vec3(texC.xy + offset, texC.z)).x; | ||
252 | 317 | #else | ||
253 | 315 | //texture is a normal sampler2D because we need depth values in blocker calculation | 318 | //texture is a normal sampler2D because we need depth values in blocker calculation |
254 | 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) |
255 | 317 | //so we have to do comparison ourselves | 320 | //so we have to do comparison ourselves |
256 | 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; |
257 | 319 | #else | ||
258 | 320 | sum+=shadow2D(tex,vec3(texC.xy + offset, texC.z)).x; | ||
259 | 321 | #endif | 322 | #endif |
260 | 322 | } | 323 | } |
261 | 323 | return sum / FILTER_STEPS; | 324 | return sum / FILTER_STEPS; |
263 | 324 | #else | 325 | #elif HW_SHADOW_SAMPLERS |
264 | 325 | //no filtering performed, just return the sampled tex | 326 | //no filtering performed, just return the sampled tex |
265 | 326 | return shadow2DProj(tex,coord).x; | 327 | return shadow2DProj(tex,coord).x; |
266 | 328 | #else | ||
267 | 329 | vec3 texC = coord.xyz / coord.w; | ||
268 | 330 | return texture2D(tex,texC.xy).x > texC.z ? 1.0f : 0.0f; | ||
269 | 327 | #endif | 331 | #endif |
270 | 328 | } | 332 | } |
271 | 329 | 333 | ||
272 | 330 | #if PCSS | 334 | #if PCSS |
273 | 335 | #if HW_SHADOW_SAMPLERS | ||
274 | 336 | #error Tried to compile PCSS shader compiled with HW shadow samplers | ||
275 | 337 | #endif | ||
276 | 331 | //Based on the PCSS implementation of NVidia, ported to GLSL | 338 | //Based on the PCSS implementation of NVidia, ported to GLSL |
277 | 332 | //see http://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf | 339 | //see http://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf |
278 | 333 | //Some modifications to work better with directional light are included | 340 | //Some modifications to work better with directional light are included |
279 | 334 | 341 | ||
280 | === modified file 'guide/version.tex' | |||
281 | --- guide/version.tex 2017-01-02 14:34:22 +0000 | |||
282 | +++ guide/version.tex 2017-01-12 21:08:38 +0000 | |||
283 | @@ -1,1 +1,1 @@ | |||
285 | 1 | \newcommand{\StelVersion}{0.90.0} | 1 | \newcommand{\StelVersion}{0.90.0} |
286 | 2 | 2 | ||
287 | === modified file 'plugins/AngleMeasure/src/AngleMeasure.cpp' | |||
288 | --- plugins/AngleMeasure/src/AngleMeasure.cpp 2017-01-06 16:52:05 +0000 | |||
289 | +++ plugins/AngleMeasure/src/AngleMeasure.cpp 2017-01-12 21:08:38 +0000 | |||
290 | @@ -34,7 +34,6 @@ | |||
291 | 34 | #include <QDebug> | 34 | #include <QDebug> |
292 | 35 | #include <QTimer> | 35 | #include <QTimer> |
293 | 36 | #include <QPixmap> | 36 | #include <QPixmap> |
294 | 37 | #include <QtNetwork> | ||
295 | 38 | #include <QSettings> | 37 | #include <QSettings> |
296 | 39 | #include <QKeyEvent> | 38 | #include <QKeyEvent> |
297 | 40 | #include <QMouseEvent> | 39 | #include <QMouseEvent> |
298 | @@ -188,9 +187,8 @@ | |||
299 | 188 | const StelProjectorP prj = core->getProjection(frameType, refractionMode); | 187 | const StelProjectorP prj = core->getProjection(frameType, refractionMode); |
300 | 189 | StelPainter painter(prj); | 188 | StelPainter painter(prj); |
301 | 190 | painter.setFont(font); | 189 | painter.setFont(font); |
302 | 190 | painter.setBlending(true); | ||
303 | 191 | 191 | ||
304 | 192 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
305 | 193 | glEnable(GL_BLEND); | ||
306 | 194 | if (lineVisible.getInterstate() > 0.000001f) | 192 | if (lineVisible.getInterstate() > 0.000001f) |
307 | 195 | { | 193 | { |
308 | 196 | Vec3d xy; | 194 | Vec3d xy; |
309 | @@ -220,12 +218,7 @@ | |||
310 | 220 | } | 218 | } |
311 | 221 | } | 219 | } |
312 | 222 | 220 | ||
319 | 223 | glDisable(GL_TEXTURE_2D); | 221 | painter.setLineSmooth(true); |
314 | 224 | // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH. But it looks much better. | ||
315 | 225 | #ifdef GL_LINE_SMOOTH | ||
316 | 226 | if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) | ||
317 | 227 | glEnable(GL_LINE_SMOOTH); | ||
318 | 228 | #endif | ||
320 | 229 | 222 | ||
321 | 230 | // main line is a great circle | 223 | // main line is a great circle |
322 | 231 | painter.setColor(lineColor[0], lineColor[1], lineColor[2], lineVisible.getInterstate()); | 224 | painter.setColor(lineColor[0], lineColor[1], lineColor[2], lineVisible.getInterstate()); |
323 | @@ -245,10 +238,8 @@ | |||
324 | 245 | painter.drawGreatCircleArc(perp1StartPointHor, perp1EndPointHor, NULL); | 238 | painter.drawGreatCircleArc(perp1StartPointHor, perp1EndPointHor, NULL); |
325 | 246 | painter.drawGreatCircleArc(perp2StartPointHor, perp2EndPointHor, NULL); | 239 | painter.drawGreatCircleArc(perp2StartPointHor, perp2EndPointHor, NULL); |
326 | 247 | } | 240 | } |
331 | 248 | #ifdef GL_LINE_SMOOTH | 241 | |
332 | 249 | if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) | 242 | painter.setLineSmooth(false); |
329 | 250 | glDisable(GL_LINE_SMOOTH); | ||
330 | 251 | #endif | ||
333 | 252 | } | 243 | } |
334 | 253 | if (messageFader.getInterstate() > 0.000001f) | 244 | if (messageFader.getInterstate() > 0.000001f) |
335 | 254 | { | 245 | { |
336 | @@ -262,7 +253,7 @@ | |||
337 | 262 | y -= ls; | 253 | y -= ls; |
338 | 263 | painter.drawText(x, y, messageRightButton); | 254 | painter.drawText(x, y, messageRightButton); |
339 | 264 | } | 255 | } |
341 | 265 | glDisable(GL_BLEND); | 256 | painter.setBlending(false); |
342 | 266 | } | 257 | } |
343 | 267 | 258 | ||
344 | 268 | //! Draw any parts on the screen which are for our module | 259 | //! Draw any parts on the screen which are for our module |
345 | 269 | 260 | ||
346 | === modified file 'plugins/AngleMeasure/src/CMakeLists.txt' | |||
347 | --- plugins/AngleMeasure/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
348 | +++ plugins/AngleMeasure/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
349 | @@ -18,12 +18,9 @@ | |||
350 | 18 | SET(AngleMeasure_RES ../AngleMeasure.qrc) | 18 | SET(AngleMeasure_RES ../AngleMeasure.qrc) |
351 | 19 | QT5_ADD_RESOURCES(AngleMeasure_RES_CXX ${AngleMeasure_RES}) | 19 | QT5_ADD_RESOURCES(AngleMeasure_RES_CXX ${AngleMeasure_RES}) |
352 | 20 | 20 | ||
353 | 21 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
354 | 22 | |||
355 | 23 | ADD_LIBRARY(AngleMeasure-static STATIC ${AngleMeasure_SRCS} ${AngleMeasure_RES_CXX} ${AngleMeasure_UIS_H}) | 21 | ADD_LIBRARY(AngleMeasure-static STATIC ${AngleMeasure_SRCS} ${AngleMeasure_RES_CXX} ${AngleMeasure_UIS_H}) |
357 | 24 | QT5_USE_MODULES(AngleMeasure-static Core Network Widgets) | 22 | TARGET_LINK_LIBRARIES(AngleMeasure-static Qt5::Core Qt5::Widgets) |
358 | 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. |
359 | 26 | SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES OUTPUT_NAME "AngleMeasure") | 24 | SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES OUTPUT_NAME "AngleMeasure") |
360 | 27 | TARGET_LINK_LIBRARIES(AngleMeasure-static ${extLinkerOption}) | ||
361 | 28 | SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 25 | SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
362 | 29 | ADD_DEPENDENCIES(AllStaticPlugins AngleMeasure-static) | 26 | ADD_DEPENDENCIES(AllStaticPlugins AngleMeasure-static) |
363 | 30 | 27 | ||
364 | === modified file 'plugins/ArchaeoLines/src/ArchaeoLines.cpp' | |||
365 | --- plugins/ArchaeoLines/src/ArchaeoLines.cpp 2016-12-24 10:33:14 +0000 | |||
366 | +++ plugins/ArchaeoLines/src/ArchaeoLines.cpp 2017-01-12 21:08:38 +0000 | |||
367 | @@ -37,7 +37,6 @@ | |||
368 | 37 | #include <QTimer> | 37 | #include <QTimer> |
369 | 38 | #include <QPixmap> | 38 | #include <QPixmap> |
370 | 39 | #include <QColor> | 39 | #include <QColor> |
371 | 40 | #include <QtNetwork> | ||
372 | 41 | #include <QSettings> | 40 | #include <QSettings> |
373 | 42 | #include <QMouseEvent> | 41 | #include <QMouseEvent> |
374 | 43 | #include <cmath> | 42 | #include <cmath> |
375 | @@ -1223,9 +1222,7 @@ | |||
376 | 1223 | 1222 | ||
377 | 1224 | d->sPainter->drawText(screenPos[0], screenPos[1], text, angleDeg, xshift, 3); | 1223 | d->sPainter->drawText(screenPos[0], screenPos[1], text, angleDeg, xshift, 3); |
378 | 1225 | //d->sPainter->setColor(tmpColor[0], tmpColor[1], tmpColor[2], tmpColor[3]); // RESTORE | 1224 | //d->sPainter->setColor(tmpColor[0], tmpColor[1], tmpColor[2], tmpColor[3]); // RESTORE |
382 | 1226 | glDisable(GL_TEXTURE_2D); | 1225 | d->sPainter->setBlending(true); |
380 | 1227 | glEnable(GL_BLEND); | ||
381 | 1228 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
383 | 1229 | } | 1226 | } |
384 | 1230 | 1227 | ||
385 | 1231 | 1228 | ||
386 | @@ -1324,16 +1321,8 @@ | |||
387 | 1324 | 1321 | ||
388 | 1325 | // Initialize a painter and set OpenGL state | 1322 | // Initialize a painter and set OpenGL state |
389 | 1326 | StelPainter sPainter(prj); | 1323 | StelPainter sPainter(prj); |
400 | 1327 | glEnable(GL_BLEND); | 1324 | sPainter.setBlending(true); |
401 | 1328 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | 1325 | sPainter.setLineSmooth(true); |
392 | 1329 | glDisable(GL_TEXTURE_2D); | ||
393 | 1330 | |||
394 | 1331 | // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH | ||
395 | 1332 | #ifdef GL_LINE_SMOOTH | ||
396 | 1333 | if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) | ||
397 | 1334 | glEnable(GL_LINE_SMOOTH); | ||
398 | 1335 | #endif | ||
399 | 1336 | |||
402 | 1337 | sPainter.setColor(color[0], color[1], color[2], intensity*fader.getInterstate()); | 1326 | sPainter.setColor(color[0], color[1], color[2], intensity*fader.getInterstate()); |
403 | 1338 | //Vec4f textColor(color[0], color[1], color[2], intensity*fader.getInterstate()); | 1327 | //Vec4f textColor(color[0], color[1], color[2], intensity*fader.getInterstate()); |
404 | 1339 | 1328 | ||
405 | @@ -1419,22 +1408,11 @@ | |||
406 | 1419 | sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, alViewportEdgeIntersectCallback, &userData); | 1408 | sPainter.drawSmallCircleArc(pt1, pt2, rotCenter, alViewportEdgeIntersectCallback, &userData); |
407 | 1420 | sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, alViewportEdgeIntersectCallback, &userData); | 1409 | sPainter.drawSmallCircleArc(pt2, pt3, rotCenter, alViewportEdgeIntersectCallback, &userData); |
408 | 1421 | sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, alViewportEdgeIntersectCallback, &userData); | 1410 | sPainter.drawSmallCircleArc(pt3, pt1, rotCenter, alViewportEdgeIntersectCallback, &userData); |
425 | 1422 | #ifdef GL_LINE_SMOOTH | 1411 | } |
426 | 1423 | if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) | 1412 | |
427 | 1424 | glDisable(GL_LINE_SMOOTH); | 1413 | sPainter.setLineSmooth(false); |
428 | 1425 | #endif | 1414 | sPainter.setBlending(false); |
429 | 1426 | glDisable(GL_BLEND); | 1415 | return; |
414 | 1427 | return; | ||
415 | 1428 | } | ||
416 | 1429 | else | ||
417 | 1430 | { | ||
418 | 1431 | #ifdef GL_LINE_SMOOTH | ||
419 | 1432 | if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) | ||
420 | 1433 | glDisable(GL_LINE_SMOOTH); | ||
421 | 1434 | #endif | ||
422 | 1435 | glDisable(GL_BLEND); | ||
423 | 1436 | return; | ||
424 | 1437 | } | ||
430 | 1438 | } | 1416 | } |
431 | 1439 | // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg | 1417 | // Draw the arc in 2 sub-arcs to avoid lengths > 180 deg |
432 | 1440 | Vec3d middlePoint = p1-rotCenter+p2-rotCenter; | 1418 | Vec3d middlePoint = p1-rotCenter+p2-rotCenter; |
433 | @@ -1451,11 +1429,6 @@ | |||
434 | 1451 | sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,alViewportEdgeIntersectCallback, &userData); | 1429 | sPainter.drawSmallCircleArc(p1, middlePoint, rotCenter,alViewportEdgeIntersectCallback, &userData); |
435 | 1452 | sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, alViewportEdgeIntersectCallback, &userData); | 1430 | sPainter.drawSmallCircleArc(p2, middlePoint, rotCenter, alViewportEdgeIntersectCallback, &userData); |
436 | 1453 | 1431 | ||
444 | 1454 | // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH | 1432 | sPainter.setLineSmooth(false); |
445 | 1455 | #ifdef GL_LINE_SMOOTH | 1433 | sPainter.setBlending(false); |
439 | 1456 | if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) | ||
440 | 1457 | glDisable(GL_LINE_SMOOTH); | ||
441 | 1458 | #endif | ||
442 | 1459 | |||
443 | 1460 | glDisable(GL_BLEND); | ||
446 | 1461 | } | 1434 | } |
447 | 1462 | 1435 | ||
448 | === modified file 'plugins/ArchaeoLines/src/CMakeLists.txt' | |||
449 | --- plugins/ArchaeoLines/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
450 | +++ plugins/ArchaeoLines/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
451 | @@ -18,12 +18,9 @@ | |||
452 | 18 | SET(ArchaeoLines_RES ../ArchaeoLines.qrc) | 18 | SET(ArchaeoLines_RES ../ArchaeoLines.qrc) |
453 | 19 | QT5_ADD_RESOURCES(ArchaeoLines_RES_CXX ${ArchaeoLines_RES}) | 19 | QT5_ADD_RESOURCES(ArchaeoLines_RES_CXX ${ArchaeoLines_RES}) |
454 | 20 | 20 | ||
455 | 21 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
456 | 22 | |||
457 | 23 | ADD_LIBRARY(ArchaeoLines-static STATIC ${ArchaeoLines_SRCS} ${ArchaeoLines_RES_CXX} ${ArchaeoLines_UIS_H}) | 21 | ADD_LIBRARY(ArchaeoLines-static STATIC ${ArchaeoLines_SRCS} ${ArchaeoLines_RES_CXX} ${ArchaeoLines_UIS_H}) |
459 | 24 | QT5_USE_MODULES(ArchaeoLines-static Core Network Widgets) | 22 | TARGET_LINK_LIBRARIES(ArchaeoLines-static Qt5::Core Qt5::Widgets) |
460 | 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. |
461 | 26 | SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES OUTPUT_NAME "ArchaeoLines") | 24 | SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES OUTPUT_NAME "ArchaeoLines") |
462 | 27 | TARGET_LINK_LIBRARIES(ArchaeoLines-static ${extLinkerOption}) | ||
463 | 28 | SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 25 | SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
464 | 29 | ADD_DEPENDENCIES(AllStaticPlugins ArchaeoLines-static) | 26 | ADD_DEPENDENCIES(AllStaticPlugins ArchaeoLines-static) |
465 | 30 | 27 | ||
466 | === modified file 'plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp' | |||
467 | --- plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp 2017-01-05 15:28:52 +0000 | |||
468 | +++ plugins/ArchaeoLines/src/gui/ArchaeoLinesDialog.cpp 2017-01-12 21:08:38 +0000 | |||
469 | @@ -222,8 +222,8 @@ | |||
470 | 222 | #ifndef Q_OS_WIN | 222 | #ifndef Q_OS_WIN |
471 | 223 | ui->switchToWindowedModeLabel->hide(); | 223 | ui->switchToWindowedModeLabel->hide(); |
472 | 224 | #else | 224 | #else |
475 | 225 | QString glRenderer(reinterpret_cast<const char*>(glGetString(GL_RENDERER))); | 225 | // don't call GL functions in GUI code please |
476 | 226 | if (glRenderer.startsWith("ANGLE", Qt::CaseSensitive)) | 226 | if (StelMainView::getInstance().getGLInformation().renderer.startsWith("ANGLE", Qt::CaseSensitive)) |
477 | 227 | ui->switchToWindowedModeLabel->hide(); | 227 | ui->switchToWindowedModeLabel->hide(); |
478 | 228 | #endif | 228 | #endif |
479 | 229 | setAboutHtml(); | 229 | setAboutHtml(); |
480 | 230 | 230 | ||
481 | === modified file 'plugins/CompassMarks/src/CMakeLists.txt' | |||
482 | --- plugins/CompassMarks/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
483 | +++ plugins/CompassMarks/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
484 | @@ -8,12 +8,10 @@ | |||
485 | 8 | 8 | ||
486 | 9 | SET(CompassMarks_RES ../CompassMarks.qrc) | 9 | SET(CompassMarks_RES ../CompassMarks.qrc) |
487 | 10 | QT5_ADD_RESOURCES(CompassMarks_RES_CXX ${CompassMarks_RES}) | 10 | QT5_ADD_RESOURCES(CompassMarks_RES_CXX ${CompassMarks_RES}) |
488 | 11 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
489 | 12 | 11 | ||
490 | 13 | ADD_LIBRARY(CompassMarks-static STATIC ${CompassMarks_SRCS} ${CompassMarks_RES_CXX}) | 12 | ADD_LIBRARY(CompassMarks-static STATIC ${CompassMarks_SRCS} ${CompassMarks_RES_CXX}) |
492 | 14 | QT5_USE_MODULES(CompassMarks-static Core Network Widgets) | 13 | TARGET_LINK_LIBRARIES(CompassMarks-static Qt5::Core Qt5::Widgets) |
493 | 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. |
494 | 16 | SET_TARGET_PROPERTIES(CompassMarks-static PROPERTIES OUTPUT_NAME "CompassMarks") | 15 | SET_TARGET_PROPERTIES(CompassMarks-static PROPERTIES OUTPUT_NAME "CompassMarks") |
495 | 17 | TARGET_LINK_LIBRARIES(CompassMarks-static ${extLinkerOption}) | ||
496 | 18 | SET_TARGET_PROPERTIES(CompassMarks-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 16 | SET_TARGET_PROPERTIES(CompassMarks-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
497 | 19 | ADD_DEPENDENCIES(AllStaticPlugins CompassMarks-static) | 17 | ADD_DEPENDENCIES(AllStaticPlugins CompassMarks-static) |
498 | 20 | 18 | ||
499 | === modified file 'plugins/CompassMarks/src/CompassMarks.cpp' | |||
500 | --- plugins/CompassMarks/src/CompassMarks.cpp 2015-10-28 13:39:43 +0000 | |||
501 | +++ plugins/CompassMarks/src/CompassMarks.cpp 2017-01-12 21:08:38 +0000 | |||
502 | @@ -35,7 +35,6 @@ | |||
503 | 35 | #include <QPixmap> | 35 | #include <QPixmap> |
504 | 36 | #include <QSettings> | 36 | #include <QSettings> |
505 | 37 | #include <QKeyEvent> | 37 | #include <QKeyEvent> |
506 | 38 | #include <QtNetwork> | ||
507 | 39 | #include <cmath> | 38 | #include <cmath> |
508 | 40 | 39 | ||
509 | 41 | StelModule* CompassMarksStelPluginInterface::getStelModule() const | 40 | StelModule* CompassMarksStelPluginInterface::getStelModule() const |
510 | @@ -129,14 +128,8 @@ | |||
511 | 129 | painter.setFont(font); | 128 | painter.setFont(font); |
512 | 130 | 129 | ||
513 | 131 | painter.setColor(markColor[0], markColor[1], markColor[2], markFader.getInterstate()); | 130 | painter.setColor(markColor[0], markColor[1], markColor[2], markFader.getInterstate()); |
522 | 132 | glDisable(GL_TEXTURE_2D); | 131 | painter.setBlending(true); |
523 | 133 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 132 | painter.setLineSmooth(true); |
516 | 134 | glEnable(GL_BLEND); | ||
517 | 135 | // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH. But it looks much better. | ||
518 | 136 | #ifdef GL_LINE_SMOOTH | ||
519 | 137 | if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) | ||
520 | 138 | glEnable(GL_LINE_SMOOTH); | ||
521 | 139 | #endif | ||
524 | 140 | 133 | ||
525 | 141 | for(int i=0; i<360; i++) | 134 | for(int i=0; i<360; i++) |
526 | 142 | { | 135 | { |
527 | @@ -161,20 +154,11 @@ | |||
528 | 161 | // Limit arcs to those that are visible for improved performance | 154 | // Limit arcs to those that are visible for improved performance |
529 | 162 | if (prj->project(pos, screenPos) && | 155 | if (prj->project(pos, screenPos) && |
530 | 163 | screenPos[0]>prj->getViewportPosX() && screenPos[0] < prj->getViewportPosX() + prj->getViewportWidth()) { | 156 | screenPos[0]>prj->getViewportPosX() && screenPos[0] < prj->getViewportPosX() + prj->getViewportWidth()) { |
531 | 164 | // This has been disabled above already... | ||
532 | 165 | //glDisable(GL_TEXTURE_2D); | ||
533 | 166 | painter.drawGreatCircleArc(pos, Vec3d(pos[0], pos[1], h), NULL); | 157 | painter.drawGreatCircleArc(pos, Vec3d(pos[0], pos[1], h), NULL); |
534 | 167 | //glEnable(GL_TEXTURE_2D); | ||
535 | 168 | } | 158 | } |
536 | 169 | } | 159 | } |
545 | 170 | // OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH | 160 | painter.setBlending(false); |
546 | 171 | #ifdef GL_LINE_SMOOTH | 161 | painter.setLineSmooth(false); |
539 | 172 | if (QOpenGLContext::currentContext()->format().renderableType()==QSurfaceFormat::OpenGL) | ||
540 | 173 | glDisable(GL_LINE_SMOOTH); | ||
541 | 174 | #endif | ||
542 | 175 | glDisable(GL_BLEND); | ||
543 | 176 | glEnable(GL_TEXTURE_2D); | ||
544 | 177 | |||
547 | 178 | } | 162 | } |
548 | 179 | 163 | ||
549 | 180 | void CompassMarks::update(double deltaTime) | 164 | void CompassMarks::update(double deltaTime) |
550 | 181 | 165 | ||
551 | === modified file 'plugins/EquationOfTime/src/CMakeLists.txt' | |||
552 | --- plugins/EquationOfTime/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
553 | +++ plugins/EquationOfTime/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
554 | @@ -25,11 +25,8 @@ | |||
555 | 25 | SET(EQUATIONOFTIME_RES ../resources/EquationOfTime.qrc) | 25 | SET(EQUATIONOFTIME_RES ../resources/EquationOfTime.qrc) |
556 | 26 | QT5_ADD_RESOURCES(EQUATIONOFTIME_RES_CXX ${EQUATIONOFTIME_RES}) | 26 | QT5_ADD_RESOURCES(EQUATIONOFTIME_RES_CXX ${EQUATIONOFTIME_RES}) |
557 | 27 | 27 | ||
558 | 28 | SET(extLinkerOption ${OPENGL_LIBRARIES}) | ||
559 | 29 | |||
560 | 30 | ADD_LIBRARY(EquationOfTime-static STATIC ${EQUATIONOFTIME_SRCS} ${EQUATIONOFTIME_RES_CXX} ${EQUATIONOFTIME_UIS_H}) | 28 | ADD_LIBRARY(EquationOfTime-static STATIC ${EQUATIONOFTIME_SRCS} ${EQUATIONOFTIME_RES_CXX} ${EQUATIONOFTIME_UIS_H}) |
562 | 31 | QT5_USE_MODULES(EquationOfTime-static Core Network Gui Widgets) | 29 | TARGET_LINK_LIBRARIES(EquationOfTime-static Qt5::Core Qt5::Widgets) |
563 | 32 | SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES OUTPUT_NAME "EquationOfTime") | 30 | SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES OUTPUT_NAME "EquationOfTime") |
564 | 33 | TARGET_LINK_LIBRARIES(EquationOfTime-static ${extLinkerOption}) | ||
565 | 34 | SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 31 | SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
566 | 35 | ADD_DEPENDENCIES(AllStaticPlugins EquationOfTime-static) | 32 | ADD_DEPENDENCIES(AllStaticPlugins EquationOfTime-static) |
567 | 36 | 33 | ||
568 | === modified file 'plugins/Exoplanets/src/CMakeLists.txt' | |||
569 | --- plugins/Exoplanets/src/CMakeLists.txt 2016-01-30 17:47:43 +0000 | |||
570 | +++ plugins/Exoplanets/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
571 | @@ -24,11 +24,8 @@ | |||
572 | 24 | SET(Exoplanets_RES ../resources/Exoplanets.qrc) | 24 | SET(Exoplanets_RES ../resources/Exoplanets.qrc) |
573 | 25 | QT5_ADD_RESOURCES(Exoplanets_RES_CXX ${Exoplanets_RES}) | 25 | QT5_ADD_RESOURCES(Exoplanets_RES_CXX ${Exoplanets_RES}) |
574 | 26 | 26 | ||
575 | 27 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
576 | 28 | |||
577 | 29 | ADD_LIBRARY(Exoplanets-static STATIC ${Exoplanets_SRCS} ${Exoplanets_RES_CXX} ${ExoplanetsDialog_UIS_H}) | 27 | ADD_LIBRARY(Exoplanets-static STATIC ${Exoplanets_SRCS} ${Exoplanets_RES_CXX} ${ExoplanetsDialog_UIS_H}) |
579 | 30 | QT5_USE_MODULES(Exoplanets-static Core Network Widgets) | 28 | TARGET_LINK_LIBRARIES(Exoplanets-static Qt5::Core Qt5::Network Qt5::Widgets qcustomplot_stel) |
580 | 31 | SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES OUTPUT_NAME "Exoplanets") | 29 | SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES OUTPUT_NAME "Exoplanets") |
581 | 32 | TARGET_LINK_LIBRARIES(Exoplanets-static ${extLinkerOption}) | ||
582 | 33 | SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 30 | SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
583 | 34 | ADD_DEPENDENCIES(AllStaticPlugins Exoplanets-static) | 31 | ADD_DEPENDENCIES(AllStaticPlugins Exoplanets-static) |
584 | 35 | 32 | ||
585 | === modified file 'plugins/Exoplanets/src/Exoplanet.cpp' | |||
586 | --- plugins/Exoplanets/src/Exoplanet.cpp 2016-11-17 17:47:59 +0000 | |||
587 | +++ plugins/Exoplanets/src/Exoplanet.cpp 2017-01-12 21:08:38 +0000 | |||
588 | @@ -559,8 +559,7 @@ | |||
589 | 559 | StelUtils::spheToRect(RA, DE, XYZ); | 559 | StelUtils::spheToRect(RA, DE, XYZ); |
590 | 560 | double mag = getVMagnitudeWithExtinction(core); | 560 | double mag = getVMagnitudeWithExtinction(core); |
591 | 561 | 561 | ||
594 | 562 | glEnable(GL_BLEND); | 562 | painter->setBlending(true, GL_ONE, GL_ONE); |
593 | 563 | glBlendFunc(GL_ONE, GL_ONE); | ||
595 | 564 | painter->setColor(color[0], color[1], color[2], 1); | 563 | painter->setColor(color[0], color[1], color[2], 1); |
596 | 565 | 564 | ||
597 | 566 | if (timelineMode) | 565 | if (timelineMode) |
598 | 567 | 566 | ||
599 | === modified file 'plugins/Exoplanets/src/Exoplanets.cpp' | |||
600 | --- plugins/Exoplanets/src/Exoplanets.cpp 2016-11-18 19:24:45 +0000 | |||
601 | +++ plugins/Exoplanets/src/Exoplanets.cpp 2017-01-12 21:08:38 +0000 | |||
602 | @@ -252,9 +252,7 @@ | |||
603 | 252 | const Vec3f& c(obj->getInfoColor()); | 252 | const Vec3f& c(obj->getInfoColor()); |
604 | 253 | painter.setColor(c[0],c[1],c[2]); | 253 | painter.setColor(c[0],c[1],c[2]); |
605 | 254 | texPointer->bind(); | 254 | texPointer->bind(); |
609 | 255 | painter.enableTexture2d(true); | 255 | painter.setBlending(true); |
607 | 256 | glEnable(GL_BLEND); | ||
608 | 257 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | ||
610 | 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.); |
611 | 259 | } | 257 | } |
612 | 260 | } | 258 | } |
613 | 261 | 259 | ||
614 | === modified file 'plugins/Exoplanets/src/gui/ExoplanetsDialog.cpp' | |||
615 | --- plugins/Exoplanets/src/gui/ExoplanetsDialog.cpp 2017-01-05 15:28:52 +0000 | |||
616 | +++ plugins/Exoplanets/src/gui/ExoplanetsDialog.cpp 2017-01-12 21:08:38 +0000 | |||
617 | @@ -39,7 +39,7 @@ | |||
618 | 39 | #include "StelTranslator.hpp" | 39 | #include "StelTranslator.hpp" |
619 | 40 | #include "StelLocaleMgr.hpp" | 40 | #include "StelLocaleMgr.hpp" |
620 | 41 | 41 | ||
622 | 42 | #include "qcustomplot/qcustomplot.h" | 42 | #include "external/qcustomplot/qcustomplot.h" |
623 | 43 | 43 | ||
624 | 44 | ExoplanetsDialog::ExoplanetsDialog() | 44 | ExoplanetsDialog::ExoplanetsDialog() |
625 | 45 | : StelDialog("Exoplanets") | 45 | : StelDialog("Exoplanets") |
626 | 46 | 46 | ||
627 | === modified file 'plugins/Exoplanets/src/gui/exoplanetsDialog.ui' | |||
628 | --- plugins/Exoplanets/src/gui/exoplanetsDialog.ui 2016-11-29 13:26:25 +0000 | |||
629 | +++ plugins/Exoplanets/src/gui/exoplanetsDialog.ui 2017-01-12 21:08:38 +0000 | |||
630 | @@ -606,7 +606,7 @@ | |||
631 | 606 | <customwidget> | 606 | <customwidget> |
632 | 607 | <class>QCustomPlot</class> | 607 | <class>QCustomPlot</class> |
633 | 608 | <extends>QWidget</extends> | 608 | <extends>QWidget</extends> |
635 | 609 | <header>qcustomplot.h</header> | 609 | <header>external/qcustomplot/qcustomplot.h</header> |
636 | 610 | </customwidget> | 610 | </customwidget> |
637 | 611 | </customwidgets> | 611 | </customwidgets> |
638 | 612 | <resources/> | 612 | <resources/> |
639 | 613 | 613 | ||
640 | === modified file 'plugins/FOV/src/CMakeLists.txt' | |||
641 | --- plugins/FOV/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
642 | +++ plugins/FOV/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
643 | @@ -22,11 +22,8 @@ | |||
644 | 22 | 22 | ||
645 | 23 | QT5_WRAP_UI(FOV_UIS_H ${FOV_UIS}) | 23 | QT5_WRAP_UI(FOV_UIS_H ${FOV_UIS}) |
646 | 24 | 24 | ||
647 | 25 | SET(extLinkerOption ${OPENGL_LIBRARIES}) | ||
648 | 26 | |||
649 | 27 | ADD_LIBRARY(FOV-static STATIC ${FOV_SRCS} ${FOV_RES_CXX} ${FOV_UIS_H}) | 25 | ADD_LIBRARY(FOV-static STATIC ${FOV_SRCS} ${FOV_RES_CXX} ${FOV_UIS_H}) |
651 | 28 | QT5_USE_MODULES(FOV-static Core Network Widgets) | 26 | TARGET_LINK_LIBRARIES(FOV-static Qt5::Core Qt5::Widgets) |
652 | 29 | SET_TARGET_PROPERTIES(FOV-static PROPERTIES OUTPUT_NAME "FOV") | 27 | SET_TARGET_PROPERTIES(FOV-static PROPERTIES OUTPUT_NAME "FOV") |
653 | 30 | TARGET_LINK_LIBRARIES(FOV-static ${extLinkerOption}) | ||
654 | 31 | SET_TARGET_PROPERTIES(FOV-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 28 | SET_TARGET_PROPERTIES(FOV-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
655 | 32 | ADD_DEPENDENCIES(AllStaticPlugins FOV-static) | 29 | ADD_DEPENDENCIES(AllStaticPlugins FOV-static) |
656 | 33 | 30 | ||
657 | === modified file 'plugins/HelloStelModule/src/CMakeLists.txt' | |||
658 | --- plugins/HelloStelModule/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
659 | +++ plugins/HelloStelModule/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
660 | @@ -7,14 +7,10 @@ | |||
661 | 7 | HelloStelModule.cpp | 7 | HelloStelModule.cpp |
662 | 8 | ) | 8 | ) |
663 | 9 | 9 | ||
664 | 10 | |||
665 | 11 | SET(extLinkerOption ${OPENGL_LIBRARIES}) | ||
666 | 12 | |||
667 | 13 | ADD_LIBRARY(HelloStelModule-static STATIC ${HelloStelModule_SRCS}) | 10 | ADD_LIBRARY(HelloStelModule-static STATIC ${HelloStelModule_SRCS}) |
668 | 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. |
669 | 15 | QT5_USE_MODULES(HelloStelModule-static Core Gui) | ||
670 | 16 | SET_TARGET_PROPERTIES(HelloStelModule-static PROPERTIES OUTPUT_NAME "HelloStelModule") | 12 | SET_TARGET_PROPERTIES(HelloStelModule-static PROPERTIES OUTPUT_NAME "HelloStelModule") |
672 | 17 | TARGET_LINK_LIBRARIES(HelloStelModule-static ${extLinkerOption}) | 13 | TARGET_LINK_LIBRARIES(HelloStelModule-static Qt5::Core Qt5::Gui) |
673 | 18 | SET_TARGET_PROPERTIES(HelloStelModule-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 14 | SET_TARGET_PROPERTIES(HelloStelModule-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
674 | 19 | ADD_DEPENDENCIES(AllStaticPlugins HelloStelModule-static) | 15 | ADD_DEPENDENCIES(AllStaticPlugins HelloStelModule-static) |
675 | 20 | 16 | ||
676 | 21 | 17 | ||
677 | === modified file 'plugins/MeteorShowers/src/CMakeLists.txt' | |||
678 | --- plugins/MeteorShowers/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
679 | +++ plugins/MeteorShowers/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
680 | @@ -33,11 +33,8 @@ | |||
681 | 33 | SET(MeteorShowers_RES ../resources/MeteorShower.qrc) | 33 | SET(MeteorShowers_RES ../resources/MeteorShower.qrc) |
682 | 34 | QT5_ADD_RESOURCES(MeteorShowers_RES_CXX ${MeteorShowers_RES}) | 34 | QT5_ADD_RESOURCES(MeteorShowers_RES_CXX ${MeteorShowers_RES}) |
683 | 35 | 35 | ||
684 | 36 | SET(extLinkerOption ${QT_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES} ${ICONV_LIBRARIES} ${INTL_LIBRARIES}) | ||
685 | 37 | |||
686 | 38 | ADD_LIBRARY(MeteorShowers-static STATIC ${MeteorShowers_SRCS} ${MeteorShowers_MOC_SRCS} ${MeteorShowers_RES_CXX} ${MeteorShowersDialog_UIS_H}) | 36 | ADD_LIBRARY(MeteorShowers-static STATIC ${MeteorShowers_SRCS} ${MeteorShowers_MOC_SRCS} ${MeteorShowers_RES_CXX} ${MeteorShowersDialog_UIS_H}) |
688 | 39 | QT5_USE_MODULES(MeteorShowers-static Core Network Widgets) | 37 | TARGET_LINK_LIBRARIES(MeteorShowers-static Qt5::Core Qt5::Network Qt5::Widgets) |
689 | 40 | SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES OUTPUT_NAME "MeteorShowers") | 38 | SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES OUTPUT_NAME "MeteorShowers") |
690 | 41 | TARGET_LINK_LIBRARIES(MeteorShowers-static ${extLinkerOption}) | ||
691 | 42 | SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 39 | SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
692 | 43 | ADD_DEPENDENCIES(AllStaticPlugins MeteorShowers-static) | 40 | ADD_DEPENDENCIES(AllStaticPlugins MeteorShowers-static) |
693 | 44 | 41 | ||
694 | === modified file 'plugins/MeteorShowers/src/MeteorShower.cpp' | |||
695 | --- plugins/MeteorShowers/src/MeteorShower.cpp 2017-01-07 17:36:45 +0000 | |||
696 | +++ plugins/MeteorShowers/src/MeteorShower.cpp 2017-01-12 21:08:38 +0000 | |||
697 | @@ -333,9 +333,7 @@ | |||
698 | 333 | StelUtils::spheToRect(m_radiantAlpha, m_radiantDelta, m_position); | 333 | StelUtils::spheToRect(m_radiantAlpha, m_radiantDelta, m_position); |
699 | 334 | painter.getProjector()->project(m_position, XY); | 334 | painter.getProjector()->project(m_position, XY); |
700 | 335 | 335 | ||
704 | 336 | glEnable(GL_TEXTURE_2D); | 336 | painter.setBlending(true, GL_SRC_ALPHA, GL_ONE); |
702 | 337 | glEnable(GL_BLEND); | ||
703 | 338 | glBlendFunc(GL_SRC_ALPHA, GL_ONE); | ||
705 | 339 | 337 | ||
706 | 340 | Vec3f rgb; | 338 | Vec3f rgb; |
707 | 341 | float alpha = 0.85f + ((float) qrand() / (float) RAND_MAX) / 10.f; | 339 | float alpha = 0.85f + ((float) qrand() / (float) RAND_MAX) / 10.f; |
708 | 342 | 340 | ||
709 | === modified file 'plugins/MeteorShowers/src/MeteorShowers.cpp' | |||
710 | --- plugins/MeteorShowers/src/MeteorShowers.cpp 2016-07-03 21:58:54 +0000 | |||
711 | +++ plugins/MeteorShowers/src/MeteorShowers.cpp 2017-01-12 21:08:38 +0000 | |||
712 | @@ -81,9 +81,8 @@ | |||
713 | 81 | const Vec3f& c(obj->getInfoColor()); | 81 | const Vec3f& c(obj->getInfoColor()); |
714 | 82 | painter.setColor(c[0],c[1],c[2]); | 82 | painter.setColor(c[0],c[1],c[2]); |
715 | 83 | m_mgr->getPointerTexture()->bind(); | 83 | m_mgr->getPointerTexture()->bind(); |
719 | 84 | painter.enableTexture2d(true); | 84 | |
720 | 85 | glEnable(GL_BLEND); | 85 | painter.setBlending(true); |
718 | 86 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | ||
721 | 87 | 86 | ||
722 | 88 | float size = obj->getAngularSize(core) * M_PI / 180. * painter.getProjector()->getPixelPerRadAtCenter(); | 87 | float size = obj->getAngularSize(core) * M_PI / 180. * painter.getProjector()->getPixelPerRadAtCenter(); |
723 | 89 | size += 20.f + 10.f * qSin(2.f * StelApp::getInstance().getTotalRunTime()); | 88 | size += 20.f + 10.f * qSin(2.f * StelApp::getInstance().getTotalRunTime()); |
724 | 90 | 89 | ||
725 | === modified file 'plugins/MeteorShowers/src/MeteorShowersMgr.hpp' | |||
726 | --- plugins/MeteorShowers/src/MeteorShowersMgr.hpp 2016-07-10 03:16:07 +0000 | |||
727 | +++ plugins/MeteorShowers/src/MeteorShowersMgr.hpp 2017-01-12 21:08:38 +0000 | |||
728 | @@ -325,7 +325,7 @@ | |||
729 | 325 | QString m_url; | 325 | QString m_url; |
730 | 326 | QDateTime m_lastUpdate; | 326 | QDateTime m_lastUpdate; |
731 | 327 | DownloadStatus m_statusOfLastUpdate; | 327 | DownloadStatus m_statusOfLastUpdate; |
733 | 328 | QNetworkAccessManager* m_downloadMgr; | 328 | QNetworkAccessManager* m_downloadMgr; |
734 | 329 | class StelProgressController* m_progressBar; | 329 | class StelProgressController* m_progressBar; |
735 | 330 | 330 | ||
736 | 331 | void createActions(); | 331 | void createActions(); |
737 | 332 | 332 | ||
738 | === modified file 'plugins/NavStars/src/CMakeLists.txt' | |||
739 | --- plugins/NavStars/src/CMakeLists.txt 2016-05-21 14:14:31 +0000 | |||
740 | +++ plugins/NavStars/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
741 | @@ -23,11 +23,8 @@ | |||
742 | 23 | SET(NavStars_RES ../resources/NavStars.qrc) | 23 | SET(NavStars_RES ../resources/NavStars.qrc) |
743 | 24 | QT5_ADD_RESOURCES(NavStars_RES_CXX ${NavStars_RES}) | 24 | QT5_ADD_RESOURCES(NavStars_RES_CXX ${NavStars_RES}) |
744 | 25 | 25 | ||
745 | 26 | SET(extLinkerOption ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
746 | 27 | |||
747 | 28 | ADD_LIBRARY(NavStars-static STATIC ${NavStars_SRCS} ${NavStars_RES_CXX} ${NavStars_UIS_H}) | 26 | ADD_LIBRARY(NavStars-static STATIC ${NavStars_SRCS} ${NavStars_RES_CXX} ${NavStars_UIS_H}) |
749 | 29 | QT5_USE_MODULES(NavStars-static Core Network Widgets) | 27 | TARGET_LINK_LIBRARIES(NavStars-static Qt5::Core Qt5::Widgets) |
750 | 30 | SET_TARGET_PROPERTIES(NavStars-static PROPERTIES OUTPUT_NAME "NavStars") | 28 | SET_TARGET_PROPERTIES(NavStars-static PROPERTIES OUTPUT_NAME "NavStars") |
751 | 31 | TARGET_LINK_LIBRARIES(NavStars-static ${extLinkerOption}) | ||
752 | 32 | SET_TARGET_PROPERTIES(NavStars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 29 | SET_TARGET_PROPERTIES(NavStars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
753 | 33 | ADD_DEPENDENCIES(AllStaticPlugins NavStars-static) | 30 | ADD_DEPENDENCIES(AllStaticPlugins NavStars-static) |
754 | 34 | 31 | ||
755 | === modified file 'plugins/NavStars/src/NavStars.cpp' | |||
756 | --- plugins/NavStars/src/NavStars.cpp 2016-08-01 12:55:49 +0000 | |||
757 | +++ plugins/NavStars/src/NavStars.cpp 2017-01-12 21:08:38 +0000 | |||
758 | @@ -182,9 +182,7 @@ | |||
759 | 182 | // ... and draw a marker around it | 182 | // ... and draw a marker around it |
760 | 183 | if (!markerTexture.isNull()) | 183 | if (!markerTexture.isNull()) |
761 | 184 | { | 184 | { |
765 | 185 | glEnable(GL_BLEND); | 185 | painter.setBlending(true); |
763 | 186 | painter.enableTexture2d(true); | ||
764 | 187 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
766 | 188 | painter.setColor(markerColor[0], markerColor[1], markerColor[2], markerFader.getInterstate()); | 186 | painter.setColor(markerColor[0], markerColor[1], markerColor[2], markerFader.getInterstate()); |
767 | 189 | markerTexture->bind(); | 187 | markerTexture->bind(); |
768 | 190 | painter.drawSprite2dMode(pos[0], pos[1], 11.f); | 188 | painter.drawSprite2dMode(pos[0], pos[1], 11.f); |
769 | 191 | 189 | ||
770 | === modified file 'plugins/Novae/src/CMakeLists.txt' | |||
771 | --- plugins/Novae/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
772 | +++ plugins/Novae/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
773 | @@ -25,11 +25,8 @@ | |||
774 | 25 | SET(Novae_RES ../resources/Novae.qrc) | 25 | SET(Novae_RES ../resources/Novae.qrc) |
775 | 26 | QT5_ADD_RESOURCES(Novae_RES_CXX ${Novae_RES}) | 26 | QT5_ADD_RESOURCES(Novae_RES_CXX ${Novae_RES}) |
776 | 27 | 27 | ||
777 | 28 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
778 | 29 | |||
779 | 30 | ADD_LIBRARY(Novae-static STATIC ${Novae_SRCS} ${Novae_RES_CXX} ${NovaeDialog_UIS_H}) | 28 | ADD_LIBRARY(Novae-static STATIC ${Novae_SRCS} ${Novae_RES_CXX} ${NovaeDialog_UIS_H}) |
781 | 31 | QT5_USE_MODULES(Novae-static Core Network OpenGL) | 29 | TARGET_LINK_LIBRARIES(Novae-static Qt5::Core Qt5::Network Qt5::Widgets) |
782 | 32 | SET_TARGET_PROPERTIES(Novae-static PROPERTIES OUTPUT_NAME "Novae") | 30 | SET_TARGET_PROPERTIES(Novae-static PROPERTIES OUTPUT_NAME "Novae") |
783 | 33 | TARGET_LINK_LIBRARIES(Novae-static ${extLinkerOption}) | ||
784 | 34 | SET_TARGET_PROPERTIES(Novae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 31 | SET_TARGET_PROPERTIES(Novae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
785 | 35 | ADD_DEPENDENCIES(AllStaticPlugins Novae-static) | 32 | ADD_DEPENDENCIES(AllStaticPlugins Novae-static) |
786 | 36 | 33 | ||
787 | === modified file 'plugins/Novae/src/Novae.cpp' | |||
788 | --- plugins/Novae/src/Novae.cpp 2016-09-28 13:19:24 +0000 | |||
789 | +++ plugins/Novae/src/Novae.cpp 2017-01-12 21:08:38 +0000 | |||
790 | @@ -224,9 +224,7 @@ | |||
791 | 224 | const Vec3f& c(obj->getInfoColor()); | 224 | const Vec3f& c(obj->getInfoColor()); |
792 | 225 | painter.setColor(c[0],c[1],c[2]); | 225 | painter.setColor(c[0],c[1],c[2]); |
793 | 226 | texPointer->bind(); | 226 | texPointer->bind(); |
797 | 227 | painter.enableTexture2d(true); | 227 | painter.setBlending(true); |
795 | 228 | glEnable(GL_BLEND); | ||
796 | 229 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | ||
798 | 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.); |
799 | 231 | } | 229 | } |
800 | 232 | } | 230 | } |
801 | 233 | 231 | ||
802 | === modified file 'plugins/Observability/src/CMakeLists.txt' | |||
803 | --- plugins/Observability/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
804 | +++ plugins/Observability/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
805 | @@ -25,11 +25,8 @@ | |||
806 | 25 | SET(Observability_RES ../Observability.qrc) | 25 | SET(Observability_RES ../Observability.qrc) |
807 | 26 | QT5_ADD_RESOURCES(Observability_RES_CXX ${Observability_RES}) | 26 | QT5_ADD_RESOURCES(Observability_RES_CXX ${Observability_RES}) |
808 | 27 | 27 | ||
809 | 28 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
810 | 29 | |||
811 | 30 | ADD_LIBRARY(Observability-static STATIC ${Observability_SRCS} ${Observability_RES_CXX} ${ObservabilityDialog_UIS_H}) | 28 | ADD_LIBRARY(Observability-static STATIC ${Observability_SRCS} ${Observability_RES_CXX} ${ObservabilityDialog_UIS_H}) |
813 | 31 | QT5_USE_MODULES(Observability-static Core Network Widgets) | 29 | TARGET_LINK_LIBRARIES(Observability-static Qt5::Core Qt5::Widgets) |
814 | 32 | SET_TARGET_PROPERTIES(Observability-static PROPERTIES OUTPUT_NAME "Observability") | 30 | SET_TARGET_PROPERTIES(Observability-static PROPERTIES OUTPUT_NAME "Observability") |
815 | 33 | TARGET_LINK_LIBRARIES(Observability-static ${extLinkerOption}) | ||
816 | 34 | SET_TARGET_PROPERTIES(Observability-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 31 | SET_TARGET_PROPERTIES(Observability-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
817 | 35 | ADD_DEPENDENCIES(AllStaticPlugins Observability-static) | 32 | ADD_DEPENDENCIES(AllStaticPlugins Observability-static) |
818 | 36 | 33 | ||
819 | === modified file 'plugins/Oculars/src/CMakeLists.txt' | |||
820 | --- plugins/Oculars/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
821 | +++ plugins/Oculars/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
822 | @@ -34,12 +34,8 @@ | |||
823 | 34 | ) | 34 | ) |
824 | 35 | QT5_WRAP_UI(Oculars_UIS_H ${Oculars_UIS}) | 35 | QT5_WRAP_UI(Oculars_UIS_H ${Oculars_UIS}) |
825 | 36 | 36 | ||
826 | 37 | SET(extLinkerOption ${OPENGL_LIBRARIES}) | ||
827 | 38 | |||
828 | 39 | ADD_LIBRARY(Oculars-static STATIC ${Oculars_SRCS} ${Oculars_RES_CXX} ${Oculars_UIS_H}) | 37 | ADD_LIBRARY(Oculars-static STATIC ${Oculars_SRCS} ${Oculars_RES_CXX} ${Oculars_UIS_H}) |
829 | 40 | SET_TARGET_PROPERTIES(Oculars-static PROPERTIES OUTPUT_NAME "Oculars") | 38 | SET_TARGET_PROPERTIES(Oculars-static PROPERTIES OUTPUT_NAME "Oculars") |
833 | 41 | QT5_USE_MODULES(Oculars-static Core Network OpenGL Widgets) | 39 | TARGET_LINK_LIBRARIES(Oculars-static Qt5::Core Qt5::Widgets) |
831 | 42 | |||
832 | 43 | TARGET_LINK_LIBRARIES(Oculars-static ${StelMain} ${extLinkerOption}) | ||
834 | 44 | SET_TARGET_PROPERTIES(Oculars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 40 | SET_TARGET_PROPERTIES(Oculars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
835 | 45 | ADD_DEPENDENCIES(AllStaticPlugins Oculars-static) | 41 | ADD_DEPENDENCIES(AllStaticPlugins Oculars-static) |
836 | 46 | 42 | ||
837 | === modified file 'plugins/Oculars/src/Oculars.cpp' | |||
838 | --- plugins/Oculars/src/Oculars.cpp 2017-01-10 17:21:30 +0000 | |||
839 | +++ plugins/Oculars/src/Oculars.cpp 2017-01-12 21:08:38 +0000 | |||
840 | @@ -50,7 +50,6 @@ | |||
841 | 50 | #include <QKeyEvent> | 50 | #include <QKeyEvent> |
842 | 51 | #include <QMenu> | 51 | #include <QMenu> |
843 | 52 | #include <QMouseEvent> | 52 | #include <QMouseEvent> |
844 | 53 | #include <QtNetwork> | ||
845 | 54 | #include <QPixmap> | 53 | #include <QPixmap> |
846 | 55 | #include <QSignalMapper> | 54 | #include <QSignalMapper> |
847 | 56 | 55 | ||
848 | @@ -335,14 +334,7 @@ | |||
849 | 335 | paintCrosshairs(); | 334 | paintCrosshairs(); |
850 | 336 | } | 335 | } |
851 | 337 | } | 336 | } |
860 | 338 | if (guiPanelEnabled) | 337 | if (!guiPanelEnabled) |
853 | 339 | { | ||
854 | 340 | // Reset the state to allow the panel to be painted normally | ||
855 | 341 | glDisable(GL_TEXTURE_2D); | ||
856 | 342 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
857 | 343 | glEnable(GL_BLEND); | ||
858 | 344 | } | ||
859 | 345 | else | ||
861 | 346 | { | 338 | { |
862 | 347 | // Paint the information in the upper-right hand corner | 339 | // Paint the information in the upper-right hand corner |
863 | 348 | paintText(core); | 340 | paintText(core); |
864 | @@ -352,14 +344,7 @@ | |||
865 | 352 | else if (flagShowCCD) | 344 | else if (flagShowCCD) |
866 | 353 | { | 345 | { |
867 | 354 | paintCCDBounds(); | 346 | paintCCDBounds(); |
876 | 355 | if (guiPanelEnabled) | 347 | if (!guiPanelEnabled) |
869 | 356 | { | ||
870 | 357 | // Reset the state to allow the panel to be painted normally | ||
871 | 358 | glDisable(GL_TEXTURE_2D); | ||
872 | 359 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
873 | 360 | glEnable(GL_BLEND); | ||
874 | 361 | } | ||
875 | 362 | else | ||
877 | 363 | { | 348 | { |
878 | 364 | // Paint the information in the upper-right hand corner | 349 | // Paint the information in the upper-right hand corner |
879 | 365 | paintText(core); | 350 | paintText(core); |
880 | @@ -1768,15 +1753,13 @@ | |||
881 | 1768 | inner = oculars[selectedOcularIndex]->appearentFOV() * inner / maxEyepieceAngle; | 1753 | inner = oculars[selectedOcularIndex]->appearentFOV() * inner / maxEyepieceAngle; |
882 | 1769 | } | 1754 | } |
883 | 1770 | 1755 | ||
886 | 1771 | glEnable(GL_BLEND); | 1756 | painter.setBlending(true); |
885 | 1772 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | ||
887 | 1773 | 1757 | ||
888 | 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); |
889 | 1775 | 1759 | ||
890 | 1776 | // Paint the reticale, if needed | 1760 | // Paint the reticale, if needed |
891 | 1777 | if (!reticleTexture.isNull()) | 1761 | if (!reticleTexture.isNull()) |
892 | 1778 | { | 1762 | { |
893 | 1779 | painter.enableTexture2d(true); | ||
894 | 1780 | painter.setColor(0.77f, 0.14f, 0.16f, 1.f); | 1763 | painter.setColor(0.77f, 0.14f, 0.16f, 1.f); |
895 | 1781 | 1764 | ||
896 | 1782 | reticleTexture->bind(); | 1765 | reticleTexture->bind(); |
897 | @@ -1869,9 +1852,7 @@ | |||
898 | 1869 | 1852 | ||
899 | 1870 | // set up the color and the GL state | 1853 | // set up the color and the GL state |
900 | 1871 | painter.setColor(0.8f, 0.48f, 0.f, 1.f); | 1854 | painter.setColor(0.8f, 0.48f, 0.f, 1.f); |
904 | 1872 | glDisable(GL_TEXTURE_2D); | 1855 | painter.setBlending(true); |
902 | 1873 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||
903 | 1874 | glEnable(GL_BLEND); | ||
905 | 1875 | 1856 | ||
906 | 1876 | // Get the X & Y positions, and the line height | 1857 | // Get the X & Y positions, and the line height |
907 | 1877 | painter.setFont(font); | 1858 | painter.setFont(font); |
908 | 1878 | 1859 | ||
909 | === modified file 'plugins/PointerCoordinates/src/CMakeLists.txt' | |||
910 | --- plugins/PointerCoordinates/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
911 | +++ plugins/PointerCoordinates/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
912 | @@ -25,11 +25,8 @@ | |||
913 | 25 | SET(POINTERCOORDINATES_RES ../resources/PointerCoordinates.qrc) | 25 | SET(POINTERCOORDINATES_RES ../resources/PointerCoordinates.qrc) |
914 | 26 | QT5_ADD_RESOURCES(POINTERCOORDINATES_RES_CXX ${POINTERCOORDINATES_RES}) | 26 | QT5_ADD_RESOURCES(POINTERCOORDINATES_RES_CXX ${POINTERCOORDINATES_RES}) |
915 | 27 | 27 | ||
916 | 28 | SET(extLinkerOption ${OPENGL_LIBRARIES}) | ||
917 | 29 | |||
918 | 30 | ADD_LIBRARY(PointerCoordinates-static STATIC ${POINTERCOORDINATES_SRCS} ${POINTERCOORDINATES_RES_CXX} ${POINTERCOORDINATES_UIS_H}) | 28 | ADD_LIBRARY(PointerCoordinates-static STATIC ${POINTERCOORDINATES_SRCS} ${POINTERCOORDINATES_RES_CXX} ${POINTERCOORDINATES_UIS_H}) |
920 | 31 | QT5_USE_MODULES(PointerCoordinates-static Core Network Widgets) | 29 | TARGET_LINK_LIBRARIES(PointerCoordinates-static Qt5::Core Qt5::Widgets) |
921 | 32 | SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES OUTPUT_NAME "PointerCoordinates") | 30 | SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES OUTPUT_NAME "PointerCoordinates") |
922 | 33 | TARGET_LINK_LIBRARIES(PointerCoordinates-static ${extLinkerOption}) | ||
923 | 34 | SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 31 | SET_TARGET_PROPERTIES(PointerCoordinates-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
924 | 35 | ADD_DEPENDENCIES(AllStaticPlugins PointerCoordinates-static) | 32 | ADD_DEPENDENCIES(AllStaticPlugins PointerCoordinates-static) |
925 | 36 | 33 | ||
926 | === modified file 'plugins/Pulsars/src/CMakeLists.txt' | |||
927 | --- plugins/Pulsars/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
928 | +++ plugins/Pulsars/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
929 | @@ -25,11 +25,8 @@ | |||
930 | 25 | SET(Pulsars_RES ../resources/Pulsars.qrc) | 25 | SET(Pulsars_RES ../resources/Pulsars.qrc) |
931 | 26 | QT5_ADD_RESOURCES(Pulsars_RES_CXX ${Pulsars_RES}) | 26 | QT5_ADD_RESOURCES(Pulsars_RES_CXX ${Pulsars_RES}) |
932 | 27 | 27 | ||
933 | 28 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
934 | 29 | |||
935 | 30 | ADD_LIBRARY(Pulsars-static STATIC ${Pulsars_SRCS} ${Pulsars_RES_CXX} ${PulsarsDialog_UIS_H}) | 28 | ADD_LIBRARY(Pulsars-static STATIC ${Pulsars_SRCS} ${Pulsars_RES_CXX} ${PulsarsDialog_UIS_H}) |
937 | 31 | QT5_USE_MODULES(Pulsars-static Core Network Widgets) | 29 | TARGET_LINK_LIBRARIES(Pulsars-static Qt5::Core Qt5::Network Qt5::Widgets) |
938 | 32 | SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES OUTPUT_NAME "Pulsars") | 30 | SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES OUTPUT_NAME "Pulsars") |
939 | 33 | TARGET_LINK_LIBRARIES(Pulsars-static ${extLinkerOption}) | ||
940 | 34 | SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 31 | SET_TARGET_PROPERTIES(Pulsars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
941 | 35 | ADD_DEPENDENCIES(AllStaticPlugins Pulsars-static) | 32 | ADD_DEPENDENCIES(AllStaticPlugins Pulsars-static) |
942 | 36 | 33 | ||
943 | === modified file 'plugins/Pulsars/src/Pulsar.cpp' | |||
944 | --- plugins/Pulsars/src/Pulsar.cpp 2016-07-30 18:20:22 +0000 | |||
945 | +++ plugins/Pulsars/src/Pulsar.cpp 2017-01-12 21:08:38 +0000 | |||
946 | @@ -384,8 +384,8 @@ | |||
947 | 384 | if (!(painter->getProjector()->projectCheck(XYZ, win))) | 384 | if (!(painter->getProjector()->projectCheck(XYZ, win))) |
948 | 385 | return; | 385 | return; |
949 | 386 | 386 | ||
952 | 387 | glEnable(GL_BLEND); | 387 | painter->setBlending(true, GL_ONE, GL_ONE); |
953 | 388 | glBlendFunc(GL_ONE, GL_ONE); | 388 | |
954 | 389 | if (glitch>0 && glitchFlag) | 389 | if (glitch>0 && glitchFlag) |
955 | 390 | painter->setColor(glitchColor[0], glitchColor[1], glitchColor[2], 1.f); | 390 | painter->setColor(glitchColor[0], glitchColor[1], glitchColor[2], 1.f); |
956 | 391 | else | 391 | else |
957 | 392 | 392 | ||
958 | === modified file 'plugins/Pulsars/src/Pulsars.cpp' | |||
959 | --- plugins/Pulsars/src/Pulsars.cpp 2016-07-03 21:58:54 +0000 | |||
960 | +++ plugins/Pulsars/src/Pulsars.cpp 2017-01-12 21:08:38 +0000 | |||
961 | @@ -259,9 +259,7 @@ | |||
962 | 259 | const Vec3f& c(obj->getInfoColor()); | 259 | const Vec3f& c(obj->getInfoColor()); |
963 | 260 | painter.setColor(c[0],c[1],c[2]); | 260 | painter.setColor(c[0],c[1],c[2]); |
964 | 261 | texPointer->bind(); | 261 | texPointer->bind(); |
968 | 262 | painter.enableTexture2d(true); | 262 | painter.setBlending(true); |
966 | 263 | glEnable(GL_BLEND); | ||
967 | 264 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | ||
969 | 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.); |
970 | 266 | } | 264 | } |
971 | 267 | } | 265 | } |
972 | 268 | 266 | ||
973 | === modified file 'plugins/Quasars/src/CMakeLists.txt' | |||
974 | --- plugins/Quasars/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
975 | +++ plugins/Quasars/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
976 | @@ -25,11 +25,8 @@ | |||
977 | 25 | SET(Quasars_RES ../resources/Quasars.qrc) | 25 | SET(Quasars_RES ../resources/Quasars.qrc) |
978 | 26 | QT5_ADD_RESOURCES(Quasars_RES_CXX ${Quasars_RES}) | 26 | QT5_ADD_RESOURCES(Quasars_RES_CXX ${Quasars_RES}) |
979 | 27 | 27 | ||
980 | 28 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
981 | 29 | |||
982 | 30 | ADD_LIBRARY(Quasars-static STATIC ${Quasars_SRCS} ${Quasars_RES_CXX} ${QuasarsDialog_UIS_H}) | 28 | ADD_LIBRARY(Quasars-static STATIC ${Quasars_SRCS} ${Quasars_RES_CXX} ${QuasarsDialog_UIS_H}) |
984 | 31 | QT5_USE_MODULES(Quasars-static Core Network Widgets) | 29 | TARGET_LINK_LIBRARIES(Quasars-static Qt5::Core Qt5::Network Qt5::Widgets) |
985 | 32 | SET_TARGET_PROPERTIES(Quasars-static PROPERTIES OUTPUT_NAME "Quasars") | 30 | SET_TARGET_PROPERTIES(Quasars-static PROPERTIES OUTPUT_NAME "Quasars") |
986 | 33 | TARGET_LINK_LIBRARIES(Quasars-static ${extLinkerOption}) | ||
987 | 34 | SET_TARGET_PROPERTIES(Quasars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 31 | SET_TARGET_PROPERTIES(Quasars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
988 | 35 | ADD_DEPENDENCIES(AllStaticPlugins Quasars-static) | 32 | ADD_DEPENDENCIES(AllStaticPlugins Quasars-static) |
989 | 36 | 33 | ||
990 | === modified file 'plugins/Quasars/src/Quasar.cpp' | |||
991 | --- plugins/Quasars/src/Quasar.cpp 2016-07-30 18:20:22 +0000 | |||
992 | +++ plugins/Quasars/src/Quasar.cpp 2017-01-12 21:08:38 +0000 | |||
993 | @@ -180,8 +180,7 @@ | |||
994 | 180 | 180 | ||
995 | 181 | if (distributionMode) | 181 | if (distributionMode) |
996 | 182 | { | 182 | { |
999 | 183 | glEnable(GL_BLEND); | 183 | painter.setBlending(true, GL_ONE, GL_ONE); |
998 | 184 | glBlendFunc(GL_ONE, GL_ONE); | ||
1000 | 185 | painter.setColor(markerColor[0], markerColor[1], markerColor[2], 1); | 184 | painter.setColor(markerColor[0], markerColor[1], markerColor[2], 1); |
1001 | 186 | 185 | ||
1002 | 187 | Quasar::markerTexture->bind(); | 186 | Quasar::markerTexture->bind(); |
1003 | 188 | 187 | ||
1004 | === modified file 'plugins/Quasars/src/Quasars.cpp' | |||
1005 | --- plugins/Quasars/src/Quasars.cpp 2016-07-22 09:25:03 +0000 | |||
1006 | +++ plugins/Quasars/src/Quasars.cpp 2017-01-12 21:08:38 +0000 | |||
1007 | @@ -261,9 +261,7 @@ | |||
1008 | 261 | const Vec3f& c(obj->getInfoColor()); | 261 | const Vec3f& c(obj->getInfoColor()); |
1009 | 262 | painter.setColor(c[0],c[1],c[2]); | 262 | painter.setColor(c[0],c[1],c[2]); |
1010 | 263 | texPointer->bind(); | 263 | texPointer->bind(); |
1014 | 264 | painter.enableTexture2d(true); | 264 | painter.setBlending(true); |
1012 | 265 | glEnable(GL_BLEND); | ||
1013 | 266 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | ||
1015 | 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.); |
1016 | 268 | } | 266 | } |
1017 | 269 | } | 267 | } |
1018 | 270 | 268 | ||
1019 | === modified file 'plugins/RemoteControl/src/CMakeLists.txt' | |||
1020 | --- plugins/RemoteControl/src/CMakeLists.txt 2016-01-18 16:55:10 +0000 | |||
1021 | +++ plugins/RemoteControl/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
1022 | @@ -67,12 +67,9 @@ | |||
1023 | 67 | SET(RemoteControl_RES ../RemoteControl.qrc) | 67 | SET(RemoteControl_RES ../RemoteControl.qrc) |
1024 | 68 | QT5_ADD_RESOURCES(RemoteControl_RES_CXX ${RemoteControl_RES}) | 68 | QT5_ADD_RESOURCES(RemoteControl_RES_CXX ${RemoteControl_RES}) |
1025 | 69 | 69 | ||
1026 | 70 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
1027 | 71 | |||
1028 | 72 | ADD_LIBRARY(RemoteControl-static STATIC ${RemoteControl_SRCS} ${RemoteControl_RES_CXX} ${RemoteControl_UIS_H} ${QtWebApp_SRCS}) | 70 | ADD_LIBRARY(RemoteControl-static STATIC ${RemoteControl_SRCS} ${RemoteControl_RES_CXX} ${RemoteControl_UIS_H} ${QtWebApp_SRCS}) |
1030 | 73 | QT5_USE_MODULES(RemoteControl-static Core Network Widgets) | 71 | TARGET_LINK_LIBRARIES(RemoteControl-static Qt5::Core Qt5::Network Qt5::Widgets) |
1031 | 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. |
1032 | 75 | SET_TARGET_PROPERTIES(RemoteControl-static PROPERTIES OUTPUT_NAME "RemoteControl") | 73 | SET_TARGET_PROPERTIES(RemoteControl-static PROPERTIES OUTPUT_NAME "RemoteControl") |
1033 | 76 | TARGET_LINK_LIBRARIES(RemoteControl-static ${extLinkerOption}) | ||
1034 | 77 | SET_TARGET_PROPERTIES(RemoteControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 74 | SET_TARGET_PROPERTIES(RemoteControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
1035 | 78 | ADD_DEPENDENCIES(AllStaticPlugins RemoteControl-static) | 75 | ADD_DEPENDENCIES(AllStaticPlugins RemoteControl-static) |
1036 | 79 | 76 | ||
1037 | === modified file 'plugins/RemoteControl/src/MainService.cpp' | |||
1038 | --- plugins/RemoteControl/src/MainService.cpp 2017-01-11 14:13:45 +0000 | |||
1039 | +++ plugins/RemoteControl/src/MainService.cpp 2017-01-12 21:08:38 +0000 | |||
1040 | @@ -35,6 +35,8 @@ | |||
1041 | 35 | #include "StelUtils.hpp" | 35 | #include "StelUtils.hpp" |
1042 | 36 | 36 | ||
1043 | 37 | #include <QJsonDocument> | 37 | #include <QJsonDocument> |
1044 | 38 | #include <QJsonObject> | ||
1045 | 39 | #include <QJsonArray> | ||
1046 | 38 | 40 | ||
1047 | 39 | 41 | ||
1048 | 40 | MainService::MainService(const QByteArray &serviceName, QObject *parent) | 42 | MainService::MainService(const QByteArray &serviceName, QObject *parent) |
1049 | 41 | 43 | ||
1050 | === modified file 'plugins/RemoteControl/src/ScriptService.cpp' | |||
1051 | --- plugins/RemoteControl/src/ScriptService.cpp 2016-05-10 19:03:51 +0000 | |||
1052 | +++ plugins/RemoteControl/src/ScriptService.cpp 2017-01-12 21:08:38 +0000 | |||
1053 | @@ -24,6 +24,9 @@ | |||
1054 | 24 | #include "StelTranslator.hpp" | 24 | #include "StelTranslator.hpp" |
1055 | 25 | 25 | ||
1056 | 26 | #include <QJsonDocument> | 26 | #include <QJsonDocument> |
1057 | 27 | #include <QJsonObject> | ||
1058 | 28 | #include <QJsonArray> | ||
1059 | 29 | #include <QVariant> | ||
1060 | 27 | 30 | ||
1061 | 28 | ScriptService::ScriptService(const QByteArray &serviceName, QObject *parent) : AbstractAPIService(serviceName,parent) | 31 | ScriptService::ScriptService(const QByteArray &serviceName, QObject *parent) : AbstractAPIService(serviceName,parent) |
1062 | 29 | { | 32 | { |
1063 | 30 | 33 | ||
1064 | === modified file 'plugins/RemoteSync/src/CMakeLists.txt' | |||
1065 | --- plugins/RemoteSync/src/CMakeLists.txt 2016-02-05 14:05:45 +0000 | |||
1066 | +++ plugins/RemoteSync/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
1067 | @@ -32,12 +32,9 @@ | |||
1068 | 32 | SET(RemoteSync_RES ../RemoteSync.qrc) | 32 | SET(RemoteSync_RES ../RemoteSync.qrc) |
1069 | 33 | QT5_ADD_RESOURCES(RemoteSync_RES_CXX ${RemoteSync_RES}) | 33 | QT5_ADD_RESOURCES(RemoteSync_RES_CXX ${RemoteSync_RES}) |
1070 | 34 | 34 | ||
1071 | 35 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
1072 | 36 | |||
1073 | 37 | ADD_LIBRARY(RemoteSync-static STATIC ${RemoteSync_SRCS} ${RemoteSync_UIS_H} ${RemoteSync_RES_CXX}) | 35 | ADD_LIBRARY(RemoteSync-static STATIC ${RemoteSync_SRCS} ${RemoteSync_UIS_H} ${RemoteSync_RES_CXX}) |
1075 | 38 | QT5_USE_MODULES(RemoteSync-static Core Network Widgets) | 36 | TARGET_LINK_LIBRARIES(RemoteSync-static Qt5::Core Qt5::Network Qt5::Widgets) |
1076 | 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. |
1077 | 40 | SET_TARGET_PROPERTIES(RemoteSync-static PROPERTIES OUTPUT_NAME "RemoteSync") | 38 | SET_TARGET_PROPERTIES(RemoteSync-static PROPERTIES OUTPUT_NAME "RemoteSync") |
1078 | 41 | TARGET_LINK_LIBRARIES(RemoteSync-static ${extLinkerOption}) | ||
1079 | 42 | SET_TARGET_PROPERTIES(RemoteSync-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 39 | SET_TARGET_PROPERTIES(RemoteSync-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
1080 | 43 | ADD_DEPENDENCIES(AllStaticPlugins RemoteSync-static) | 40 | ADD_DEPENDENCIES(AllStaticPlugins RemoteSync-static) |
1081 | 44 | 41 | ||
1082 | === modified file 'plugins/Satellites/src/CMakeLists.txt' | |||
1083 | --- plugins/Satellites/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
1084 | +++ plugins/Satellites/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
1085 | @@ -53,23 +53,13 @@ | |||
1086 | 53 | SET(Satellites_RES ../resources/Satellites.qrc) | 53 | SET(Satellites_RES ../resources/Satellites.qrc) |
1087 | 54 | QT5_ADD_RESOURCES(Satellites_RES_CXX ${Satellites_RES}) | 54 | QT5_ADD_RESOURCES(Satellites_RES_CXX ${Satellites_RES}) |
1088 | 55 | 55 | ||
1089 | 56 | SET(extLinkerOption ${OPENGL_LIBRARIES}) | ||
1090 | 57 | |||
1091 | 58 | ADD_LIBRARY(Satellites-static STATIC ${Satellites_SRCS} ${Satellites_RES_CXX} ${SatellitesDialog_UIS_H}) | 56 | ADD_LIBRARY(Satellites-static STATIC ${Satellites_SRCS} ${Satellites_RES_CXX} ${SatellitesDialog_UIS_H}) |
1093 | 59 | QT5_USE_MODULES(Satellites-static Core Network OpenGL) | 57 | TARGET_LINK_LIBRARIES(Satellites-static Qt5::Core Qt5::Network Qt5::Widgets) |
1094 | 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. |
1095 | 61 | SET_TARGET_PROPERTIES(Satellites-static PROPERTIES OUTPUT_NAME "Satellites") | 59 | SET_TARGET_PROPERTIES(Satellites-static PROPERTIES OUTPUT_NAME "Satellites") |
1096 | 62 | TARGET_LINK_LIBRARIES(Satellites-static ${StelMain} ${extLinkerOption}) | ||
1097 | 63 | IF(MSVC) | 60 | IF(MSVC) |
1098 | 64 | SET_TARGET_PROPERTIES(Satellites-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 61 | SET_TARGET_PROPERTIES(Satellites-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
1099 | 65 | ELSE() | 62 | ELSE() |
1100 | 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") |
1101 | 67 | ENDIF() | 64 | ENDIF() |
1102 | 68 | ADD_DEPENDENCIES(AllStaticPlugins Satellites-static) | 65 | ADD_DEPENDENCIES(AllStaticPlugins Satellites-static) |
1103 | 69 | |||
1104 | 70 | |||
1105 | 71 | |||
1106 | 72 | |||
1107 | 73 | |||
1108 | 74 | |||
1109 | 75 | |||
1110 | 76 | 66 | ||
1111 | === modified file 'plugins/Satellites/src/Satellite.cpp' | |||
1112 | --- plugins/Satellites/src/Satellite.cpp 2017-01-05 17:00:35 +0000 | |||
1113 | +++ plugins/Satellites/src/Satellite.cpp 2017-01-12 21:08:38 +0000 | |||
1114 | @@ -834,8 +834,7 @@ | |||
1115 | 834 | if (Satellite::showLabels) | 834 | if (Satellite::showLabels) |
1116 | 835 | painter.drawText(xy[0], xy[1], name, 0, 10, 10, false); | 835 | painter.drawText(xy[0], xy[1], name, 0, 10, 10, false); |
1117 | 836 | 836 | ||
1120 | 837 | glEnable(GL_BLEND); | 837 | painter.setBlending(true, GL_ONE, GL_ONE); |
1119 | 838 | glBlendFunc(GL_ONE, GL_ONE); | ||
1121 | 839 | 838 | ||
1122 | 840 | Satellite::hintTexture->bind(); | 839 | Satellite::hintTexture->bind(); |
1123 | 841 | painter.drawSprite2dMode(xy[0], xy[1], 11); | 840 | painter.drawSprite2dMode(xy[0], xy[1], 11); |
1124 | @@ -851,8 +850,6 @@ | |||
1125 | 851 | Vec3f drawColor; | 850 | Vec3f drawColor; |
1126 | 852 | int size = orbitPoints.size(); | 851 | int size = orbitPoints.size(); |
1127 | 853 | 852 | ||
1128 | 854 | glDisable(GL_TEXTURE_2D); | ||
1129 | 855 | |||
1130 | 856 | QList<Vec3d>::iterator it= orbitPoints.begin(); | 853 | QList<Vec3d>::iterator it= orbitPoints.begin(); |
1131 | 857 | it++; | 854 | it++; |
1132 | 858 | 855 | ||
1133 | @@ -881,8 +878,6 @@ | |||
1134 | 881 | } | 878 | } |
1135 | 882 | } | 879 | } |
1136 | 883 | painter.drawPath(vertexArray, colorArray); | 880 | painter.drawPath(vertexArray, colorArray); |
1137 | 884 | |||
1138 | 885 | glEnable(GL_TEXTURE_2D); | ||
1139 | 886 | painter.enableClientStates(false); | 881 | painter.enableClientStates(false); |
1140 | 887 | } | 882 | } |
1141 | 888 | 883 | ||
1142 | 889 | 884 | ||
1143 | === modified file 'plugins/Satellites/src/Satellites.cpp' | |||
1144 | --- plugins/Satellites/src/Satellites.cpp 2017-01-05 17:00:35 +0000 | |||
1145 | +++ plugins/Satellites/src/Satellites.cpp 2017-01-12 21:08:38 +0000 | |||
1146 | @@ -1607,9 +1607,7 @@ | |||
1147 | 1607 | painter.setFont(labelFont); | 1607 | painter.setFont(labelFont); |
1148 | 1608 | Satellite::hintBrightness = hintFader.getInterstate(); | 1608 | Satellite::hintBrightness = hintFader.getInterstate(); |
1149 | 1609 | 1609 | ||
1153 | 1610 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 1610 | painter.setBlending(true); |
1151 | 1611 | glEnable(GL_BLEND); | ||
1152 | 1612 | glEnable(GL_TEXTURE_2D); | ||
1154 | 1613 | Satellite::hintTexture->bind(); | 1611 | Satellite::hintTexture->bind(); |
1155 | 1614 | Satellite::viewportHalfspace = painter.getProjector()->getBoundingCap(); | 1612 | Satellite::viewportHalfspace = painter.getProjector()->getBoundingCap(); |
1156 | 1615 | foreach (const SatelliteP& sat, satellites) | 1613 | foreach (const SatelliteP& sat, satellites) |
1157 | @@ -1639,9 +1637,7 @@ | |||
1158 | 1639 | painter.setColor(0.4f,0.5f,0.8f); | 1637 | painter.setColor(0.4f,0.5f,0.8f); |
1159 | 1640 | texPointer->bind(); | 1638 | texPointer->bind(); |
1160 | 1641 | 1639 | ||
1164 | 1642 | glEnable(GL_TEXTURE_2D); | 1640 | painter.setBlending(true); |
1162 | 1643 | glEnable(GL_BLEND); | ||
1163 | 1644 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | ||
1165 | 1645 | 1641 | ||
1166 | 1646 | // Size on screen | 1642 | // Size on screen |
1167 | 1647 | float size = obj->getAngularSize(core)*M_PI/180.*prj->getPixelPerRadAtCenter(); | 1643 | float size = obj->getAngularSize(core)*M_PI/180.*prj->getPixelPerRadAtCenter(); |
1168 | 1648 | 1644 | ||
1169 | === modified file 'plugins/Scenery3d/src/CMakeLists.txt' | |||
1170 | --- plugins/Scenery3d/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
1171 | +++ plugins/Scenery3d/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
1172 | @@ -60,14 +60,9 @@ | |||
1173 | 60 | ) | 60 | ) |
1174 | 61 | QT5_WRAP_UI(Scenery3d_UIS_H ${Scenery3d_UIS}) | 61 | QT5_WRAP_UI(Scenery3d_UIS_H ${Scenery3d_UIS}) |
1175 | 62 | 62 | ||
1176 | 63 | SET(extLinkerOption ${QT_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES} ) | ||
1177 | 64 | |||
1178 | 65 | ############### For building the static library ###################### | 63 | ############### For building the static library ###################### |
1179 | 66 | ADD_LIBRARY(Scenery3d-static STATIC ${Scenery3d_SRCS} ${Scenery3d_RES_CXX} ${Scenery3d_UIS_H} ${Scenery3d_MOC_SRCS} ) | 64 | ADD_LIBRARY(Scenery3d-static STATIC ${Scenery3d_SRCS} ${Scenery3d_RES_CXX} ${Scenery3d_UIS_H} ${Scenery3d_MOC_SRCS} ) |
1181 | 67 | QT5_USE_MODULES(Scenery3d-static Core Concurrent Gui Widgets) | 65 | TARGET_LINK_LIBRARIES(Scenery3d-static Qt5::Core Qt5::Concurrent Qt5::Gui ${STEL_GLES_LIBS} Qt5::Widgets) |
1182 | 68 | SET_TARGET_PROPERTIES(Scenery3d-static PROPERTIES OUTPUT_NAME "Scenery3d") | 66 | SET_TARGET_PROPERTIES(Scenery3d-static PROPERTIES OUTPUT_NAME "Scenery3d") |
1183 | 69 | TARGET_LINK_LIBRARIES(Scenery3d-static ${extLinkerOption}) | ||
1184 | 70 | SET_TARGET_PROPERTIES(Scenery3d-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 67 | SET_TARGET_PROPERTIES(Scenery3d-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
1185 | 71 | ADD_DEPENDENCIES(AllStaticPlugins Scenery3d-static) | 68 | ADD_DEPENDENCIES(AllStaticPlugins Scenery3d-static) |
1186 | 72 | |||
1187 | 73 | |||
1188 | 74 | 69 | ||
1189 | === modified file 'plugins/Scenery3d/src/OBJ.cpp' | |||
1190 | --- plugins/Scenery3d/src/OBJ.cpp 2016-11-21 21:04:36 +0000 | |||
1191 | +++ plugins/Scenery3d/src/OBJ.cpp 2017-01-12 21:08:38 +0000 | |||
1192 | @@ -100,12 +100,16 @@ | |||
1193 | 100 | bool OBJ::vertexArraysSupported=false; | 100 | bool OBJ::vertexArraysSupported=false; |
1194 | 101 | GLenum OBJ::indexBufferType=GL_UNSIGNED_SHORT; | 101 | GLenum OBJ::indexBufferType=GL_UNSIGNED_SHORT; |
1195 | 102 | size_t OBJ::indexBufferTypeSize=0; | 102 | size_t OBJ::indexBufferTypeSize=0; |
1196 | 103 | QOpenGLFunctions* OBJ::gl=Q_NULLPTR; | ||
1197 | 103 | 104 | ||
1198 | 104 | //static function | 105 | //static function |
1199 | 105 | void OBJ::setupGL() | 106 | void OBJ::setupGL() |
1200 | 106 | { | 107 | { |
1201 | 108 | QOpenGLContext* ctx = QOpenGLContext::currentContext(); | ||
1202 | 109 | gl = ctx->functions(); | ||
1203 | 110 | |||
1204 | 107 | //disable VAOs on Intel because of serious bugs in their implemenation... | 111 | //disable VAOs on Intel because of serious bugs in their implemenation... |
1206 | 108 | QString vendor(reinterpret_cast<const char*>(glGetString(GL_VENDOR))); | 112 | QString vendor(reinterpret_cast<const char*>(gl->glGetString(GL_VENDOR))); |
1207 | 109 | if(vendor.contains("Intel",Qt::CaseInsensitive)) | 113 | if(vendor.contains("Intel",Qt::CaseInsensitive)) |
1208 | 110 | { | 114 | { |
1209 | 111 | OBJ::vertexArraysSupported = false; | 115 | OBJ::vertexArraysSupported = false; |
1210 | @@ -130,7 +134,6 @@ | |||
1211 | 130 | } | 134 | } |
1212 | 131 | 135 | ||
1213 | 132 | //check if we can enable int index buffers | 136 | //check if we can enable int index buffers |
1214 | 133 | QOpenGLContext* ctx = QOpenGLContext::currentContext(); | ||
1215 | 134 | if(ctx->isOpenGLES()) | 137 | if(ctx->isOpenGLES()) |
1216 | 135 | { | 138 | { |
1217 | 136 | //query for extension | 139 | //query for extension |
1218 | @@ -1709,19 +1712,19 @@ | |||
1219 | 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) |
1220 | 1710 | 1713 | ||
1221 | 1711 | //enable the attrib arrays | 1714 | //enable the attrib arrays |
1227 | 1712 | glEnableVertexAttribArray(ShaderMgr::ATTLOC_VERTEX); | 1715 | gl->glEnableVertexAttribArray(ShaderMgr::ATTLOC_VERTEX); |
1228 | 1713 | glEnableVertexAttribArray(ShaderMgr::ATTLOC_NORMAL); | 1716 | gl->glEnableVertexAttribArray(ShaderMgr::ATTLOC_NORMAL); |
1229 | 1714 | glEnableVertexAttribArray(ShaderMgr::ATTLOC_TEXCOORD); | 1717 | gl->glEnableVertexAttribArray(ShaderMgr::ATTLOC_TEXCOORD); |
1230 | 1715 | glEnableVertexAttribArray(ShaderMgr::ATTLOC_TANGENT); | 1718 | gl->glEnableVertexAttribArray(ShaderMgr::ATTLOC_TANGENT); |
1231 | 1716 | glEnableVertexAttribArray(ShaderMgr::ATTLOC_BITANGENT); | 1719 | gl->glEnableVertexAttribArray(ShaderMgr::ATTLOC_BITANGENT); |
1232 | 1717 | 1720 | ||
1233 | 1718 | const GLsizei stride = sizeof(Vertex); | 1721 | const GLsizei stride = sizeof(Vertex); |
1234 | 1719 | 1722 | ||
1240 | 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))); |
1241 | 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))); |
1242 | 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))); |
1243 | 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))); |
1244 | 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))); |
1245 | 1725 | 1728 | ||
1246 | 1726 | //vertex buffer does not need to remain bound, because the binding is stored by glVertexAttribPointer | 1729 | //vertex buffer does not need to remain bound, because the binding is stored by glVertexAttribPointer |
1247 | 1727 | m_vertexBuffer.release(); | 1730 | m_vertexBuffer.release(); |
1248 | @@ -1736,11 +1739,11 @@ | |||
1249 | 1736 | m_indexBuffer.release(); | 1739 | m_indexBuffer.release(); |
1250 | 1737 | 1740 | ||
1251 | 1738 | //disable our attribute arrays | 1741 | //disable our attribute arrays |
1257 | 1739 | glDisableVertexAttribArray(ShaderMgr::ATTLOC_VERTEX); | 1742 | gl->glDisableVertexAttribArray(ShaderMgr::ATTLOC_VERTEX); |
1258 | 1740 | glDisableVertexAttribArray(ShaderMgr::ATTLOC_NORMAL); | 1743 | gl->glDisableVertexAttribArray(ShaderMgr::ATTLOC_NORMAL); |
1259 | 1741 | glDisableVertexAttribArray(ShaderMgr::ATTLOC_TEXCOORD); | 1744 | gl->glDisableVertexAttribArray(ShaderMgr::ATTLOC_TEXCOORD); |
1260 | 1742 | glDisableVertexAttribArray(ShaderMgr::ATTLOC_TANGENT); | 1745 | gl->glDisableVertexAttribArray(ShaderMgr::ATTLOC_TANGENT); |
1261 | 1743 | glDisableVertexAttribArray(ShaderMgr::ATTLOC_BITANGENT); | 1746 | gl->glDisableVertexAttribArray(ShaderMgr::ATTLOC_BITANGENT); |
1262 | 1744 | } | 1747 | } |
1263 | 1745 | 1748 | ||
1264 | 1746 | void OBJ::transform(QMatrix4x4 mat) | 1749 | void OBJ::transform(QMatrix4x4 mat) |
1265 | 1747 | 1750 | ||
1266 | === modified file 'plugins/Scenery3d/src/OBJ.hpp' | |||
1267 | --- plugins/Scenery3d/src/OBJ.hpp 2015-04-15 13:42:29 +0000 | |||
1268 | +++ plugins/Scenery3d/src/OBJ.hpp 2017-01-12 21:08:38 +0000 | |||
1269 | @@ -336,6 +336,8 @@ | |||
1270 | 336 | QOpenGLBuffer m_indexBuffer; | 336 | QOpenGLBuffer m_indexBuffer; |
1271 | 337 | QOpenGLVertexArrayObject* m_vertexArrayObject; | 337 | QOpenGLVertexArrayObject* m_vertexArrayObject; |
1272 | 338 | 338 | ||
1273 | 339 | static QOpenGLFunctions* gl; | ||
1274 | 340 | |||
1275 | 339 | //! Heightmap | 341 | //! Heightmap |
1276 | 340 | friend class Heightmap; | 342 | friend class Heightmap; |
1277 | 341 | }; | 343 | }; |
1278 | 342 | 344 | ||
1279 | === modified file 'plugins/Scenery3d/src/Scenery3d.cpp' | |||
1280 | --- plugins/Scenery3d/src/Scenery3d.cpp 2016-11-24 18:15:41 +0000 | |||
1281 | +++ plugins/Scenery3d/src/Scenery3d.cpp 2017-01-12 21:08:38 +0000 | |||
1282 | @@ -20,13 +20,7 @@ | |||
1283 | 20 | 20 | ||
1284 | 21 | #include <QtGlobal> | 21 | #include <QtGlobal> |
1285 | 22 | 22 | ||
1286 | 23 | #if !defined(Q_OS_WIN) | ||
1287 | 24 | //exclude StelOpenGL here on windows because of conflicts with GLFuncs.hpp otherwise (uses QOpenGLFunctions_1_0 directly) | ||
1288 | 25 | #include "StelOpenGL.hpp" | ||
1289 | 26 | #endif | ||
1290 | 27 | //needs to be included before StelOpenGL on Windows | ||
1291 | 28 | #include "GLFuncs.hpp" | 23 | #include "GLFuncs.hpp" |
1292 | 29 | |||
1293 | 30 | #include "Scenery3d.hpp" | 24 | #include "Scenery3d.hpp" |
1294 | 31 | 25 | ||
1295 | 32 | #include "StelApp.hpp" | 26 | #include "StelApp.hpp" |
1296 | @@ -49,15 +43,8 @@ | |||
1297 | 49 | #include <stdexcept> | 43 | #include <stdexcept> |
1298 | 50 | #include <cmath> | 44 | #include <cmath> |
1299 | 51 | #include <QOpenGLShaderProgram> | 45 | #include <QOpenGLShaderProgram> |
1300 | 52 | #include <QOpenGLFramebufferObject> | ||
1301 | 53 | 46 | ||
1309 | 54 | #define GET_GLERROR() \ | 47 | #define GET_GLERROR() StelOpenGL::checkGLErrors(__FILE__,__LINE__); |
1303 | 55 | { \ | ||
1304 | 56 | GLenum err = glGetError(); \ | ||
1305 | 57 | if (err != GL_NO_ERROR) { \ | ||
1306 | 58 | qWarning("[line %d] GL Error: %d",__LINE__, err); \ | ||
1307 | 59 | } \ | ||
1308 | 60 | } | ||
1310 | 61 | 48 | ||
1311 | 62 | //macro for easier uniform setting | 49 | //macro for easier uniform setting |
1312 | 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) |
1313 | @@ -112,6 +99,7 @@ | |||
1314 | 112 | shaderParameters.geometryShader = false; | 99 | shaderParameters.geometryShader = false; |
1315 | 113 | shaderParameters.torchLight = false; | 100 | shaderParameters.torchLight = false; |
1316 | 114 | shaderParameters.frustumSplits = 0; | 101 | shaderParameters.frustumSplits = 0; |
1317 | 102 | shaderParameters.hwShadowSamplers = false; | ||
1318 | 115 | 103 | ||
1319 | 116 | sceneBoundingBox = AABB(Vec3f(0.0f), Vec3f(0.0f)); | 104 | sceneBoundingBox = AABB(Vec3f(0.0f), Vec3f(0.0f)); |
1320 | 117 | 105 | ||
1321 | @@ -253,6 +241,10 @@ | |||
1322 | 253 | 241 | ||
1323 | 254 | void Scenery3d::finalizeLoad() | 242 | void Scenery3d::finalizeLoad() |
1324 | 255 | { | 243 | { |
1325 | 244 | //must ensure the correct GL context is active! | ||
1326 | 245 | //this is not guaranteed with the new QOpenGLWidget outside of init() and draw()! | ||
1327 | 246 | StelApp::getInstance().ensureGLContextCurrent(); | ||
1328 | 247 | |||
1329 | 256 | currentScene = loadingScene; | 248 | currentScene = loadingScene; |
1330 | 257 | 249 | ||
1331 | 258 | //move load data to current one | 250 | //move load data to current one |
1332 | @@ -594,7 +586,7 @@ | |||
1333 | 594 | { | 586 | { |
1334 | 595 | //send size of light ortho for each frustum | 587 | //send size of light ortho for each frustum |
1335 | 596 | loc = shaderManager.uniformLocation(shader,ShaderMgr::UNIFORM_VEC_LIGHTORTHOSCALE); | 588 | loc = shaderManager.uniformLocation(shader,ShaderMgr::UNIFORM_VEC_LIGHTORTHOSCALE); |
1337 | 597 | shader->setUniformValueArray(loc,shadowFrustumSize.constData(),4); | 589 | shader->setUniformValueArray(loc,shadowFrustumSize.constData(),shaderParameters.frustumSplits); |
1338 | 598 | } | 590 | } |
1339 | 599 | } | 591 | } |
1340 | 600 | 592 | ||
1341 | @@ -802,7 +794,7 @@ | |||
1342 | 802 | } | 794 | } |
1343 | 803 | } | 795 | } |
1344 | 804 | 796 | ||
1346 | 805 | 797 | GET_GLERROR() | |
1347 | 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)); |
1348 | 807 | drawnTriangles+=pStelModel->triangleCount; | 799 | drawnTriangles+=pStelModel->triangleCount; |
1349 | 808 | } | 800 | } |
1350 | @@ -1130,7 +1122,7 @@ | |||
1351 | 1130 | 1122 | ||
1352 | 1131 | 1123 | ||
1353 | 1132 | //Unbind | 1124 | //Unbind |
1355 | 1133 | glBindFramebuffer(GL_FRAMEBUFFER, 0); | 1125 | glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO); |
1356 | 1134 | 1126 | ||
1357 | 1135 | //reset viewport (see StelPainter::setProjector) | 1127 | //reset viewport (see StelPainter::setProjector) |
1358 | 1136 | const Vec4i& vp = altAzProjector->getViewport(); | 1128 | const Vec4i& vp = altAzProjector->getViewport(); |
1359 | @@ -1576,7 +1568,7 @@ | |||
1360 | 1576 | } | 1568 | } |
1361 | 1577 | 1569 | ||
1362 | 1578 | //cubemap fbo must be released | 1570 | //cubemap fbo must be released |
1364 | 1579 | glBindFramebuffer(GL_FRAMEBUFFER,0); | 1571 | glBindFramebuffer(GL_FRAMEBUFFER,defaultFBO); |
1365 | 1580 | 1572 | ||
1366 | 1581 | //reset GL state | 1573 | //reset GL state |
1367 | 1582 | glDepthMask(GL_FALSE); | 1574 | glDepthMask(GL_FALSE); |
1368 | @@ -2052,9 +2044,11 @@ | |||
1369 | 2052 | 2044 | ||
1370 | 2053 | void Scenery3d::init() | 2045 | void Scenery3d::init() |
1371 | 2054 | { | 2046 | { |
1372 | 2047 | initializeOpenGLFunctions(); | ||
1373 | 2055 | OBJ::setupGL(); | 2048 | OBJ::setupGL(); |
1374 | 2056 | 2049 | ||
1375 | 2057 | QOpenGLContext* ctx = QOpenGLContext::currentContext(); | 2050 | QOpenGLContext* ctx = QOpenGLContext::currentContext(); |
1376 | 2051 | Q_ASSERT(ctx); | ||
1377 | 2058 | 2052 | ||
1378 | 2059 | #ifndef QT_OPENGL_ES_2 | 2053 | #ifndef QT_OPENGL_ES_2 |
1379 | 2060 | //initialize additional functions needed and not provided through StelOpenGL | 2054 | //initialize additional functions needed and not provided through StelOpenGL |
1380 | @@ -2369,7 +2363,7 @@ | |||
1381 | 2369 | } | 2363 | } |
1382 | 2370 | 2364 | ||
1383 | 2371 | //unbind last framebuffer | 2365 | //unbind last framebuffer |
1385 | 2372 | glBindFramebuffer(GL_FRAMEBUFFER,0); | 2366 | glBindFramebuffer(GL_FRAMEBUFFER,defaultFBO); |
1386 | 2373 | 2367 | ||
1387 | 2374 | //initialize cube rotations... found by trial and error :) | 2368 | //initialize cube rotations... found by trial and error :) |
1388 | 2375 | QMatrix4x4 stackBase; | 2369 | QMatrix4x4 stackBase; |
1389 | @@ -2633,7 +2627,23 @@ | |||
1390 | 2633 | //for OpenGL ES2, type has to be UNSIGNED_SHORT or UNSIGNED_INT for depth textures, desktop does probably not care | 2627 | //for OpenGL ES2, type has to be UNSIGNED_SHORT or UNSIGNED_INT for depth textures, desktop does probably not care |
1391 | 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); |
1392 | 2635 | 2629 | ||
1394 | 2636 | GLint filter = (shaderParameters.shadowFilterQuality == S3DEnum::SFQ_HARDWARE | 2630 | //we use hardware-accelerated depth compare mode, unless pcss is used |
1395 | 2631 | shaderParameters.hwShadowSamplers = false; | ||
1396 | 2632 | //NOTE: cant use depth compare mode on ES2 | ||
1397 | 2633 | if(!pcssEnabled) | ||
1398 | 2634 | { | ||
1399 | 2635 | #ifndef QT_OPENGL_ES_2 | ||
1400 | 2636 | if(!isEs) | ||
1401 | 2637 | { | ||
1402 | 2638 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE); | ||
1403 | 2639 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); | ||
1404 | 2640 | shaderParameters.hwShadowSamplers = true; | ||
1405 | 2641 | } | ||
1406 | 2642 | #endif | ||
1407 | 2643 | } | ||
1408 | 2644 | |||
1409 | 2645 | //IF we support hw shadow sampling, then we may enable linear filtering, otherwise filtering depth values directly would not make much sense | ||
1410 | 2646 | GLint filter = shaderParameters.hwShadowSamplers && (shaderParameters.shadowFilterQuality == S3DEnum::SFQ_HARDWARE | ||
1411 | 2637 | || shaderParameters.shadowFilterQuality == S3DEnum::SFQ_LOW_HARDWARE | 2647 | || shaderParameters.shadowFilterQuality == S3DEnum::SFQ_LOW_HARDWARE |
1412 | 2638 | || shaderParameters.shadowFilterQuality == S3DEnum::SFQ_HIGH_HARDWARE) ? GL_LINEAR : GL_NEAREST; | 2648 | || shaderParameters.shadowFilterQuality == S3DEnum::SFQ_HIGH_HARDWARE) ? GL_LINEAR : GL_NEAREST; |
1413 | 2639 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); | 2649 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); |
1414 | @@ -2649,18 +2659,6 @@ | |||
1415 | 2649 | glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, ones); | 2659 | glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, ones); |
1416 | 2650 | } | 2660 | } |
1417 | 2651 | #endif | 2661 | #endif |
1418 | 2652 | //we use hardware-accelerated depth compare mode, unless pcss is used | ||
1419 | 2653 | //NOTE: cant use depth compare mode on ES2 | ||
1420 | 2654 | if(!pcssEnabled) | ||
1421 | 2655 | { | ||
1422 | 2656 | #ifndef QT_OPENGL_ES_2 | ||
1423 | 2657 | if(!isEs) | ||
1424 | 2658 | { | ||
1425 | 2659 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE); | ||
1426 | 2660 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); | ||
1427 | 2661 | } | ||
1428 | 2662 | #endif | ||
1429 | 2663 | } | ||
1430 | 2664 | 2662 | ||
1431 | 2665 | //Attach the depthmap to the Buffer | 2663 | //Attach the depthmap to the Buffer |
1432 | 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); |
1433 | @@ -2689,7 +2687,7 @@ | |||
1434 | 2689 | } | 2687 | } |
1435 | 2690 | 2688 | ||
1436 | 2691 | //Done. Unbind and switch to normal texture unit 0 | 2689 | //Done. Unbind and switch to normal texture unit 0 |
1438 | 2692 | glBindFramebuffer(GL_FRAMEBUFFER, 0); | 2690 | glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO); |
1439 | 2693 | glActiveTexture(GL_TEXTURE0); | 2691 | glActiveTexture(GL_TEXTURE0); |
1440 | 2694 | 2692 | ||
1441 | 2695 | qDebug()<<"[Scenery3D] shadowmapping initialized"; | 2693 | qDebug()<<"[Scenery3D] shadowmapping initialized"; |
1442 | @@ -2713,6 +2711,9 @@ | |||
1443 | 2713 | if(!objModel || !objModel->hasStelModels()) | 2711 | if(!objModel || !objModel->hasStelModels()) |
1444 | 2714 | return; | 2712 | return; |
1445 | 2715 | 2713 | ||
1446 | 2714 | //find out the default FBO | ||
1447 | 2715 | defaultFBO = StelApp::getInstance().getDefaultFBO(); | ||
1448 | 2716 | |||
1449 | 2716 | //reset render statistic | 2717 | //reset render statistic |
1450 | 2717 | drawnTriangles = drawnModels = materialSwitches = shaderSwitches = 0; | 2718 | drawnTriangles = drawnModels = materialSwitches = shaderSwitches = 0; |
1451 | 2718 | 2719 | ||
1452 | 2719 | 2720 | ||
1453 | === modified file 'plugins/Scenery3d/src/Scenery3d.hpp' | |||
1454 | --- plugins/Scenery3d/src/Scenery3d.hpp 2016-11-24 18:15:41 +0000 | |||
1455 | +++ plugins/Scenery3d/src/Scenery3d.hpp 2017-01-12 21:08:38 +0000 | |||
1456 | @@ -38,12 +38,11 @@ | |||
1457 | 38 | #include <QMatrix4x4> | 38 | #include <QMatrix4x4> |
1458 | 39 | 39 | ||
1459 | 40 | //predeclarations | 40 | //predeclarations |
1460 | 41 | class QOpenGLFramebufferObject; | ||
1461 | 42 | class Scenery3dMgr; | 41 | class Scenery3dMgr; |
1462 | 43 | class LandscapeMgr; | 42 | class LandscapeMgr; |
1463 | 44 | 43 | ||
1464 | 45 | //! Representation of a complete 3D scenery | 44 | //! Representation of a complete 3D scenery |
1466 | 46 | class Scenery3d | 45 | class Scenery3d : protected QOpenGLFunctions |
1467 | 47 | { | 46 | { |
1468 | 48 | public: | 47 | public: |
1469 | 49 | //! Initializes an empty Scenery3d object. | 48 | //! Initializes an empty Scenery3d object. |
1470 | @@ -178,6 +177,7 @@ | |||
1471 | 178 | bool supportsShadowFiltering; //if shadow filtering is supported | 177 | bool supportsShadowFiltering; //if shadow filtering is supported |
1472 | 179 | bool isANGLE; //true if running on ANGLE | 178 | bool isANGLE; //true if running on ANGLE |
1473 | 180 | unsigned int maximumFramebufferSize; | 179 | unsigned int maximumFramebufferSize; |
1474 | 180 | GLuint defaultFBO; //the default background FBO handle | ||
1475 | 181 | 181 | ||
1476 | 182 | float torchBrightness; // toggle light brightness | 182 | float torchBrightness; // toggle light brightness |
1477 | 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/ |
1478 | 184 | 184 | ||
1479 | === modified file 'plugins/Scenery3d/src/ShaderManager.cpp' | |||
1480 | --- plugins/Scenery3d/src/ShaderManager.cpp 2015-05-18 12:01:39 +0000 | |||
1481 | +++ plugins/Scenery3d/src/ShaderManager.cpp 2017-01-12 21:08:38 +0000 | |||
1482 | @@ -102,6 +102,7 @@ | |||
1483 | 102 | featureFlagsStrings["PCSS"] = PCSS; | 102 | featureFlagsStrings["PCSS"] = PCSS; |
1484 | 103 | featureFlagsStrings["SINGLE_SHADOW_FRUSTUM"] = SINGLE_SHADOW_FRUSTUM; | 103 | featureFlagsStrings["SINGLE_SHADOW_FRUSTUM"] = SINGLE_SHADOW_FRUSTUM; |
1485 | 104 | featureFlagsStrings["OGL_ES2"] = OGL_ES2; | 104 | featureFlagsStrings["OGL_ES2"] = OGL_ES2; |
1486 | 105 | featureFlagsStrings["HW_SHADOW_SAMPLERS"] = HW_SHADOW_SAMPLERS; | ||
1487 | 105 | } | 106 | } |
1488 | 106 | } | 107 | } |
1489 | 107 | 108 | ||
1490 | @@ -437,8 +438,10 @@ | |||
1491 | 437 | //this enumerates all available uniforms of this shader, and stores their locations in a map | 438 | //this enumerates all available uniforms of this shader, and stores their locations in a map |
1492 | 438 | GLuint prog = program.programId(); | 439 | GLuint prog = program.programId(); |
1493 | 439 | GLint numUniforms=0,bufSize; | 440 | GLint numUniforms=0,bufSize; |
1496 | 440 | glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &numUniforms); | 441 | |
1497 | 441 | glGetProgramiv(prog, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufSize); | 442 | QOpenGLFunctions* gl = QOpenGLContext::currentContext()->functions(); |
1498 | 443 | GL(gl->glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &numUniforms)); | ||
1499 | 444 | GL(gl->glGetProgramiv(prog, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufSize)); | ||
1500 | 442 | 445 | ||
1501 | 443 | QByteArray buf(bufSize,'\0'); | 446 | QByteArray buf(bufSize,'\0'); |
1502 | 444 | GLsizei length; | 447 | GLsizei length; |
1503 | @@ -450,7 +453,7 @@ | |||
1504 | 450 | #endif | 453 | #endif |
1505 | 451 | for(int i =0;i<numUniforms;++i) | 454 | for(int i =0;i<numUniforms;++i) |
1506 | 452 | { | 455 | { |
1508 | 453 | glGetActiveUniform(prog,i,bufSize,&length,&size,&type,buf.data()); | 456 | GL(gl->glGetActiveUniform(prog,i,bufSize,&length,&size,&type,buf.data())); |
1509 | 454 | QString str(buf); | 457 | QString str(buf); |
1510 | 455 | str = str.trimmed(); // no idea if this is required | 458 | str = str.trimmed(); // no idea if this is required |
1511 | 456 | 459 | ||
1512 | 457 | 460 | ||
1513 | === modified file 'plugins/Scenery3d/src/ShaderManager.hpp' | |||
1514 | --- plugins/Scenery3d/src/ShaderManager.hpp 2015-05-18 12:01:39 +0000 | |||
1515 | +++ plugins/Scenery3d/src/ShaderManager.hpp 2017-01-12 21:08:38 +0000 | |||
1516 | @@ -42,6 +42,7 @@ | |||
1517 | 42 | bool torchLight; | 42 | bool torchLight; |
1518 | 43 | //for now, only 1 or 4 really supported | 43 | //for now, only 1 or 4 really supported |
1519 | 44 | int frustumSplits; | 44 | int frustumSplits; |
1520 | 45 | bool hwShadowSamplers; | ||
1521 | 45 | }; | 46 | }; |
1522 | 46 | 47 | ||
1523 | 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. |
1524 | @@ -199,6 +200,8 @@ | |||
1525 | 199 | SINGLE_SHADOW_FRUSTUM = (1<<18), | 200 | SINGLE_SHADOW_FRUSTUM = (1<<18), |
1526 | 200 | //set if opengl es2 | 201 | //set if opengl es2 |
1527 | 201 | OGL_ES2 = (1<<19), | 202 | OGL_ES2 = (1<<19), |
1528 | 203 | //true if shadow samplers (shadow2d) should be used for shadow maps instead of normal samplers (texture2d) | ||
1529 | 204 | HW_SHADOW_SAMPLERS = (1<<20) | ||
1530 | 202 | }; | 205 | }; |
1531 | 203 | 206 | ||
1532 | 204 | typedef QMap<QString,FeatureFlags> t_FeatureFlagStrings; | 207 | typedef QMap<QString,FeatureFlags> t_FeatureFlagStrings; |
1533 | @@ -238,7 +241,8 @@ | |||
1534 | 238 | if(globals.pixelLighting && globals.shadows) flags|= SHADOWS; | 241 | if(globals.pixelLighting && globals.shadows) flags|= SHADOWS; |
1535 | 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; |
1536 | 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; |
1538 | 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; |
1539 | 245 | if(globals.hwShadowSamplers) flags|=HW_SHADOW_SAMPLERS; | ||
1540 | 242 | if(globals.geometryShader) flags|= GEOMETRY_SHADER; | 246 | if(globals.geometryShader) flags|= GEOMETRY_SHADER; |
1541 | 243 | if(globals.torchLight) flags|= TORCH; | 247 | if(globals.torchLight) flags|= TORCH; |
1542 | 244 | if(globals.frustumSplits == 1) flags|= SINGLE_SHADOW_FRUSTUM; | 248 | if(globals.frustumSplits == 1) flags|= SINGLE_SHADOW_FRUSTUM; |
1543 | 245 | 249 | ||
1544 | === modified file 'plugins/SimpleDrawLine/src/CMakeLists.txt' | |||
1545 | --- plugins/SimpleDrawLine/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
1546 | +++ plugins/SimpleDrawLine/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
1547 | @@ -7,12 +7,11 @@ | |||
1548 | 7 | SimpleDrawLine.cpp | 7 | SimpleDrawLine.cpp |
1549 | 8 | ) | 8 | ) |
1550 | 9 | 9 | ||
1552 | 10 | SET(extLinkerOption ${OPENGL_LIBRARIES}) | 10 | SET(SimpleDrawLine_Qt_Libraries Qt5::Core Qt5::Gui) |
1553 | 11 | 11 | ||
1554 | 12 | ############### For building the dynamic library ###################### | 12 | ############### For building the dynamic library ###################### |
1555 | 13 | IF(BUILD_DYNAMIC_PLUGIN) | 13 | IF(BUILD_DYNAMIC_PLUGIN) |
1556 | 14 | ADD_LIBRARY(SimpleDrawLine MODULE ${SimpleDrawLine_SRCS}) | 14 | ADD_LIBRARY(SimpleDrawLine MODULE ${SimpleDrawLine_SRCS}) |
1557 | 15 | QT5_USE_MODULES(SimpleDrawLine-static Core OpenGL) | ||
1558 | 16 | IF(APPLE) | 15 | IF(APPLE) |
1559 | 17 | FIND_LIBRARY(OPENGL_LIBRARY OpenGL) | 16 | FIND_LIBRARY(OPENGL_LIBRARY OpenGL) |
1560 | 18 | MARK_AS_ADVANCED(OPENGL_LIBRARY) | 17 | MARK_AS_ADVANCED(OPENGL_LIBRARY) |
1561 | @@ -26,15 +25,14 @@ | |||
1562 | 26 | SET(StelMain ) | 25 | SET(StelMain ) |
1563 | 27 | ENDIF(WIN32) | 26 | ENDIF(WIN32) |
1564 | 28 | 27 | ||
1566 | 29 | TARGET_LINK_LIBRARIES(SimpleDrawLine ${StelMain} ${extLinkerOption}) | 28 | TARGET_LINK_LIBRARIES(SimpleDrawLine ${StelMain} ${SimpleDrawLine_Qt_Libraries}) |
1567 | 30 | INSTALL(TARGETS SimpleDrawLine DESTINATION "modules/SimpleDrawLine") | 29 | INSTALL(TARGETS SimpleDrawLine DESTINATION "modules/SimpleDrawLine") |
1568 | 31 | ELSE() | 30 | ELSE() |
1569 | 32 | ############### For building the static library ###################### | 31 | ############### For building the static library ###################### |
1570 | 33 | ADD_LIBRARY(SimpleDrawLine-static STATIC ${SimpleDrawLine_SRCS}) | 32 | ADD_LIBRARY(SimpleDrawLine-static STATIC ${SimpleDrawLine_SRCS}) |
1571 | 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. |
1572 | 35 | QT5_USE_MODULES(SimpleDrawLine-static Core OpenGL) | ||
1573 | 36 | SET_TARGET_PROPERTIES(SimpleDrawLine-static PROPERTIES OUTPUT_NAME "SimpleDrawLine") | 34 | SET_TARGET_PROPERTIES(SimpleDrawLine-static PROPERTIES OUTPUT_NAME "SimpleDrawLine") |
1575 | 37 | TARGET_LINK_LIBRARIES(SimpleDrawLine-static ${extLinkerOption}) | 35 | TARGET_LINK_LIBRARIES(SimpleDrawLine-static ${StelMain} ${SimpleDrawLine_Qt_Libraries}) |
1576 | 38 | SET_TARGET_PROPERTIES(SimpleDrawLine-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 36 | SET_TARGET_PROPERTIES(SimpleDrawLine-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
1577 | 39 | ADD_DEPENDENCIES(AllStaticPlugins SimpleDrawLine-static) | 37 | ADD_DEPENDENCIES(AllStaticPlugins SimpleDrawLine-static) |
1578 | 40 | ENDIF() | 38 | ENDIF() |
1579 | 41 | 39 | ||
1580 | === modified file 'plugins/SolarSystemEditor/src/CMakeLists.txt' | |||
1581 | --- plugins/SolarSystemEditor/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
1582 | +++ plugins/SolarSystemEditor/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
1583 | @@ -28,12 +28,8 @@ | |||
1584 | 28 | 28 | ||
1585 | 29 | QT5_WRAP_UI(SolarSystemEditor_UIS_H ${SolarSystemEditor_UIS}) | 29 | QT5_WRAP_UI(SolarSystemEditor_UIS_H ${SolarSystemEditor_UIS}) |
1586 | 30 | 30 | ||
1587 | 31 | |||
1588 | 32 | SET(extLinkerOption ${OPENGL_LIBRARIES}) | ||
1589 | 33 | |||
1590 | 34 | ADD_LIBRARY(SolarSystemEditor-static STATIC ${SolarSystemEditor_SRCS} ${SolarSystemEditor_RES_CXX} ${SolarSystemEditor_UIS_H}) | 31 | ADD_LIBRARY(SolarSystemEditor-static STATIC ${SolarSystemEditor_SRCS} ${SolarSystemEditor_RES_CXX} ${SolarSystemEditor_UIS_H}) |
1592 | 35 | QT5_USE_MODULES(SolarSystemEditor-static Core Network Widgets) | 32 | TARGET_LINK_LIBRARIES(SolarSystemEditor-static Qt5::Core Qt5::Network Qt5::Widgets) |
1593 | 36 | SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES OUTPUT_NAME "SolarSystemEditor") | 33 | SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES OUTPUT_NAME "SolarSystemEditor") |
1594 | 37 | TARGET_LINK_LIBRARIES(SolarSystemEditor-static ${extLinkerOption}) | ||
1595 | 38 | SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 34 | SET_TARGET_PROPERTIES(SolarSystemEditor-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
1596 | 39 | ADD_DEPENDENCIES(AllStaticPlugins SolarSystemEditor-static) | 35 | ADD_DEPENDENCIES(AllStaticPlugins SolarSystemEditor-static) |
1597 | 40 | 36 | ||
1598 | === modified file 'plugins/Supernovae/src/CMakeLists.txt' | |||
1599 | --- plugins/Supernovae/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
1600 | +++ plugins/Supernovae/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
1601 | @@ -25,11 +25,8 @@ | |||
1602 | 25 | SET(Supernovae_RES ../resources/Supernovae.qrc) | 25 | SET(Supernovae_RES ../resources/Supernovae.qrc) |
1603 | 26 | QT5_ADD_RESOURCES(Supernovae_RES_CXX ${Supernovae_RES}) | 26 | QT5_ADD_RESOURCES(Supernovae_RES_CXX ${Supernovae_RES}) |
1604 | 27 | 27 | ||
1605 | 28 | SET(extLinkerOption ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${OPENGL_LIBRARIES}) | ||
1606 | 29 | |||
1607 | 30 | ADD_LIBRARY(Supernovae-static STATIC ${Supernovae_SRCS} ${Supernovae_RES_CXX} ${SupernovaeDialog_UIS_H}) | 28 | ADD_LIBRARY(Supernovae-static STATIC ${Supernovae_SRCS} ${Supernovae_RES_CXX} ${SupernovaeDialog_UIS_H}) |
1609 | 31 | QT5_USE_MODULES(Supernovae-static Core Network Widgets) | 29 | TARGET_LINK_LIBRARIES(Supernovae-static Qt5::Core Qt5::Network Qt5::Widgets) |
1610 | 32 | SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES OUTPUT_NAME "Supernovae") | 30 | SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES OUTPUT_NAME "Supernovae") |
1611 | 33 | TARGET_LINK_LIBRARIES(Supernovae-static ${extLinkerOption}) | ||
1612 | 34 | SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 31 | SET_TARGET_PROPERTIES(Supernovae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
1613 | 35 | ADD_DEPENDENCIES(AllStaticPlugins Supernovae-static) | 32 | ADD_DEPENDENCIES(AllStaticPlugins Supernovae-static) |
1614 | 36 | 33 | ||
1615 | === modified file 'plugins/Supernovae/src/Supernovae.cpp' | |||
1616 | --- plugins/Supernovae/src/Supernovae.cpp 2016-08-07 10:10:32 +0000 | |||
1617 | +++ plugins/Supernovae/src/Supernovae.cpp 2017-01-12 21:08:38 +0000 | |||
1618 | @@ -227,9 +227,7 @@ | |||
1619 | 227 | const Vec3f& c(obj->getInfoColor()); | 227 | const Vec3f& c(obj->getInfoColor()); |
1620 | 228 | painter.setColor(c[0],c[1],c[2]); | 228 | painter.setColor(c[0],c[1],c[2]); |
1621 | 229 | texPointer->bind(); | 229 | texPointer->bind(); |
1625 | 230 | painter.enableTexture2d(true); | 230 | painter.setBlending(true); |
1623 | 231 | glEnable(GL_BLEND); | ||
1624 | 232 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | ||
1626 | 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.); |
1627 | 234 | } | 232 | } |
1628 | 235 | } | 233 | } |
1629 | 236 | 234 | ||
1630 | === modified file 'plugins/TelescopeControl/src/CMakeLists.txt' | |||
1631 | --- plugins/TelescopeControl/src/CMakeLists.txt 2015-11-12 12:38:13 +0000 | |||
1632 | +++ plugins/TelescopeControl/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
1633 | @@ -66,11 +66,15 @@ | |||
1634 | 66 | SET(TelescopeControl_RES ../resources/TelescopeControl.qrc) | 66 | SET(TelescopeControl_RES ../resources/TelescopeControl.qrc) |
1635 | 67 | QT5_ADD_RESOURCES(TelescopeControl_RES_CXX ${TelescopeControl_RES}) | 67 | QT5_ADD_RESOURCES(TelescopeControl_RES_CXX ${TelescopeControl_RES}) |
1636 | 68 | 68 | ||
1638 | 69 | SET(extLinkerOption ${OPENGL_LIBRARIES}) | 69 | #IF(WIN32 AND NOT MSVC) |
1639 | 70 | # TODO: Test if winsock is still necessary if the Telescope Control plug-in is disabled. | ||
1640 | 71 | # Because including it here seems to duplicate STELLARIUM_STATIC_PLUGINS_LIBRARIES | ||
1641 | 72 | # SET(extLinkerOption ${extLinkerOption} libwinmm.a -lws2_32) | ||
1642 | 73 | #ENDIF() | ||
1643 | 74 | # | ||
1644 | 70 | 75 | ||
1645 | 71 | ADD_LIBRARY(TelescopeControl-static STATIC ${TelescopeControl_SRCS} ${TelescopeControl_RES_CXX} ${TelescopeControl_UIS_H}) | 76 | ADD_LIBRARY(TelescopeControl-static STATIC ${TelescopeControl_SRCS} ${TelescopeControl_RES_CXX} ${TelescopeControl_UIS_H}) |
1646 | 72 | SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES OUTPUT_NAME "TelescopeControl") | 77 | SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES OUTPUT_NAME "TelescopeControl") |
1649 | 73 | TARGET_LINK_LIBRARIES(TelescopeControl-static ${extLinkerOption}) | 78 | TARGET_LINK_LIBRARIES(TelescopeControl-static Qt5::Core Qt5::Network Qt5::Widgets Qt5::SerialPort) |
1648 | 74 | QT5_USE_MODULES(TelescopeControl-static Core Network Widgets SerialPort OpenGL) | ||
1650 | 75 | SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 79 | SET_TARGET_PROPERTIES(TelescopeControl-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
1651 | 76 | ADD_DEPENDENCIES(AllStaticPlugins TelescopeControl-static) | 80 | ADD_DEPENDENCIES(AllStaticPlugins TelescopeControl-static) |
1652 | 77 | 81 | ||
1653 | === modified file 'plugins/TelescopeControl/src/TelescopeControl.cpp' | |||
1654 | --- plugins/TelescopeControl/src/TelescopeControl.cpp 2016-07-03 21:58:54 +0000 | |||
1655 | +++ plugins/TelescopeControl/src/TelescopeControl.cpp 2017-01-12 21:08:38 +0000 | |||
1656 | @@ -278,21 +278,16 @@ | |||
1657 | 278 | if (circleFader.getInterstate() >= 0) | 278 | if (circleFader.getInterstate() >= 0) |
1658 | 279 | { | 279 | { |
1659 | 280 | sPainter.setColor(circleColor[0], circleColor[1], circleColor[2], circleFader.getInterstate()); | 280 | sPainter.setColor(circleColor[0], circleColor[1], circleColor[2], circleFader.getInterstate()); |
1660 | 281 | glDisable(GL_TEXTURE_2D); | ||
1661 | 282 | foreach (double circle, telescope->getOculars()) | 281 | foreach (double circle, telescope->getOculars()) |
1662 | 283 | { | 282 | { |
1663 | 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)); |
1664 | 285 | } | 284 | } |
1665 | 286 | glEnable(GL_TEXTURE_2D); | ||
1666 | 287 | } | 285 | } |
1667 | 288 | if (reticleFader.getInterstate() >= 0) | 286 | if (reticleFader.getInterstate() >= 0) |
1668 | 289 | { | 287 | { |
1672 | 290 | glEnable(GL_TEXTURE_2D); | 288 | sPainter.setBlending(true, GL_SRC_ALPHA, GL_ONE); |
1670 | 291 | glEnable(GL_BLEND); | ||
1671 | 292 | glBlendFunc(GL_SRC_ALPHA, GL_ONE); | ||
1673 | 293 | sPainter.setColor(reticleColor[0], reticleColor[1], reticleColor[2], reticleFader.getInterstate()); | 289 | sPainter.setColor(reticleColor[0], reticleColor[1], reticleColor[2], reticleFader.getInterstate()); |
1674 | 294 | sPainter.drawSprite2dMode(XY[0],XY[1],15.f); | 290 | sPainter.drawSprite2dMode(XY[0],XY[1],15.f); |
1675 | 295 | glDisable(GL_TEXTURE_2D); | ||
1676 | 296 | } | 291 | } |
1677 | 297 | if (labelFader.getInterstate() >= 0) | 292 | if (labelFader.getInterstate() >= 0) |
1678 | 298 | { | 293 | { |
1679 | @@ -423,9 +418,7 @@ | |||
1680 | 423 | const Vec3f& c(obj->getInfoColor()); | 418 | const Vec3f& c(obj->getInfoColor()); |
1681 | 424 | sPainter.setColor(c[0], c[1], c[2]); | 419 | sPainter.setColor(c[0], c[1], c[2]); |
1682 | 425 | selectionTexture->bind(); | 420 | selectionTexture->bind(); |
1686 | 426 | glEnable(GL_TEXTURE_2D); | 421 | sPainter.setBlending(true); |
1684 | 427 | glEnable(GL_BLEND); | ||
1685 | 428 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode | ||
1687 | 429 | sPainter.drawSprite2dMode(screenpos[0], screenpos[1], 25., StelApp::getInstance().getTotalRunTime() * 40.); | 422 | sPainter.drawSprite2dMode(screenpos[0], screenpos[1], 25., StelApp::getInstance().getTotalRunTime() * 40.); |
1688 | 430 | } | 423 | } |
1689 | 431 | #endif //COMPATIBILITY_001002 | 424 | #endif //COMPATIBILITY_001002 |
1690 | 432 | 425 | ||
1691 | === modified file 'plugins/TextUserInterface/src/CMakeLists.txt' | |||
1692 | --- plugins/TextUserInterface/src/CMakeLists.txt 2015-10-20 17:16:34 +0000 | |||
1693 | +++ plugins/TextUserInterface/src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
1694 | @@ -29,12 +29,9 @@ | |||
1695 | 29 | TextUserInterface.cpp | 29 | TextUserInterface.cpp |
1696 | 30 | ) | 30 | ) |
1697 | 31 | 31 | ||
1698 | 32 | SET(extLinkerOption ${OPENGL_LIBRARIES}) | ||
1699 | 33 | |||
1700 | 34 | ADD_LIBRARY(TextUserInterface-static STATIC ${TextUserInterface_SRCS}) | 32 | ADD_LIBRARY(TextUserInterface-static STATIC ${TextUserInterface_SRCS}) |
1702 | 35 | QT5_USE_MODULES(TextUserInterface-static Core Widgets) | 33 | TARGET_LINK_LIBRARIES(TextUserInterface-static Qt5::Core Qt5::Widgets) |
1703 | 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. |
1704 | 37 | SET_TARGET_PROPERTIES(TextUserInterface-static PROPERTIES OUTPUT_NAME "TextUserInterface") | 35 | SET_TARGET_PROPERTIES(TextUserInterface-static PROPERTIES OUTPUT_NAME "TextUserInterface") |
1705 | 38 | TARGET_LINK_LIBRARIES(TextUserInterface-static ${extLinkerOption}) | ||
1706 | 39 | SET_TARGET_PROPERTIES(TextUserInterface-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") | 36 | SET_TARGET_PROPERTIES(TextUserInterface-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN") |
1707 | 40 | ADD_DEPENDENCIES(AllStaticPlugins TextUserInterface-static) | 37 | ADD_DEPENDENCIES(AllStaticPlugins TextUserInterface-static) |
1708 | 41 | 38 | ||
1709 | === modified file 'plugins/TextUserInterface/src/TextUserInterface.cpp' | |||
1710 | --- plugins/TextUserInterface/src/TextUserInterface.cpp 2017-01-10 15:51:22 +0000 | |||
1711 | +++ plugins/TextUserInterface/src/TextUserInterface.cpp 2017-01-12 21:08:38 +0000 | |||
1712 | @@ -61,9 +61,7 @@ | |||
1713 | 61 | #include <QTime> | 61 | #include <QTime> |
1714 | 62 | #include <QProcess> | 62 | #include <QProcess> |
1715 | 63 | #include <QDir> | 63 | #include <QDir> |
1719 | 64 | #ifdef DISABLE_SCRIPTING | 64 | #include <QSettings> |
1717 | 65 | #include "QSettings" // WTF? | ||
1718 | 66 | #endif | ||
1720 | 67 | 65 | ||
1721 | 68 | 66 | ||
1722 | 69 | /************************************************************************* | 67 | /************************************************************************* |
1723 | 70 | 68 | ||
1724 | === modified file 'src/CMakeLists.txt' | |||
1725 | --- src/CMakeLists.txt 2016-12-18 22:26:48 +0000 | |||
1726 | +++ src/CMakeLists.txt 2017-01-12 21:08:38 +0000 | |||
1727 | @@ -1,65 +1,9 @@ | |||
1786 | 1 | SET(glues_lib_SRCS | 1 | #add our external dependencies first |
1787 | 2 | core/external/glues_stel/source/glues_error.c | 2 | add_subdirectory(external) |
1730 | 3 | core/external/glues_stel/source/glues_error.h | ||
1731 | 4 | core/external/glues_stel/source/glues.h | ||
1732 | 5 | core/external/glues_stel/source/libtess/dict.h | ||
1733 | 6 | core/external/glues_stel/source/libtess/dict.c | ||
1734 | 7 | core/external/glues_stel/source/libtess/dict-list.h | ||
1735 | 8 | core/external/glues_stel/source/libtess/geom.c | ||
1736 | 9 | core/external/glues_stel/source/libtess/geom.h | ||
1737 | 10 | core/external/glues_stel/source/libtess/memalloc.c | ||
1738 | 11 | core/external/glues_stel/source/libtess/memalloc.h | ||
1739 | 12 | core/external/glues_stel/source/libtess/mesh.c | ||
1740 | 13 | core/external/glues_stel/source/libtess/mesh.h | ||
1741 | 14 | core/external/glues_stel/source/libtess/normal.c | ||
1742 | 15 | core/external/glues_stel/source/libtess/normal.h | ||
1743 | 16 | core/external/glues_stel/source/libtess/priorityq.c | ||
1744 | 17 | core/external/glues_stel/source/libtess/priorityq.h | ||
1745 | 18 | core/external/glues_stel/source/libtess/priorityq-heap.h | ||
1746 | 19 | core/external/glues_stel/source/libtess/priorityq-heap.i | ||
1747 | 20 | core/external/glues_stel/source/libtess/priorityq-sort.h | ||
1748 | 21 | core/external/glues_stel/source/libtess/render.c | ||
1749 | 22 | core/external/glues_stel/source/libtess/render.h | ||
1750 | 23 | core/external/glues_stel/source/libtess/sweep.c | ||
1751 | 24 | core/external/glues_stel/source/libtess/sweep.h | ||
1752 | 25 | core/external/glues_stel/source/libtess/tess.c | ||
1753 | 26 | core/external/glues_stel/source/libtess/tess.h | ||
1754 | 27 | core/external/glues_stel/source/libtess/tessmono.c | ||
1755 | 28 | core/external/glues_stel/source/libtess/tessmono.h | ||
1756 | 29 | ) | ||
1757 | 30 | |||
1758 | 31 | SET(zlib_SRCS | ||
1759 | 32 | core/external/zlib/adler32.c | ||
1760 | 33 | core/external/zlib/compress.c | ||
1761 | 34 | core/external/zlib/crc32.c | ||
1762 | 35 | core/external/zlib/crc32.h | ||
1763 | 36 | core/external/zlib/deflate.c | ||
1764 | 37 | core/external/zlib/deflate.h | ||
1765 | 38 | core/external/zlib/gzclose.c | ||
1766 | 39 | core/external/zlib/gzguts.h | ||
1767 | 40 | core/external/zlib/gzlib.c | ||
1768 | 41 | core/external/zlib/gzread.c | ||
1769 | 42 | core/external/zlib/gzwrite.c | ||
1770 | 43 | core/external/zlib/infback.c | ||
1771 | 44 | core/external/zlib/inffast.c | ||
1772 | 45 | core/external/zlib/inffast.h | ||
1773 | 46 | core/external/zlib/inffixed.h | ||
1774 | 47 | core/external/zlib/inflate.c | ||
1775 | 48 | core/external/zlib/inflate.h | ||
1776 | 49 | core/external/zlib/inftrees.c | ||
1777 | 50 | core/external/zlib/inftrees.h | ||
1778 | 51 | core/external/zlib/trees.c | ||
1779 | 52 | core/external/zlib/trees.h | ||
1780 | 53 | core/external/zlib/uncompr.c | ||
1781 | 54 | core/external/zlib/zconf.h | ||
1782 | 55 | core/external/zlib/zlib.h | ||
1783 | 56 | core/external/zlib/zutil.c | ||
1784 | 57 | core/external/zlib/zutil.h | ||
1785 | 58 | ) | ||
1788 | 59 | 3 | ||
1789 | 60 | IF(ENABLE_SPOUT) | 4 | IF(ENABLE_SPOUT) |
1790 | 61 | SET(spout_SRCS | 5 | SET(spout_SRCS |
1792 | 62 | core/external/SpoutLibrary.h | 6 | external/SpoutLibrary.h |
1793 | 63 | core/SpoutSender.hpp | 7 | core/SpoutSender.hpp |
1794 | 64 | core/SpoutSender.cpp | 8 | core/SpoutSender.cpp |
1795 | 65 | ) | 9 | ) |
1796 | @@ -171,10 +115,6 @@ | |||
1797 | 171 | core/StelPropertyMgr.hpp | 115 | core/StelPropertyMgr.hpp |
1798 | 172 | core/StelPropertyMgr.cpp | 116 | core/StelPropertyMgr.cpp |
1799 | 173 | 117 | ||
1800 | 174 | ${gl_lib_SRCS} | ||
1801 | 175 | |||
1802 | 176 | ${glues_lib_SRCS} | ||
1803 | 177 | |||
1804 | 178 | ${spout_SRCS} | 118 | ${spout_SRCS} |
1805 | 179 | 119 | ||
1806 | 180 | core/planetsephems/calc_interpolated_elements.c | 120 | core/planetsephems/calc_interpolated_elements.c |
1807 | @@ -295,14 +235,6 @@ | |||
1808 | 295 | ) | 235 | ) |
1809 | 296 | ENDIF() | 236 | ENDIF() |
1810 | 297 | 237 | ||
1811 | 298 | SET(stellarium_lib_SRCS ${stellarium_lib_SRCS} | ||
1812 | 299 | core/external/qtcompress/qzip.cpp | ||
1813 | 300 | core/external/qtcompress/qzipreader.h | ||
1814 | 301 | core/external/qtcompress/qzipwriter.h | ||
1815 | 302 | core/external/qcustomplot/qcustomplot.cpp | ||
1816 | 303 | core/external/qcustomplot/qcustomplot.h | ||
1817 | 304 | ) | ||
1818 | 305 | |||
1819 | 306 | IF(ENABLE_SCRIPTING) | 238 | IF(ENABLE_SCRIPTING) |
1820 | 307 | SET(stellarium_lib_SRCS ${stellarium_lib_SRCS} | 239 | SET(stellarium_lib_SRCS ${stellarium_lib_SRCS} |
1821 | 308 | scripting/StelScriptOutput.hpp | 240 | scripting/StelScriptOutput.hpp |
1822 | @@ -318,12 +250,6 @@ | |||
1823 | 318 | ) | 250 | ) |
1824 | 319 | ENDIF() | 251 | ENDIF() |
1825 | 320 | 252 | ||
1826 | 321 | IF(WIN32) | ||
1827 | 322 | SET(stellarium_lib_SRCS ${stellarium_lib_SRCS} | ||
1828 | 323 | ${zlib_SRCS} | ||
1829 | 324 | ) | ||
1830 | 325 | ENDIF() | ||
1831 | 326 | |||
1832 | 327 | SET(stellarium_exe_SRCS main.cpp) | 253 | SET(stellarium_exe_SRCS main.cpp) |
1833 | 328 | 254 | ||
1834 | 329 | ################# compiles resources files ############ | 255 | ################# compiles resources files ############ |
1835 | @@ -424,7 +350,6 @@ | |||
1836 | 424 | SET(stellarium_gui_RES ${CMAKE_SOURCE_DIR}/data/gui/guiRes.qrc) | 350 | SET(stellarium_gui_RES ${CMAKE_SOURCE_DIR}/data/gui/guiRes.qrc) |
1837 | 425 | QT5_ADD_RESOURCES(stellarium_gui_RES_CXX ${stellarium_gui_RES}) | 351 | QT5_ADD_RESOURCES(stellarium_gui_RES_CXX ${stellarium_gui_RES}) |
1838 | 426 | 352 | ||
1839 | 427 | SET(extLinkerOption ${extLinkerOption} ${QT_QTSCRIPT_LIBRARY} ${OPENGL_LIBRARIES}) | ||
1840 | 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}) |
1841 | 429 | ENDIF() | 354 | ENDIF() |
1842 | 430 | 355 | ||
1843 | @@ -467,15 +392,9 @@ | |||
1844 | 467 | ################################ Build main program ######################################### | 392 | ################################ Build main program ######################################### |
1845 | 468 | ############################################################################################# | 393 | ############################################################################################# |
1846 | 469 | 394 | ||
1847 | 470 | SET(extLinkerOption ${extLinkerOption} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES}) | ||
1848 | 471 | IF(ENABLE_MEDIA) | ||
1849 | 472 | # Forced linkage to Qt5MultimediaWidgets library when media support is enabled | ||
1850 | 473 | SET(extLinkerOption ${extLinkerOption} ${Qt5MultimediaWidgets_LIBRARIES}) | ||
1851 | 474 | ENDIF() | ||
1852 | 475 | IF(WIN32 AND NOT MSVC) | 395 | IF(WIN32 AND NOT MSVC) |
1856 | 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 |
1857 | 477 | # Because including it here seems to duplicate STELLARIUM_STATIC_PLUGINS_LIBRARIES | 397 | SET(winMMLib libwinmm.a) |
1855 | 478 | SET(extLinkerOption ${extLinkerOption} libwinmm.a -lws2_32) | ||
1858 | 479 | ENDIF() | 398 | ENDIF() |
1859 | 480 | 399 | ||
1860 | 481 | IF(WIN32 AND ENABLE_WINDOWS_EXE_ICON) | 400 | IF(WIN32 AND ENABLE_WINDOWS_EXE_ICON) |
1861 | @@ -491,51 +410,37 @@ | |||
1862 | 491 | ENDIF() | 410 | ENDIF() |
1863 | 492 | ENDIF() | 411 | ENDIF() |
1864 | 493 | 412 | ||
1865 | 413 | # Setup Qt5 dependencies | ||
1866 | 414 | SET(STELLARIUM_QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Gui ${STEL_GLES_LIBS} Qt5::Network Qt5::Widgets) | ||
1867 | 415 | IF(ENABLE_MEDIA) | ||
1868 | 416 | SET(STELLARIUM_QT_LIBRARIES ${STELLARIUM_QT_LIBRARIES} Qt5::Multimedia Qt5::MultimediaWidgets) | ||
1869 | 417 | ENDIF() | ||
1870 | 418 | IF(ENABLE_SCRIPTING) | ||
1871 | 419 | SET(STELLARIUM_QT_LIBRARIES ${STELLARIUM_QT_LIBRARIES} Qt5::Script) | ||
1872 | 420 | ENDIF() | ||
1873 | 421 | if(USE_OLD_QGLWIDGET) | ||
1874 | 422 | # The Qt5OpenGL library is only required when using the legacy viewport | ||
1875 | 423 | SET(STELLARIUM_QT_LIBRARIES ${STELLARIUM_QT_LIBRARIES} Qt5::OpenGL) | ||
1876 | 424 | endif() | ||
1877 | 425 | |||
1878 | 494 | if(ENABLE_SPOUT AND SPOUT_LIBRARY_DLL) | 426 | if(ENABLE_SPOUT AND SPOUT_LIBRARY_DLL) |
1879 | 495 | # automatically copy the spout .dll to the binary directory, if possible | 427 | # automatically copy the spout .dll to the binary directory, if possible |
1880 | 496 | configure_file(${SPOUT_LIBRARY_DLL} ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) | 428 | configure_file(${SPOUT_LIBRARY_DLL} ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) |
1881 | 497 | endif() | 429 | endif() |
1882 | 498 | 430 | ||
1883 | 431 | set(STELMAIN_DEPS ${ZLIB_LIBRARIES} qtcompress_stel glues_stel qcustomplot_stel ${STELLARIUM_STATIC_PLUGINS_LIBRARIES} ${STELLARIUM_QT_LIBRARIES} ${SPOUT_LIBRARY}) | ||
1884 | 432 | |||
1885 | 433 | # Main executable/library setup | ||
1886 | 499 | IF(GENERATE_STELMAINLIB) | 434 | IF(GENERATE_STELMAINLIB) |
1887 | 500 | ADD_LIBRARY(stelMain SHARED ${stellarium_lib_SRCS} ${stellarium_RES_CXX}) | 435 | ADD_LIBRARY(stelMain SHARED ${stellarium_lib_SRCS} ${stellarium_RES_CXX}) |
1903 | 501 | TARGET_LINK_LIBRARIES(stelMain ${extLinkerOption} ${STELLARIUM_STATIC_PLUGINS_LIBRARIES}) | 436 | TARGET_LINK_LIBRARIES(stelMain ${STELMAIN_DEPS}) |
1889 | 502 | QT5_USE_MODULES(stelMain Core Concurrent Gui Network OpenGL Widgets PrintSupport) | ||
1890 | 503 | IF(ENABLE_MEDIA) | ||
1891 | 504 | QT5_USE_MODULES(stelMain Multimedia MultimediaWidgets) | ||
1892 | 505 | ENDIF() | ||
1893 | 506 | IF(ENABLE_SCRIPTING) | ||
1894 | 507 | QT5_USE_MODULES(stelMain Script) | ||
1895 | 508 | ENDIF() | ||
1896 | 509 | IF(USE_PLUGIN_TELESCOPECONTROL) | ||
1897 | 510 | QT5_USE_MODULES(stelMain SerialPort) | ||
1898 | 511 | ENDIF() | ||
1899 | 512 | IF(ENABLE_SPOUT) | ||
1900 | 513 | TARGET_LINK_LIBRARIES(stelMain ${SPOUT_LIBRARY}) | ||
1901 | 514 | ENDIF(ENABLE_SPOUT) | ||
1902 | 515 | |||
1904 | 516 | INSTALL(TARGETS stelMain DESTINATION lib) | 437 | INSTALL(TARGETS stelMain DESTINATION lib) |
1905 | 517 | ADD_EXECUTABLE(stellarium ${stellarium_exe_SRCS}) | 438 | ADD_EXECUTABLE(stellarium ${stellarium_exe_SRCS}) |
1906 | 518 | #stelMain should be after the plug-ins, otherwise the build crashes | 439 | #stelMain should be after the plug-ins, otherwise the build crashes |
1908 | 519 | TARGET_LINK_LIBRARIES(stellarium ${STELLARIUM_STATIC_PLUGINS_LIBRARIES} stelMain ${extLinkerOption}) | 440 | TARGET_LINK_LIBRARIES(stellarium stelMain ${winMMLib}) |
1909 | 520 | ELSE() | 441 | ELSE() |
1910 | 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}) |
1928 | 522 | TARGET_LINK_LIBRARIES(stellarium ${extLinkerOption} ${STELLARIUM_STATIC_PLUGINS_LIBRARIES}) | 443 | TARGET_LINK_LIBRARIES(stellarium ${winMMLib} ${STELMAIN_DEPS}) |
1912 | 523 | # This will add the ANGLE lib if the Qt version supports it. | ||
1913 | 524 | TARGET_LINK_LIBRARIES(stellarium ${Qt5Gui_LIBRARIES} ${Qt5Gui_OPENGL_LIBRARIES}) | ||
1914 | 525 | |||
1915 | 526 | QT5_USE_MODULES(stellarium Core Concurrent Gui Network OpenGL Widgets PrintSupport) | ||
1916 | 527 | IF(ENABLE_MEDIA) | ||
1917 | 528 | QT5_USE_MODULES(stellarium Multimedia MultimediaWidgets) | ||
1918 | 529 | ENDIF() | ||
1919 | 530 | IF(ENABLE_SCRIPTING) | ||
1920 | 531 | QT5_USE_MODULES(stellarium Script) | ||
1921 | 532 | ENDIF() | ||
1922 | 533 | IF(USE_PLUGIN_TELESCOPECONTROL) | ||
1923 | 534 | QT5_USE_MODULES(stellarium SerialPort) | ||
1924 | 535 | ENDIF() | ||
1925 | 536 | IF(ENABLE_SPOUT) | ||
1926 | 537 | TARGET_LINK_LIBRARIES(stellarium ${SPOUT_LIBRARY}) | ||
1927 | 538 | ENDIF(ENABLE_SPOUT) | ||
1929 | 539 | 444 | ||
1930 | 540 | IF(APPLE) | 445 | IF(APPLE) |
1931 | 541 | SET_TARGET_PROPERTIES(stellarium PROPERTIES LINK_FLAGS " -framework Cocoa -framework OpenGL") | 446 | SET_TARGET_PROPERTIES(stellarium PROPERTIES LINK_FLAGS " -framework Cocoa -framework OpenGL") |
1932 | @@ -566,7 +471,7 @@ | |||
1933 | 566 | SET(STELLARIUM_TESTS ${STELLARIUM_TESTS} ${NAME}) | 471 | SET(STELLARIUM_TESTS ${STELLARIUM_TESTS} ${NAME}) |
1934 | 567 | ENDMACRO() | 472 | ENDMACRO() |
1935 | 568 | 473 | ||
1937 | 569 | SET(extLinkerOptionTest ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES}) | 474 | SET(TESTS_LIBRARIES ${ZLIB_LIBRARIES} Qt5::Core Qt5::Gui Qt5::Test) |
1938 | 570 | 475 | ||
1939 | 571 | # Custom target used to build all tests at once | 476 | # Custom target used to build all tests at once |
1940 | 572 | ADD_CUSTOM_TARGET(buildTests) | 477 | ADD_CUSTOM_TARGET(buildTests) |
1941 | @@ -577,13 +482,8 @@ | |||
1942 | 577 | core/StelUtils.hpp | 482 | core/StelUtils.hpp |
1943 | 578 | core/StelUtils.cpp | 483 | core/StelUtils.cpp |
1944 | 579 | ) | 484 | ) |
1945 | 580 | IF(WIN32) | ||
1946 | 581 | # StelUtils required zlib sources | ||
1947 | 582 | SET(tests_testDates_SRCS ${tests_testDates_SRCS} ${zlib_SRCS}) | ||
1948 | 583 | ENDIF() | ||
1949 | 584 | ADD_EXECUTABLE(testDates EXCLUDE_FROM_ALL ${tests_testDates_SRCS}) | 485 | ADD_EXECUTABLE(testDates EXCLUDE_FROM_ALL ${tests_testDates_SRCS}) |
1952 | 585 | QT5_USE_MODULES(testDates Core Test) | 486 | TARGET_LINK_LIBRARIES(testDates ${TESTS_LIBRARIES}) |
1951 | 586 | TARGET_LINK_LIBRARIES(testDates ${extLinkerOptionTest}) | ||
1953 | 587 | ADD_DEPENDENCIES(buildTests testDates) | 487 | ADD_DEPENDENCIES(buildTests testDates) |
1954 | 588 | ADD_TEST(testDates) | 488 | ADD_TEST(testDates) |
1955 | 589 | 489 | ||
1956 | @@ -594,8 +494,7 @@ | |||
1957 | 594 | core/StelFileMgr.cpp | 494 | core/StelFileMgr.cpp |
1958 | 595 | ) | 495 | ) |
1959 | 596 | ADD_EXECUTABLE(testStelFileMgr EXCLUDE_FROM_ALL ${tests_testStelFileMgr_SRCS}) | 496 | ADD_EXECUTABLE(testStelFileMgr EXCLUDE_FROM_ALL ${tests_testStelFileMgr_SRCS}) |
1962 | 597 | QT5_USE_MODULES(testStelFileMgr Core Test) | 497 | TARGET_LINK_LIBRARIES(testStelFileMgr ${TESTS_LIBRARIES}) |
1961 | 598 | TARGET_LINK_LIBRARIES(testStelFileMgr ${extLinkerOptionTest}) | ||
1963 | 599 | ADD_DEPENDENCIES(buildTests testStelFileMgr) | 498 | ADD_DEPENDENCIES(buildTests testStelFileMgr) |
1964 | 600 | ADD_TEST(testStelFileMgr) | 499 | ADD_TEST(testStelFileMgr) |
1965 | 601 | 500 | ||
1966 | @@ -618,50 +517,35 @@ | |||
1967 | 618 | core/StelFileMgr.cpp | 517 | core/StelFileMgr.cpp |
1968 | 619 | core/StelTranslator.hpp | 518 | core/StelTranslator.hpp |
1969 | 620 | core/StelTranslator.cpp | 519 | core/StelTranslator.cpp |
1970 | 621 | ${glues_lib_SRCS} | ||
1971 | 622 | ) | 520 | ) |
1972 | 623 | IF(WIN32) | ||
1973 | 624 | # StelUtils required zlib sources | ||
1974 | 625 | SET(tests_testStelSphereGeometry_SRCS ${tests_testStelSphereGeometry_SRCS} ${zlib_SRCS}) | ||
1975 | 626 | ENDIF() | ||
1976 | 627 | ADD_EXECUTABLE(testStelSphereGeometry EXCLUDE_FROM_ALL ${tests_testStelSphereGeometry_SRCS}) | 521 | ADD_EXECUTABLE(testStelSphereGeometry EXCLUDE_FROM_ALL ${tests_testStelSphereGeometry_SRCS}) |
1979 | 628 | QT5_USE_MODULES(testStelSphereGeometry Core OpenGL Test) | 522 | TARGET_LINK_LIBRARIES(testStelSphereGeometry ${TESTS_LIBRARIES} glues_stel) |
1978 | 629 | TARGET_LINK_LIBRARIES(testStelSphereGeometry ${extLinkerOptionTest}) | ||
1980 | 630 | ADD_DEPENDENCIES(buildTests testStelSphereGeometry) | 523 | ADD_DEPENDENCIES(buildTests testStelSphereGeometry) |
1981 | 631 | ADD_TEST(testStelSphereGeometry) | 524 | ADD_TEST(testStelSphereGeometry) |
1982 | 632 | 525 | ||
2015 | 633 | SET(tests_testStelSphericalIndex_SRCS | 526 | #SET(tests_testStelSphericalIndex_SRCS |
2016 | 634 | tests/testStelSphericalIndex.hpp | 527 | # tests/testStelSphericalIndex.hpp |
2017 | 635 | tests/testStelSphericalIndex.cpp | 528 | # tests/testStelSphericalIndex.cpp |
2018 | 636 | core/StelSphericalIndex.hpp | 529 | # core/StelSphericalIndex.hpp |
2019 | 637 | core/StelSphericalIndex.cpp | 530 | # core/StelSphericalIndex.cpp |
2020 | 638 | core/StelSphereGeometry.hpp | 531 | # core/StelSphereGeometry.hpp |
2021 | 639 | core/StelSphereGeometry.cpp | 532 | # core/StelSphereGeometry.cpp |
2022 | 640 | core/StelVertexArray.hpp | 533 | # core/StelVertexArray.hpp |
2023 | 641 | core/StelVertexArray.cpp | 534 | # core/StelVertexArray.cpp |
2024 | 642 | core/OctahedronPolygon.hpp | 535 | # core/OctahedronPolygon.hpp |
2025 | 643 | core/OctahedronPolygon.cpp | 536 | # core/OctahedronPolygon.cpp |
2026 | 644 | core/StelJsonParser.hpp | 537 | # core/StelJsonParser.hpp |
2027 | 645 | core/StelJsonParser.cpp | 538 | # core/StelJsonParser.cpp |
2028 | 646 | core/StelUtils.cpp | 539 | # core/StelUtils.cpp |
2029 | 647 | core/StelUtils.hpp | 540 | # core/StelUtils.hpp |
2030 | 648 | core/StelProjector.cpp | 541 | # core/StelProjector.cpp |
2031 | 649 | core/StelProjector.hpp | 542 | # core/StelProjector.hpp |
2032 | 650 | core/StelTranslator.cpp | 543 | # core/StelTranslator.cpp |
2033 | 651 | core/StelTranslator.hpp | 544 | # core/StelTranslator.hpp |
2034 | 652 | core/StelFileMgr.cpp | 545 | # ${glues_lib_SRCS}) |
2035 | 653 | core/StelFileMgr.hpp | 546 | #ADD_EXECUTABLE(testStelSphericalIndex EXCLUDE_FROM_ALL ${tests_testStelSphericalIndex_SRCS}) |
2036 | 654 | ${glues_lib_SRCS} | 547 | #TARGET_LINK_LIBRARIES(testStelSphericalIndex ${TESTS_LIBRARIES}) |
2037 | 655 | ) | 548 | #ADD_DEPENDENCIES(buildTests testStelSphericalIndex) |
2006 | 656 | IF(WIN32) | ||
2007 | 657 | # StelUtils required zlib sources | ||
2008 | 658 | SET(tests_testStelSphericalIndex_SRCS ${tests_testStelSphericalIndex_SRCS} ${zlib_SRCS}) | ||
2009 | 659 | ENDIF() | ||
2010 | 660 | ADD_EXECUTABLE(testStelSphericalIndex EXCLUDE_FROM_ALL ${tests_testStelSphericalIndex_SRCS}) | ||
2011 | 661 | QT5_USE_MODULES(testStelSphericalIndex Core OpenGL Test) | ||
2012 | 662 | TARGET_LINK_LIBRARIES(testStelSphericalIndex ${extLinkerOptionTest}) | ||
2013 | 663 | ADD_DEPENDENCIES(buildTests testStelSphericalIndex) | ||
2014 | 664 | ADD_TEST(testStelSphericalIndex) | ||
2038 | 665 | 549 | ||
2039 | 666 | SET(tests_testStelJsonParser_SRCS | 550 | SET(tests_testStelJsonParser_SRCS |
2040 | 667 | tests/testStelJsonParser.hpp | 551 | tests/testStelJsonParser.hpp |
2041 | @@ -670,8 +554,7 @@ | |||
2042 | 670 | core/StelJsonParser.cpp | 554 | core/StelJsonParser.cpp |
2043 | 671 | ) | 555 | ) |
2044 | 672 | ADD_EXECUTABLE(testStelJsonParser EXCLUDE_FROM_ALL ${tests_testStelJsonParser_SRCS}) | 556 | ADD_EXECUTABLE(testStelJsonParser EXCLUDE_FROM_ALL ${tests_testStelJsonParser_SRCS}) |
2047 | 673 | QT5_USE_MODULES(testStelJsonParser Core Test) | 557 | TARGET_LINK_LIBRARIES(testStelJsonParser ${TESTS_LIBRARIES}) |
2046 | 674 | TARGET_LINK_LIBRARIES(testStelJsonParser ${extLinkerOptionTest}) | ||
2048 | 675 | ADD_DEPENDENCIES(buildTests testStelJsonParser) | 558 | ADD_DEPENDENCIES(buildTests testStelJsonParser) |
2049 | 676 | ADD_TEST(testStelJsonParser) | 559 | ADD_TEST(testStelJsonParser) |
2050 | 677 | 560 | ||
2051 | @@ -681,8 +564,7 @@ | |||
2052 | 681 | core/StelVertexArray.hpp | 564 | core/StelVertexArray.hpp |
2053 | 682 | ) | 565 | ) |
2054 | 683 | ADD_EXECUTABLE(testStelVertexArray EXCLUDE_FROM_ALL ${tests_testStelVertexArray_SRCS}) | 566 | ADD_EXECUTABLE(testStelVertexArray EXCLUDE_FROM_ALL ${tests_testStelVertexArray_SRCS}) |
2057 | 684 | QT5_USE_MODULES(testStelVertexArray Core Test OpenGL) | 567 | TARGET_LINK_LIBRARIES(testStelVertexArray ${TESTS_LIBRARIES}) |
2056 | 685 | TARGET_LINK_LIBRARIES(testStelVertexArray ${extLinkerOptionTest}) | ||
2058 | 686 | ADD_DEPENDENCIES(buildTests testStelVertexArray) | 568 | ADD_DEPENDENCIES(buildTests testStelVertexArray) |
2059 | 687 | ADD_TEST(testStelVertexArray) | 569 | ADD_TEST(testStelVertexArray) |
2060 | 688 | 570 | ||
2061 | @@ -692,13 +574,8 @@ | |||
2062 | 692 | core/StelUtils.hpp | 574 | core/StelUtils.hpp |
2063 | 693 | core/StelUtils.cpp | 575 | core/StelUtils.cpp |
2064 | 694 | ) | 576 | ) |
2065 | 695 | IF(WIN32) | ||
2066 | 696 | # StelUtils required zlib sources | ||
2067 | 697 | SET(tests_testDeltaT_SRCS ${tests_testDeltaT_SRCS} ${zlib_SRCS}) | ||
2068 | 698 | ENDIF() | ||
2069 | 699 | ADD_EXECUTABLE(testDeltaT EXCLUDE_FROM_ALL ${tests_testDeltaT_SRCS}) | 577 | ADD_EXECUTABLE(testDeltaT EXCLUDE_FROM_ALL ${tests_testDeltaT_SRCS}) |
2072 | 700 | QT5_USE_MODULES(testDeltaT Core Test) | 578 | TARGET_LINK_LIBRARIES(testDeltaT ${TESTS_LIBRARIES}) |
2071 | 701 | TARGET_LINK_LIBRARIES(testDeltaT ${extLinkerOptionTest}) | ||
2073 | 702 | ADD_DEPENDENCIES(buildTests testDeltaT) | 579 | ADD_DEPENDENCIES(buildTests testDeltaT) |
2074 | 703 | ADD_TEST(testDeltaT) | 580 | ADD_TEST(testDeltaT) |
2075 | 704 | 581 | ||
2076 | @@ -708,13 +585,8 @@ | |||
2077 | 708 | core/StelUtils.hpp | 585 | core/StelUtils.hpp |
2078 | 709 | core/StelUtils.cpp | 586 | core/StelUtils.cpp |
2079 | 710 | ) | 587 | ) |
2080 | 711 | IF(WIN32) | ||
2081 | 712 | # StelUtils required zlib sources | ||
2082 | 713 | SET(tests_testConversions_SRCS ${tests_testConversions_SRCS} ${zlib_SRCS}) | ||
2083 | 714 | ENDIF() | ||
2084 | 715 | ADD_EXECUTABLE(testConversions EXCLUDE_FROM_ALL ${tests_testConversions_SRCS}) | 588 | ADD_EXECUTABLE(testConversions EXCLUDE_FROM_ALL ${tests_testConversions_SRCS}) |
2087 | 716 | QT5_USE_MODULES(testConversions Core Test) | 589 | TARGET_LINK_LIBRARIES(testConversions ${TESTS_LIBRARIES}) |
2086 | 717 | TARGET_LINK_LIBRARIES(testConversions ${extLinkerOptionTest}) | ||
2088 | 718 | ADD_DEPENDENCIES(buildTests testConversions) | 590 | ADD_DEPENDENCIES(buildTests testConversions) |
2089 | 719 | ADD_TEST(testConversions) | 591 | ADD_TEST(testConversions) |
2090 | 720 | 592 | ||
2091 | @@ -725,8 +597,7 @@ | |||
2092 | 725 | core/RefractionExtinction.cpp | 597 | core/RefractionExtinction.cpp |
2093 | 726 | ) | 598 | ) |
2094 | 727 | ADD_EXECUTABLE(testExtinction EXCLUDE_FROM_ALL ${tests_testExtinction_SRCS}) | 599 | ADD_EXECUTABLE(testExtinction EXCLUDE_FROM_ALL ${tests_testExtinction_SRCS}) |
2097 | 728 | QT5_USE_MODULES(testExtinction Core Test) | 600 | TARGET_LINK_LIBRARIES(testExtinction ${TESTS_LIBRARIES}) |
2096 | 729 | TARGET_LINK_LIBRARIES(testExtinction ${extLinkerOptionTest}) | ||
2098 | 730 | ADD_DEPENDENCIES(buildTests testExtinction) | 601 | ADD_DEPENDENCIES(buildTests testExtinction) |
2099 | 731 | ADD_TEST(testExtinction) | 602 | ADD_TEST(testExtinction) |
2100 | 732 | 603 | ||
2101 | @@ -738,13 +609,8 @@ | |||
2102 | 738 | core/StelUtils.hpp | 609 | core/StelUtils.hpp |
2103 | 739 | core/StelUtils.cpp | 610 | core/StelUtils.cpp |
2104 | 740 | ) | 611 | ) |
2105 | 741 | IF(WIN32) | ||
2106 | 742 | # StelUtils required zlib sources | ||
2107 | 743 | SET(tests_testRefraction_SRCS ${tests_testRefraction_SRCS} ${zlib_SRCS}) | ||
2108 | 744 | ENDIF() | ||
2109 | 745 | ADD_EXECUTABLE(testRefraction EXCLUDE_FROM_ALL ${tests_testRefraction_SRCS}) | 612 | ADD_EXECUTABLE(testRefraction EXCLUDE_FROM_ALL ${tests_testRefraction_SRCS}) |
2112 | 746 | QT5_USE_MODULES(testRefraction Core Test) | 613 | TARGET_LINK_LIBRARIES(testRefraction ${TESTS_LIBRARIES}) |
2111 | 747 | TARGET_LINK_LIBRARIES(testRefraction ${extLinkerOptionTest}) | ||
2113 | 748 | ADD_DEPENDENCIES(buildTests testRefraction) | 614 | ADD_DEPENDENCIES(buildTests testRefraction) |
2114 | 749 | ADD_TEST(testRefraction) | 615 | ADD_TEST(testRefraction) |
2115 | 750 | 616 | ||
2116 | @@ -756,13 +622,8 @@ | |||
2117 | 756 | core/StelUtils.hpp | 622 | core/StelUtils.hpp |
2118 | 757 | core/StelUtils.cpp | 623 | core/StelUtils.cpp |
2119 | 758 | ) | 624 | ) |
2120 | 759 | IF(WIN32) | ||
2121 | 760 | # StelUtils required zlib sources | ||
2122 | 761 | SET(tests_testPrecession_SRCS ${tests_testPrecession_SRCS} ${zlib_SRCS}) | ||
2123 | 762 | ENDIF() | ||
2124 | 763 | ADD_EXECUTABLE(testPrecession EXCLUDE_FROM_ALL ${tests_testPrecession_SRCS}) | 625 | ADD_EXECUTABLE(testPrecession EXCLUDE_FROM_ALL ${tests_testPrecession_SRCS}) |
2127 | 764 | QT5_USE_MODULES(testPrecession Core Test) | 626 | TARGET_LINK_LIBRARIES(testPrecession ${TESTS_LIBRARIES}) |
2126 | 765 | TARGET_LINK_LIBRARIES(testPrecession ${extLinkerOptionTest}) | ||
2128 | 766 | ADD_DEPENDENCIES(buildTests testPrecession) | 627 | ADD_DEPENDENCIES(buildTests testPrecession) |
2129 | 767 | ADD_TEST(testPrecession) | 628 | ADD_TEST(testPrecession) |
2130 | 768 | 629 | ||
2131 | @@ -788,8 +649,7 @@ | |||
2132 | 788 | core/planetsephems/jpleph.cpp | 649 | core/planetsephems/jpleph.cpp |
2133 | 789 | ) | 650 | ) |
2134 | 790 | ADD_EXECUTABLE(testEphemeris EXCLUDE_FROM_ALL ${tests_testEphemeris_SRCS}) | 651 | ADD_EXECUTABLE(testEphemeris EXCLUDE_FROM_ALL ${tests_testEphemeris_SRCS}) |
2137 | 791 | QT5_USE_MODULES(testEphemeris Core Test) | 652 | TARGET_LINK_LIBRARIES(testEphemeris ${TESTS_LIBRARIES}) |
2136 | 792 | TARGET_LINK_LIBRARIES(testEphemeris ${extLinkerOptionTest}) | ||
2138 | 793 | TARGET_COMPILE_DEFINITIONS(testEphemeris PRIVATE UNIT_TEST) | 653 | TARGET_COMPILE_DEFINITIONS(testEphemeris PRIVATE UNIT_TEST) |
2139 | 794 | ADD_DEPENDENCIES(buildTests testEphemeris) | 654 | ADD_DEPENDENCIES(buildTests testEphemeris) |
2140 | 795 | ADD_TEST(testEphemeris) | 655 | ADD_TEST(testEphemeris) |
2141 | 796 | 656 | ||
2142 | === modified file 'src/StelLogger.cpp' | |||
2143 | --- src/StelLogger.cpp 2016-07-05 15:30:52 +0000 | |||
2144 | +++ src/StelLogger.cpp 2017-01-12 21:08:38 +0000 | |||
2145 | @@ -254,6 +254,8 @@ | |||
2146 | 254 | 254 | ||
2147 | 255 | void StelLogger::debugLogHandler(QtMsgType type, const QMessageLogContext& ctx, const QString& msg) | 255 | void StelLogger::debugLogHandler(QtMsgType type, const QMessageLogContext& ctx, const QString& msg) |
2148 | 256 | { | 256 | { |
2149 | 257 | // *** NOTE: see original Qt source in qlogging.cpp (qDefaultMessageHandler) for sensible default code | ||
2150 | 258 | |||
2151 | 257 | #if (QT_VERSION>=QT_VERSION_CHECK(5,4,0)) | 259 | #if (QT_VERSION>=QT_VERSION_CHECK(5,4,0)) |
2152 | 258 | //use Qt to format the log message, if possible | 260 | //use Qt to format the log message, if possible |
2153 | 259 | //this uses the format set by qSetMessagePattern | 261 | //this uses the format set by qSetMessagePattern |
2154 | @@ -268,24 +270,30 @@ | |||
2155 | 268 | if(fmt.isNull()) | 270 | if(fmt.isNull()) |
2156 | 269 | return; | 271 | return; |
2157 | 270 | 272 | ||
2158 | 273 | //always append newline | ||
2159 | 274 | fmt.append(QLatin1Char('\n')); | ||
2160 | 275 | |||
2161 | 271 | #ifdef Q_OS_WIN | 276 | #ifdef Q_OS_WIN |
2162 | 272 | //Send debug messages to Debugger, if one is attached, instead of stderr | 277 | //Send debug messages to Debugger, if one is attached, instead of stderr |
2163 | 273 | //This seems to avoid output delays in Qt Creator, allowing for easier debugging | 278 | //This seems to avoid output delays in Qt Creator, allowing for easier debugging |
2164 | 274 | //Seems to work fine with MSVC and MinGW | 279 | //Seems to work fine with MSVC and MinGW |
2167 | 275 | if(IsDebuggerPresent()) | 280 | if (IsDebuggerPresent()) |
2168 | 276 | OutputDebugStringW(reinterpret_cast<LPCWSTR>(fmt.utf16())); | 281 | { |
2169 | 282 | OutputDebugStringW(reinterpret_cast<const wchar_t *>(fmt.utf16())); | ||
2170 | 283 | } | ||
2171 | 277 | else | 284 | else |
2172 | 278 | #endif | 285 | #endif |
2176 | 279 | //this does the same as the default handler in qlogging.cpp | 286 | { |
2177 | 280 | fprintf(stderr, "%s\n", qPrintable(fmt)); | 287 | //this does the same as the default handler in qlogging.cpp |
2178 | 281 | fflush(stderr); | 288 | fprintf(stderr, "%s", qPrintable(fmt)); |
2179 | 289 | fflush(stderr); | ||
2180 | 290 | } | ||
2181 | 282 | writeLog(fmt); | 291 | writeLog(fmt); |
2182 | 283 | } | 292 | } |
2183 | 284 | 293 | ||
2184 | 285 | void StelLogger::writeLog(QString msg) | 294 | void StelLogger::writeLog(QString msg) |
2185 | 286 | { | 295 | { |
2186 | 287 | fileMutex.lock(); | 296 | fileMutex.lock(); |
2187 | 288 | msg += "\n"; | ||
2188 | 289 | logFile.write(qPrintable(msg), msg.size()); | 297 | logFile.write(qPrintable(msg), msg.size()); |
2189 | 290 | log += msg; | 298 | log += msg; |
2190 | 291 | fileMutex.unlock(); | 299 | fileMutex.unlock(); |
2191 | 292 | 300 | ||
2192 | === modified file 'src/StelMainView.cpp' | |||
2193 | --- src/StelMainView.cpp 2016-12-11 22:57:16 +0000 | |||
2194 | +++ src/StelMainView.cpp 2017-01-12 21:08:38 +0000 | |||
2195 | @@ -32,10 +32,10 @@ | |||
2196 | 32 | 32 | ||
2197 | 33 | #include <QDebug> | 33 | #include <QDebug> |
2198 | 34 | #include <QDir> | 34 | #include <QDir> |
2200 | 35 | #if STEL_USE_NEW_OPENGL_WIDGETS | 35 | #ifdef USE_OLD_QGLWIDGET |
2201 | 36 | #include <QGLWidget> | ||
2202 | 37 | #else | ||
2203 | 36 | #include <QOpenGLWidget> | 38 | #include <QOpenGLWidget> |
2204 | 37 | #else | ||
2205 | 38 | #include <QGLWidget> | ||
2206 | 39 | #endif | 39 | #endif |
2207 | 40 | #include <QApplication> | 40 | #include <QApplication> |
2208 | 41 | #include <QDesktopWidget> | 41 | #include <QDesktopWidget> |
2209 | @@ -61,24 +61,199 @@ | |||
2210 | 61 | #endif | 61 | #endif |
2211 | 62 | #include <QOpenGLShader> | 62 | #include <QOpenGLShader> |
2212 | 63 | #include <QOpenGLShaderProgram> | 63 | #include <QOpenGLShaderProgram> |
2215 | 64 | #include <QGLFramebufferObject> | 64 | #include <QOpenGLFramebufferObject> |
2216 | 65 | #include <QGLShaderProgram> | 65 | #include <QOpenGLPaintDevice> |
2217 | 66 | #ifdef OPENGL_DEBUG_LOGGING | ||
2218 | 67 | #include <QOpenGLDebugLogger> | ||
2219 | 68 | #endif | ||
2220 | 66 | 69 | ||
2221 | 67 | #include <clocale> | 70 | #include <clocale> |
2222 | 68 | 71 | ||
2223 | 69 | // Initialize static variables | 72 | // Initialize static variables |
2224 | 70 | StelMainView* StelMainView::singleton = NULL; | 73 | StelMainView* StelMainView::singleton = NULL; |
2225 | 71 | 74 | ||
2226 | 75 | #ifdef USE_OLD_QGLWIDGET | ||
2227 | 76 | class StelGLWidget : public QGLWidget | ||
2228 | 77 | #else | ||
2229 | 78 | class StelGLWidget : public QOpenGLWidget | ||
2230 | 79 | #endif | ||
2231 | 80 | { | ||
2232 | 81 | public: | ||
2233 | 82 | StelGLWidget(StelMainView* parent) | ||
2234 | 83 | : | ||
2235 | 84 | #ifdef USE_OLD_QGLWIDGET | ||
2236 | 85 | QGLWidget(parent), | ||
2237 | 86 | #else | ||
2238 | 87 | QOpenGLWidget(parent), | ||
2239 | 88 | #endif | ||
2240 | 89 | parent(parent), | ||
2241 | 90 | initialized(false) | ||
2242 | 91 | { | ||
2243 | 92 | qDebug()<<"StelGLWidget constructor"; | ||
2244 | 93 | |||
2245 | 94 | //because we always draw the full background, | ||
2246 | 95 | //lets skip drawing the system background | ||
2247 | 96 | setAttribute(Qt::WA_OpaquePaintEvent); | ||
2248 | 97 | setAutoFillBackground(false); | ||
2249 | 98 | } | ||
2250 | 99 | |||
2251 | 100 | ~StelGLWidget() | ||
2252 | 101 | { | ||
2253 | 102 | qDebug()<<"StelGLWidget destroyed"; | ||
2254 | 103 | } | ||
2255 | 104 | |||
2256 | 105 | virtual void initializeGL() Q_DECL_OVERRIDE | ||
2257 | 106 | { | ||
2258 | 107 | if(initialized) | ||
2259 | 108 | { | ||
2260 | 109 | qWarning()<<"Double initialization, should not happen"; | ||
2261 | 110 | Q_ASSERT(false); | ||
2262 | 111 | return; | ||
2263 | 112 | } | ||
2264 | 113 | |||
2265 | 114 | //This seems to be the correct place to initialize all | ||
2266 | 115 | //GL related stuff of the application | ||
2267 | 116 | //this includes all the init() calls of the modules | ||
2268 | 117 | |||
2269 | 118 | #ifdef USE_OLD_QGLWIDGET | ||
2270 | 119 | QOpenGLContext* ctx = context()->contextHandle(); | ||
2271 | 120 | #else | ||
2272 | 121 | QOpenGLContext* ctx = context(); | ||
2273 | 122 | #endif | ||
2274 | 123 | Q_ASSERT(ctx == QOpenGLContext::currentContext()); | ||
2275 | 124 | StelOpenGL::mainContext = ctx; //throw an error when StelOpenGL functions are executed in another context | ||
2276 | 125 | |||
2277 | 126 | qDebug()<<"initializeGL"; | ||
2278 | 127 | qDebug() << "OpenGL supported version: " << QString((char*)ctx->functions()->glGetString(GL_VERSION)); | ||
2279 | 128 | qDebug() << "Current Format: " << this->format(); | ||
2280 | 129 | |||
2281 | 130 | if (qApp->property("onetime_compat33")==true) | ||
2282 | 131 | { | ||
2283 | 132 | // This may not return the version number set previously! | ||
2284 | 133 | qDebug() << "StelGLWidget context format version:" << ctx->format().majorVersion() << "." << context()->format().minorVersion(); | ||
2285 | 134 | qDebug() << "StelGLWidget has CompatibilityProfile:" << (ctx->format().profile()==QSurfaceFormat::CompatibilityProfile ? "yes" : "no") << "(" <<context()->format().profile() << ")"; | ||
2286 | 135 | } | ||
2287 | 136 | |||
2288 | 137 | parent->init(); | ||
2289 | 138 | initialized = true; | ||
2290 | 139 | } | ||
2291 | 140 | |||
2292 | 141 | protected: | ||
2293 | 142 | virtual void paintGL() Q_DECL_OVERRIDE | ||
2294 | 143 | { | ||
2295 | 144 | //this is actually never called because the | ||
2296 | 145 | //QGraphicsView intercepts the paint event | ||
2297 | 146 | //we have to draw in the background of the scene | ||
2298 | 147 | //or as a QGraphicsItem | ||
2299 | 148 | qDebug()<<"paintGL"; | ||
2300 | 149 | } | ||
2301 | 150 | virtual void resizeGL(int w, int h) Q_DECL_OVERRIDE | ||
2302 | 151 | { | ||
2303 | 152 | //we probably can ignore this method, | ||
2304 | 153 | //it seems it is also never called | ||
2305 | 154 | qDebug()<<"resizeGL"<<w<<h; | ||
2306 | 155 | } | ||
2307 | 156 | |||
2308 | 157 | private: | ||
2309 | 158 | StelMainView* parent; | ||
2310 | 159 | bool initialized; | ||
2311 | 160 | }; | ||
2312 | 161 | |||
2313 | 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. |
2314 | 73 | class NightModeGraphicsEffect : public QGraphicsEffect | 163 | class NightModeGraphicsEffect : public QGraphicsEffect |
2315 | 74 | { | 164 | { |
2316 | 75 | public: | 165 | public: |
2318 | 76 | NightModeGraphicsEffect(QObject* parent = NULL); | 166 | NightModeGraphicsEffect(StelMainView* parent = NULL) |
2319 | 167 | : QGraphicsEffect(parent), | ||
2320 | 168 | parent(parent), fbo(NULL) | ||
2321 | 169 | { | ||
2322 | 170 | Q_ASSERT(parent->glContext() == QOpenGLContext::currentContext()); | ||
2323 | 171 | |||
2324 | 172 | program = new QOpenGLShaderProgram(this); | ||
2325 | 173 | QString vertexCode = | ||
2326 | 174 | "attribute highp vec4 a_pos;\n" | ||
2327 | 175 | "attribute highp vec2 a_texCoord;\n" | ||
2328 | 176 | "varying highp vec2 v_texCoord;\n" | ||
2329 | 177 | "void main(void)\n" | ||
2330 | 178 | "{\n" | ||
2331 | 179 | "v_texCoord = a_texCoord;\n" | ||
2332 | 180 | "gl_Position = a_pos;\n" | ||
2333 | 181 | "}\n"; | ||
2334 | 182 | QString fragmentCode = | ||
2335 | 183 | "varying highp vec2 v_texCoord;\n" | ||
2336 | 184 | "uniform sampler2D u_source;\n" | ||
2337 | 185 | "void main(void)\n" | ||
2338 | 186 | "{\n" | ||
2339 | 187 | " mediump vec3 color = texture2D(u_source, v_texCoord).rgb;\n" | ||
2340 | 188 | " mediump float luminance = max(max(color.r, color.g), color.b);\n" | ||
2341 | 189 | " gl_FragColor = vec4(luminance, 0.0, 0.0, 1.0);\n" | ||
2342 | 190 | "}\n"; | ||
2343 | 191 | program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexCode); | ||
2344 | 192 | program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentCode); | ||
2345 | 193 | program->link(); | ||
2346 | 194 | vars.pos = program->attributeLocation("a_pos"); | ||
2347 | 195 | vars.texCoord = program->attributeLocation("a_texCoord"); | ||
2348 | 196 | vars.source = program->uniformLocation("u_source"); | ||
2349 | 197 | } | ||
2350 | 198 | |||
2351 | 199 | virtual ~NightModeGraphicsEffect() | ||
2352 | 200 | { | ||
2353 | 201 | Q_ASSERT(parent->glContext() == QOpenGLContext::currentContext()); | ||
2354 | 202 | //clean up fbo | ||
2355 | 203 | delete fbo; | ||
2356 | 204 | } | ||
2357 | 77 | protected: | 205 | protected: |
2359 | 78 | virtual void draw(QPainter* painter); | 206 | virtual void draw(QPainter* painter) Q_DECL_OVERRIDE |
2360 | 207 | { | ||
2361 | 208 | Q_ASSERT(parent->glContext() == QOpenGLContext::currentContext()); | ||
2362 | 209 | QOpenGLFunctions* gl = QOpenGLContext::currentContext()->functions(); | ||
2363 | 210 | |||
2364 | 211 | int mainFBO; | ||
2365 | 212 | gl->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &mainFBO); | ||
2366 | 213 | |||
2367 | 214 | int pixelRatio = painter->device()->devicePixelRatio(); | ||
2368 | 215 | QSize size(painter->device()->width() * pixelRatio, painter->device()->height() * pixelRatio); | ||
2369 | 216 | if (fbo && fbo->size() != size) | ||
2370 | 217 | { | ||
2371 | 218 | delete fbo; | ||
2372 | 219 | fbo = NULL; | ||
2373 | 220 | } | ||
2374 | 221 | if (!fbo) | ||
2375 | 222 | { | ||
2376 | 223 | QOpenGLFramebufferObjectFormat format; | ||
2377 | 224 | format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); | ||
2378 | 225 | format.setInternalTextureFormat(GL_RGBA); | ||
2379 | 226 | fbo = new QOpenGLFramebufferObject(size, format); | ||
2380 | 227 | } | ||
2381 | 228 | |||
2382 | 229 | fbo->bind(); | ||
2383 | 230 | QOpenGLPaintDevice device(size); | ||
2384 | 231 | QPainter fboPainter(&device); | ||
2385 | 232 | drawSource(&fboPainter); | ||
2386 | 233 | //dont use QOpenGLFramebufferObject::release here | ||
2387 | 234 | gl->glBindFramebuffer(GL_FRAMEBUFFER,mainFBO); | ||
2388 | 235 | |||
2389 | 236 | painter->save(); | ||
2390 | 237 | painter->beginNativePainting(); | ||
2391 | 238 | program->bind(); | ||
2392 | 239 | const GLfloat pos[] = {-1, -1, +1, -1, -1, +1, +1, +1}; | ||
2393 | 240 | const GLfloat texCoord[] = {0, 0, 1, 0, 0, 1, 1, 1}; | ||
2394 | 241 | program->setUniformValue(vars.source, 0); | ||
2395 | 242 | program->setAttributeArray(vars.pos, pos, 2); | ||
2396 | 243 | program->setAttributeArray(vars.texCoord, texCoord, 2); | ||
2397 | 244 | program->enableAttributeArray(vars.pos); | ||
2398 | 245 | program->enableAttributeArray(vars.texCoord); | ||
2399 | 246 | gl->glBindTexture(GL_TEXTURE_2D, fbo->texture()); | ||
2400 | 247 | gl->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); | ||
2401 | 248 | program->release(); | ||
2402 | 249 | painter->endNativePainting(); | ||
2403 | 250 | painter->restore(); | ||
2404 | 251 | } | ||
2405 | 252 | |||
2406 | 79 | private: | 253 | private: |
2409 | 80 | QGLFramebufferObject* fbo; | 254 | StelMainView* parent; |
2410 | 81 | QGLShaderProgram *program; | 255 | QOpenGLFramebufferObject* fbo; |
2411 | 256 | QOpenGLShaderProgram *program; | ||
2412 | 82 | struct { | 257 | struct { |
2413 | 83 | int pos; | 258 | int pos; |
2414 | 84 | int texCoord; | 259 | int texCoord; |
2415 | @@ -86,355 +261,271 @@ | |||
2416 | 86 | } vars; | 261 | } vars; |
2417 | 87 | }; | 262 | }; |
2418 | 88 | 263 | ||
2454 | 89 | NightModeGraphicsEffect::NightModeGraphicsEffect(QObject* parent) : | 264 | class StelGraphicsScene : public QGraphicsScene |
2420 | 90 | QGraphicsEffect(parent) | ||
2421 | 91 | , fbo(NULL) | ||
2422 | 92 | { | ||
2423 | 93 | program = new QGLShaderProgram(this); | ||
2424 | 94 | QString vertexCode = | ||
2425 | 95 | "attribute highp vec4 a_pos;\n" | ||
2426 | 96 | "attribute highp vec2 a_texCoord;\n" | ||
2427 | 97 | "varying highp vec2 v_texCoord;\n" | ||
2428 | 98 | "void main(void)\n" | ||
2429 | 99 | "{\n" | ||
2430 | 100 | "v_texCoord = a_texCoord;\n" | ||
2431 | 101 | "gl_Position = a_pos;\n" | ||
2432 | 102 | "}\n"; | ||
2433 | 103 | QString fragmentCode = | ||
2434 | 104 | "varying highp vec2 v_texCoord;\n" | ||
2435 | 105 | "uniform sampler2D u_source;\n" | ||
2436 | 106 | "void main(void)\n" | ||
2437 | 107 | "{\n" | ||
2438 | 108 | " mediump vec3 color = texture2D(u_source, v_texCoord).rgb;\n" | ||
2439 | 109 | " mediump float luminance = max(max(color.r, color.g), color.b);\n" | ||
2440 | 110 | " gl_FragColor = vec4(luminance, 0.0, 0.0, 1.0);\n" | ||
2441 | 111 | "}\n"; | ||
2442 | 112 | program->addShaderFromSourceCode(QGLShader::Vertex, vertexCode); | ||
2443 | 113 | program->addShaderFromSourceCode(QGLShader::Fragment, fragmentCode); | ||
2444 | 114 | program->link(); | ||
2445 | 115 | vars.pos = program->attributeLocation("a_pos"); | ||
2446 | 116 | vars.texCoord = program->attributeLocation("a_texCoord"); | ||
2447 | 117 | vars.source = program->uniformLocation("u_source"); | ||
2448 | 118 | } | ||
2449 | 119 | |||
2450 | 120 | // Qt 5.5 does not support setting the devicePixelRatio of a QGLFramebufferObject, | ||
2451 | 121 | // So here we make a sub class just so that we can return the correct ratio when | ||
2452 | 122 | // using the buffer on a retina display. | ||
2453 | 123 | class NightModeGraphicsEffectFbo : public QGLFramebufferObject | ||
2455 | 124 | { | 265 | { |
2456 | 125 | public: | 266 | public: |
2459 | 126 | NightModeGraphicsEffectFbo(const QSize& s, const QGLFramebufferObjectFormat& f, int pixelRatio_) : | 267 | StelGraphicsScene(StelMainView* parent) |
2460 | 127 | QGLFramebufferObject(s, f), pixelRatio(pixelRatio_) {} | 268 | : QGraphicsScene(parent), parent(parent) |
2461 | 269 | { | ||
2462 | 270 | qDebug()<<"StelGraphicsScene constructor"; | ||
2463 | 271 | } | ||
2464 | 272 | |||
2465 | 128 | protected: | 273 | protected: |
2467 | 129 | virtual int metric(PaintDeviceMetric m) const | 274 | |
2468 | 275 | void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE | ||
2469 | 130 | { | 276 | { |
2472 | 131 | if (m == QPaintDevice::PdmDevicePixelRatio) return pixelRatio; | 277 | // Try to trigger a global shortcut. |
2473 | 132 | return QGLFramebufferObject::metric(m); | 278 | StelActionMgr* actionMgr = StelApp::getInstance().getStelActionManager(); |
2474 | 279 | if (actionMgr->pushKey(event->key() + event->modifiers(), true)) { | ||
2475 | 280 | event->setAccepted(true); | ||
2476 | 281 | parent->thereWasAnEvent(); // Refresh screen ASAP | ||
2477 | 282 | return; | ||
2478 | 283 | } | ||
2479 | 284 | //pass event on to items otherwise | ||
2480 | 285 | QGraphicsScene::keyPressEvent(event); | ||
2481 | 133 | } | 286 | } |
2482 | 287 | |||
2483 | 134 | private: | 288 | private: |
2485 | 135 | int pixelRatio; | 289 | StelMainView* parent; |
2486 | 136 | }; | 290 | }; |
2487 | 137 | 291 | ||
2526 | 138 | void NightModeGraphicsEffect::draw(QPainter* painter) | 292 | class StelRootItem : public QGraphicsObject |
2489 | 139 | { | ||
2490 | 140 | int pixelRatio = painter->device()->devicePixelRatio(); | ||
2491 | 141 | QSize size(painter->device()->width() * pixelRatio, painter->device()->height() * pixelRatio); | ||
2492 | 142 | if (fbo && fbo->size() != size) | ||
2493 | 143 | { | ||
2494 | 144 | delete fbo; | ||
2495 | 145 | fbo = NULL; | ||
2496 | 146 | } | ||
2497 | 147 | if (!fbo) | ||
2498 | 148 | { | ||
2499 | 149 | QGLFramebufferObjectFormat format; | ||
2500 | 150 | format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); | ||
2501 | 151 | format.setInternalTextureFormat(GL_RGBA); | ||
2502 | 152 | fbo = new NightModeGraphicsEffectFbo(size, format, pixelRatio); | ||
2503 | 153 | } | ||
2504 | 154 | QPainter fboPainter(fbo); | ||
2505 | 155 | drawSource(&fboPainter); | ||
2506 | 156 | |||
2507 | 157 | painter->save(); | ||
2508 | 158 | painter->beginNativePainting(); | ||
2509 | 159 | program->bind(); | ||
2510 | 160 | const GLfloat pos[] = {-1, -1, +1, -1, -1, +1, +1, +1}; | ||
2511 | 161 | const GLfloat texCoord[] = {0, 0, 1, 0, 0, 1, 1, 1}; | ||
2512 | 162 | program->setUniformValue(vars.source, 0); | ||
2513 | 163 | program->setAttributeArray(vars.pos, pos, 2); | ||
2514 | 164 | program->setAttributeArray(vars.texCoord, texCoord, 2); | ||
2515 | 165 | program->enableAttributeArray(vars.pos); | ||
2516 | 166 | program->enableAttributeArray(vars.texCoord); | ||
2517 | 167 | glBindTexture(GL_TEXTURE_2D, fbo->texture()); | ||
2518 | 168 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); | ||
2519 | 169 | program->release(); | ||
2520 | 170 | painter->endNativePainting(); | ||
2521 | 171 | painter->restore(); | ||
2522 | 172 | } | ||
2523 | 173 | |||
2524 | 174 | //! Render Stellarium sky. | ||
2525 | 175 | class StelSkyItem : public QGraphicsWidget | ||
2527 | 176 | { | 293 | { |
2528 | 177 | public: | 294 | public: |
2531 | 178 | StelSkyItem(QGraphicsItem* parent = NULL); | 295 | StelRootItem(StelMainView* mainView, QGraphicsItem* parent = NULL) |
2532 | 179 | void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); | 296 | : QGraphicsObject(parent), mainView(mainView) |
2533 | 297 | { | ||
2534 | 298 | setFlag(QGraphicsItem::ItemClipsToShape); | ||
2535 | 299 | setFlag(QGraphicsItem::ItemClipsChildrenToShape); | ||
2536 | 300 | setFlag(QGraphicsItem::ItemIsFocusable); | ||
2537 | 301 | |||
2538 | 302 | setAcceptHoverEvents(true); | ||
2539 | 303 | |||
2540 | 304 | #ifdef Q_OS_WIN | ||
2541 | 305 | setAcceptTouchEvents(true); | ||
2542 | 306 | grabGesture(Qt::PinchGesture); | ||
2543 | 307 | #endif | ||
2544 | 308 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton); | ||
2545 | 309 | previousPaintTime = StelApp::getTotalRunTime(); | ||
2546 | 310 | } | ||
2547 | 311 | |||
2548 | 312 | void setSize(const QSize& size) | ||
2549 | 313 | { | ||
2550 | 314 | prepareGeometryChange(); | ||
2551 | 315 | rect.setSize(size); | ||
2552 | 316 | } | ||
2553 | 317 | |||
2554 | 180 | protected: | 318 | protected: |
2562 | 181 | void mousePressEvent(QGraphicsSceneMouseEvent* event); | 319 | virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE |
2563 | 182 | void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); | 320 | { |
2564 | 183 | void mouseMoveEvent(QGraphicsSceneMouseEvent* event); | 321 | Q_UNUSED(option); |
2565 | 184 | void wheelEvent(QGraphicsSceneWheelEvent *event); | 322 | Q_UNUSED(widget); |
2566 | 185 | void keyPressEvent(QKeyEvent *event); | 323 | |
2567 | 186 | void keyReleaseEvent(QKeyEvent *event); | 324 | //a sanity check |
2568 | 187 | void resizeEvent(QGraphicsSceneResizeEvent* event); | 325 | Q_ASSERT(mainView->glContext() == QOpenGLContext::currentContext()); |
2569 | 326 | |||
2570 | 327 | const double now = StelApp::getTotalRunTime(); | ||
2571 | 328 | double dt = now - previousPaintTime; | ||
2572 | 329 | //qDebug()<<"dt"<<dt; | ||
2573 | 330 | previousPaintTime = now; | ||
2574 | 331 | |||
2575 | 332 | //update and draw | ||
2576 | 333 | StelApp& app = StelApp::getInstance(); | ||
2577 | 334 | app.update(dt); | ||
2578 | 335 | |||
2579 | 336 | //important to call this, or Qt may have invalid state after we have drawn (wrong textures, etc...) | ||
2580 | 337 | painter->beginNativePainting(); | ||
2581 | 338 | app.draw(); | ||
2582 | 339 | painter->endNativePainting(); | ||
2583 | 340 | |||
2584 | 341 | mainView->drawEnded(); | ||
2585 | 342 | } | ||
2586 | 343 | |||
2587 | 344 | virtual QRectF boundingRect() const Q_DECL_OVERRIDE | ||
2588 | 345 | { | ||
2589 | 346 | return rect; | ||
2590 | 347 | } | ||
2591 | 348 | |||
2592 | 349 | //*** Main event handlers to pass on to StelApp ***// | ||
2593 | 350 | void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE | ||
2594 | 351 | { | ||
2595 | 352 | QMouseEvent ev = convertMouseEvent(event); | ||
2596 | 353 | StelApp::getInstance().handleClick(&ev); | ||
2597 | 354 | event->setAccepted(ev.isAccepted()); | ||
2598 | 355 | if(ev.isAccepted()) | ||
2599 | 356 | mainView->thereWasAnEvent(); | ||
2600 | 357 | } | ||
2601 | 358 | |||
2602 | 359 | void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE | ||
2603 | 360 | { | ||
2604 | 361 | QMouseEvent ev = convertMouseEvent(event); | ||
2605 | 362 | StelApp::getInstance().handleClick(&ev); | ||
2606 | 363 | event->setAccepted(ev.isAccepted()); | ||
2607 | 364 | if(ev.isAccepted()) | ||
2608 | 365 | mainView->thereWasAnEvent(); | ||
2609 | 366 | } | ||
2610 | 367 | |||
2611 | 368 | void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE | ||
2612 | 369 | { | ||
2613 | 370 | QMouseEvent ev = convertMouseEvent(event); | ||
2614 | 371 | QPointF pos = ev.pos(); | ||
2615 | 372 | event->setAccepted(StelApp::getInstance().handleMove(pos.x(), pos.y(), ev.buttons())); | ||
2616 | 373 | if(event->isAccepted()) | ||
2617 | 374 | mainView->thereWasAnEvent(); | ||
2618 | 375 | } | ||
2619 | 376 | |||
2620 | 377 | void wheelEvent(QGraphicsSceneWheelEvent *event) Q_DECL_OVERRIDE | ||
2621 | 378 | { | ||
2622 | 379 | QPointF pos = event->scenePos(); | ||
2623 | 380 | pos.setY(rect.height() - 1 - pos.y()); | ||
2624 | 381 | QWheelEvent newEvent(QPoint(pos.x(),pos.y()), event->delta(), event->buttons(), event->modifiers(), event->orientation()); | ||
2625 | 382 | StelApp::getInstance().handleWheel(&newEvent); | ||
2626 | 383 | event->setAccepted(newEvent.isAccepted()); | ||
2627 | 384 | if(newEvent.isAccepted()) | ||
2628 | 385 | mainView->thereWasAnEvent(); | ||
2629 | 386 | } | ||
2630 | 387 | |||
2631 | 388 | void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE | ||
2632 | 389 | { | ||
2633 | 390 | StelApp::getInstance().handleKeys(event); | ||
2634 | 391 | if(event->isAccepted()) | ||
2635 | 392 | mainView->thereWasAnEvent(); | ||
2636 | 393 | } | ||
2637 | 394 | |||
2638 | 395 | void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE | ||
2639 | 396 | { | ||
2640 | 397 | StelApp::getInstance().handleKeys(event); | ||
2641 | 398 | if(event->isAccepted()) | ||
2642 | 399 | mainView->thereWasAnEvent(); | ||
2643 | 400 | } | ||
2644 | 401 | |||
2645 | 402 | //*** Gesture and touch support, currently only for Windows | ||
2646 | 188 | #ifdef Q_OS_WIN | 403 | #ifdef Q_OS_WIN |
2648 | 189 | bool event(QEvent * e); | 404 | bool event(QEvent * e) Q_DECL_OVERRIDE |
2649 | 405 | { | ||
2650 | 406 | switch (e->type()){ | ||
2651 | 407 | case QEvent::TouchBegin: | ||
2652 | 408 | case QEvent::TouchUpdate: | ||
2653 | 409 | case QEvent::TouchEnd: | ||
2654 | 410 | { | ||
2655 | 411 | QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e); | ||
2656 | 412 | QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); | ||
2657 | 413 | |||
2658 | 414 | if (touchPoints.count() == 1) | ||
2659 | 415 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton); | ||
2660 | 416 | |||
2661 | 417 | return true; | ||
2662 | 418 | break; | ||
2663 | 419 | } | ||
2664 | 420 | |||
2665 | 421 | case QEvent::Gesture: | ||
2666 | 422 | setAcceptedMouseButtons(0); | ||
2667 | 423 | return gestureEvent(static_cast<QGestureEvent*>(e)); | ||
2668 | 424 | break; | ||
2669 | 425 | |||
2670 | 426 | default: | ||
2671 | 427 | return QGraphicsObject::event(e); | ||
2672 | 428 | } | ||
2673 | 429 | } | ||
2674 | 430 | |||
2675 | 431 | private: | ||
2676 | 432 | bool gestureEvent(QGestureEvent *event) | ||
2677 | 433 | { | ||
2678 | 434 | if (QGesture *pinch = event->gesture(Qt::PinchGesture)) | ||
2679 | 435 | pinchTriggered(static_cast<QPinchGesture *>(pinch)); | ||
2680 | 436 | |||
2681 | 437 | return true; | ||
2682 | 438 | } | ||
2683 | 439 | |||
2684 | 440 | void pinchTriggered(QPinchGesture *gesture) | ||
2685 | 441 | { | ||
2686 | 442 | QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags(); | ||
2687 | 443 | if (changeFlags & QPinchGesture::ScaleFactorChanged) { | ||
2688 | 444 | qreal zoom = gesture->scaleFactor(); | ||
2689 | 445 | |||
2690 | 446 | if (zoom < 2 && zoom > 0.5){ | ||
2691 | 447 | StelApp::getInstance().handlePinch(zoom, true); | ||
2692 | 448 | } | ||
2693 | 449 | } | ||
2694 | 450 | } | ||
2695 | 190 | #endif | 451 | #endif |
2696 | 452 | |||
2697 | 191 | private: | 453 | private: |
2698 | 454 | //! Helper function to convert a QGraphicsSceneMouseEvent to a QMouseEvent suitable for StelApp consumption | ||
2699 | 455 | QMouseEvent convertMouseEvent(QGraphicsSceneMouseEvent *event) const | ||
2700 | 456 | { | ||
2701 | 457 | //convert graphics scene mouse event to widget style mouse event | ||
2702 | 458 | QEvent::Type t = QEvent::None; | ||
2703 | 459 | switch(event->type()) | ||
2704 | 460 | { | ||
2705 | 461 | case QEvent::GraphicsSceneMousePress: | ||
2706 | 462 | t = QEvent::MouseButtonPress; | ||
2707 | 463 | break; | ||
2708 | 464 | case QEvent::GraphicsSceneMouseRelease: | ||
2709 | 465 | t = QEvent::MouseButtonRelease; | ||
2710 | 466 | break; | ||
2711 | 467 | case QEvent::GraphicsSceneMouseMove: | ||
2712 | 468 | t = QEvent::MouseMove; | ||
2713 | 469 | break; | ||
2714 | 470 | default: | ||
2715 | 471 | qFatal("Invalid mouse event type %d",event->type()); | ||
2716 | 472 | } | ||
2717 | 473 | |||
2718 | 474 | QPointF pos = event->scenePos(); | ||
2719 | 475 | //Y needs to be inverted | ||
2720 | 476 | pos.setY(rect.height() - 1 - pos.y()); | ||
2721 | 477 | return QMouseEvent(t,pos,event->button(),event->buttons(),event->modifiers()); | ||
2722 | 478 | } | ||
2723 | 479 | |||
2724 | 480 | QRectF rect; | ||
2725 | 192 | double previousPaintTime; | 481 | double previousPaintTime; |
2731 | 193 | // void onSizeChanged(); | 482 | StelMainView* mainView; |
2727 | 194 | #ifdef Q_OS_WIN | ||
2728 | 195 | void pinchTriggered(QPinchGesture *gesture); | ||
2729 | 196 | bool gestureEvent(QGestureEvent *event); | ||
2730 | 197 | #endif | ||
2732 | 198 | }; | 483 | }; |
2733 | 199 | 484 | ||
2734 | 200 | //! Initialize and render Stellarium gui. | 485 | //! Initialize and render Stellarium gui. |
2735 | 201 | class StelGuiItem : public QGraphicsWidget | 486 | class StelGuiItem : public QGraphicsWidget |
2736 | 202 | { | 487 | { |
2737 | 203 | public: | 488 | public: |
2739 | 204 | StelGuiItem(QGraphicsItem* parent = NULL); | 489 | StelGuiItem(QGraphicsItem* parent = NULL) |
2740 | 490 | : QGraphicsWidget(parent) | ||
2741 | 491 | { | ||
2742 | 492 | StelApp::getInstance().getGui()->init(this); | ||
2743 | 493 | } | ||
2744 | 494 | |||
2745 | 205 | protected: | 495 | protected: |
2747 | 206 | void resizeEvent(QGraphicsSceneResizeEvent* event); | 496 | void resizeEvent(QGraphicsSceneResizeEvent* event) Q_DECL_OVERRIDE |
2748 | 497 | { | ||
2749 | 498 | Q_UNUSED(event); | ||
2750 | 499 | //widget->setGeometry(0, 0, size().width(), size().height()); | ||
2751 | 500 | StelApp::getInstance().getGui()->forceRefreshGui(); | ||
2752 | 501 | } | ||
2753 | 207 | private: | 502 | private: |
2755 | 208 | QGraphicsWidget *widget; | 503 | //QGraphicsWidget *widget; |
2756 | 209 | // void onSizeChanged(); | 504 | // void onSizeChanged(); |
2757 | 210 | }; | 505 | }; |
2758 | 211 | 506 | ||
2977 | 212 | StelSkyItem::StelSkyItem(QGraphicsItem* parent) | 507 | StelMainView::StelMainView(QSettings* settings) |
2978 | 213 | { | 508 | : QGraphicsView(), |
2979 | 214 | Q_UNUSED(parent); | 509 | guiItem(NULL), |
2762 | 215 | setObjectName("SkyItem"); | ||
2763 | 216 | setFlag(QGraphicsItem::ItemHasNoContents, false); | ||
2764 | 217 | setFlag(QGraphicsItem::ItemIsFocusable, true); | ||
2765 | 218 | setAcceptHoverEvents(true); | ||
2766 | 219 | #ifdef Q_OS_WIN | ||
2767 | 220 | setAcceptTouchEvents(true); | ||
2768 | 221 | grabGesture(Qt::PinchGesture); | ||
2769 | 222 | #endif | ||
2770 | 223 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton); | ||
2771 | 224 | previousPaintTime = StelApp::getTotalRunTime(); | ||
2772 | 225 | setFocus(); | ||
2773 | 226 | } | ||
2774 | 227 | |||
2775 | 228 | void StelSkyItem::resizeEvent(QGraphicsSceneResizeEvent* event) | ||
2776 | 229 | { | ||
2777 | 230 | QGraphicsWidget::resizeEvent(event); | ||
2778 | 231 | StelApp::getInstance().glWindowHasBeenResized(scenePos().x(), scene()->sceneRect().height()-(scenePos().y()+geometry().height()), geometry().width(), geometry().height()); | ||
2779 | 232 | } | ||
2780 | 233 | |||
2781 | 234 | void StelSkyItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | ||
2782 | 235 | { | ||
2783 | 236 | Q_UNUSED(option); | ||
2784 | 237 | Q_UNUSED(widget); | ||
2785 | 238 | |||
2786 | 239 | const double now = StelApp::getTotalRunTime(); | ||
2787 | 240 | double dt = now - previousPaintTime; | ||
2788 | 241 | previousPaintTime = now; | ||
2789 | 242 | |||
2790 | 243 | painter->beginNativePainting(); | ||
2791 | 244 | glClearColor(0, 0, 0, 1); | ||
2792 | 245 | glClear(GL_COLOR_BUFFER_BIT); | ||
2793 | 246 | StelApp::getInstance().update(dt); | ||
2794 | 247 | StelApp::getInstance().draw(); | ||
2795 | 248 | |||
2796 | 249 | painter->endNativePainting(); | ||
2797 | 250 | } | ||
2798 | 251 | |||
2799 | 252 | void StelSkyItem::mousePressEvent(QGraphicsSceneMouseEvent *event) | ||
2800 | 253 | { | ||
2801 | 254 | //To get back the focus from dialogs | ||
2802 | 255 | setFocus(); | ||
2803 | 256 | QPointF pos = event->scenePos(); | ||
2804 | 257 | pos.setY(size().height() - 1 - pos.y()); | ||
2805 | 258 | QMouseEvent newEvent(QEvent::MouseButtonPress, QPoint(pos.x(), pos.y()), event->button(), event->buttons(), event->modifiers()); | ||
2806 | 259 | StelApp::getInstance().handleClick(&newEvent); | ||
2807 | 260 | } | ||
2808 | 261 | |||
2809 | 262 | void StelSkyItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) | ||
2810 | 263 | { | ||
2811 | 264 | QPointF pos = event->scenePos(); | ||
2812 | 265 | pos.setY(size().height() - 1 - pos.y()); | ||
2813 | 266 | QMouseEvent newEvent(QEvent::MouseButtonRelease, QPoint(pos.x(), pos.y()), event->button(), event->buttons(), event->modifiers()); | ||
2814 | 267 | StelApp::getInstance().handleClick(&newEvent); | ||
2815 | 268 | } | ||
2816 | 269 | |||
2817 | 270 | void StelSkyItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) | ||
2818 | 271 | { | ||
2819 | 272 | QPointF pos = event->scenePos(); | ||
2820 | 273 | pos.setY(size().height() - 1 - pos.y()); | ||
2821 | 274 | StelApp::getInstance().handleMove(pos.x(), pos.y(), event->buttons()); | ||
2822 | 275 | } | ||
2823 | 276 | |||
2824 | 277 | void StelSkyItem::wheelEvent(QGraphicsSceneWheelEvent *event) | ||
2825 | 278 | { | ||
2826 | 279 | QPointF pos = event->scenePos(); | ||
2827 | 280 | pos.setY(size().height() - 1 - pos.y()); | ||
2828 | 281 | QWheelEvent newEvent(QPoint(pos.x(),pos.y()), event->delta(), event->buttons(), event->modifiers(), event->orientation()); | ||
2829 | 282 | StelApp::getInstance().handleWheel(&newEvent); | ||
2830 | 283 | } | ||
2831 | 284 | |||
2832 | 285 | #ifdef Q_OS_WIN | ||
2833 | 286 | bool StelSkyItem::event(QEvent * e) | ||
2834 | 287 | { | ||
2835 | 288 | switch (e->type()){ | ||
2836 | 289 | case QEvent::TouchBegin: | ||
2837 | 290 | case QEvent::TouchUpdate: | ||
2838 | 291 | case QEvent::TouchEnd: | ||
2839 | 292 | { | ||
2840 | 293 | QTouchEvent *touchEvent = static_cast<QTouchEvent *>(e); | ||
2841 | 294 | QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); | ||
2842 | 295 | |||
2843 | 296 | if (touchPoints.count() == 1) | ||
2844 | 297 | setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton | Qt::MiddleButton); | ||
2845 | 298 | |||
2846 | 299 | return true; | ||
2847 | 300 | break; | ||
2848 | 301 | } | ||
2849 | 302 | |||
2850 | 303 | case QEvent::Gesture: | ||
2851 | 304 | setAcceptedMouseButtons(0); | ||
2852 | 305 | return gestureEvent(static_cast<QGestureEvent*>(e)); | ||
2853 | 306 | break; | ||
2854 | 307 | |||
2855 | 308 | default: | ||
2856 | 309 | return QGraphicsWidget::event(e); | ||
2857 | 310 | } | ||
2858 | 311 | } | ||
2859 | 312 | |||
2860 | 313 | bool StelSkyItem::gestureEvent(QGestureEvent *event) | ||
2861 | 314 | { | ||
2862 | 315 | if (QGesture *pinch = event->gesture(Qt::PinchGesture)) | ||
2863 | 316 | pinchTriggered(static_cast<QPinchGesture *>(pinch)); | ||
2864 | 317 | |||
2865 | 318 | return true; | ||
2866 | 319 | } | ||
2867 | 320 | |||
2868 | 321 | void StelSkyItem::pinchTriggered(QPinchGesture *gesture) | ||
2869 | 322 | { | ||
2870 | 323 | QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags(); | ||
2871 | 324 | if (changeFlags & QPinchGesture::ScaleFactorChanged) { | ||
2872 | 325 | qreal zoom = gesture->scaleFactor(); | ||
2873 | 326 | |||
2874 | 327 | if (zoom < 2 && zoom > 0.5){ | ||
2875 | 328 | StelApp::getInstance().handlePinch(zoom, true); | ||
2876 | 329 | } | ||
2877 | 330 | } | ||
2878 | 331 | } | ||
2879 | 332 | #endif | ||
2880 | 333 | |||
2881 | 334 | void StelSkyItem::keyPressEvent(QKeyEvent* event) | ||
2882 | 335 | { | ||
2883 | 336 | StelApp::getInstance().handleKeys(event); | ||
2884 | 337 | } | ||
2885 | 338 | |||
2886 | 339 | void StelSkyItem::keyReleaseEvent(QKeyEvent* event) | ||
2887 | 340 | { | ||
2888 | 341 | StelApp::getInstance().handleKeys(event); | ||
2889 | 342 | } | ||
2890 | 343 | |||
2891 | 344 | |||
2892 | 345 | StelGuiItem::StelGuiItem(QGraphicsItem* parent) : QGraphicsWidget(parent) | ||
2893 | 346 | { | ||
2894 | 347 | widget = new QGraphicsWidget(this); | ||
2895 | 348 | StelApp::getInstance().getGui()->init(widget); | ||
2896 | 349 | } | ||
2897 | 350 | |||
2898 | 351 | void StelGuiItem::resizeEvent(QGraphicsSceneResizeEvent* event) | ||
2899 | 352 | { | ||
2900 | 353 | Q_UNUSED(event); | ||
2901 | 354 | widget->setGeometry(0, 0, size().width(), size().height()); | ||
2902 | 355 | StelApp::getInstance().getGui()->forceRefreshGui(); | ||
2903 | 356 | } | ||
2904 | 357 | |||
2905 | 358 | #if STEL_USE_NEW_OPENGL_WIDGETS | ||
2906 | 359 | |||
2907 | 360 | class StelQOpenGLWidget : public QOpenGLWidget | ||
2908 | 361 | { | ||
2909 | 362 | public: | ||
2910 | 363 | StelQOpenGLWidget(QWidget* parent) : QOpenGLWidget(parent) | ||
2911 | 364 | { | ||
2912 | 365 | // TODO: Unclear if tese attributes make sense? | ||
2913 | 366 | setAttribute(Qt::WA_PaintOnScreen); | ||
2914 | 367 | setAttribute(Qt::WA_NoSystemBackground); | ||
2915 | 368 | setAttribute(Qt::WA_OpaquePaintEvent); | ||
2916 | 369 | } | ||
2917 | 370 | |||
2918 | 371 | protected: | ||
2919 | 372 | virtual void initializeGL() | ||
2920 | 373 | { | ||
2921 | 374 | qDebug() << "It appears this was never called?"; | ||
2922 | 375 | qDebug() << "OpenGL supported version: " << QString((char*)glGetString(GL_VERSION)); | ||
2923 | 376 | |||
2924 | 377 | QOpenGLWidget::initializeGL(); | ||
2925 | 378 | this->makeCurrent(); // Do we need this? | ||
2926 | 379 | // GZ I have no idea how to proceed, sorry. | ||
2927 | 380 | QSurfaceFormat format=this->format(); | ||
2928 | 381 | qDebug() << "Current Format: " << this->format(); | ||
2929 | 382 | // TODO: Test something? The old tests may be obsolete as all OpenGL2 formats/contexts have these? | ||
2930 | 383 | } | ||
2931 | 384 | virtual void paintGL() | ||
2932 | 385 | { | ||
2933 | 386 | // TODO: what shall this do exactly? | ||
2934 | 387 | } | ||
2935 | 388 | virtual void resizeGL() | ||
2936 | 389 | { | ||
2937 | 390 | // TODO: what shall this do exactly? | ||
2938 | 391 | } | ||
2939 | 392 | |||
2940 | 393 | }; | ||
2941 | 394 | |||
2942 | 395 | #else | ||
2943 | 396 | class StelQGLWidget : public QGLWidget | ||
2944 | 397 | { | ||
2945 | 398 | public: | ||
2946 | 399 | StelQGLWidget(QGLContext* ctx, QWidget* parent) : QGLWidget(ctx, parent) | ||
2947 | 400 | { | ||
2948 | 401 | setAttribute(Qt::WA_PaintOnScreen); | ||
2949 | 402 | setAttribute(Qt::WA_NoSystemBackground); | ||
2950 | 403 | setAttribute(Qt::WA_OpaquePaintEvent); | ||
2951 | 404 | } | ||
2952 | 405 | |||
2953 | 406 | protected: | ||
2954 | 407 | virtual void initializeGL() | ||
2955 | 408 | { | ||
2956 | 409 | qDebug() << "It appears this is never called?"; | ||
2957 | 410 | Q_ASSERT(0); | ||
2958 | 411 | qDebug() << "OpenGL supported version: " << QString((char*)glGetString(GL_VERSION)); | ||
2959 | 412 | |||
2960 | 413 | QGLWidget::initializeGL(); | ||
2961 | 414 | |||
2962 | 415 | qDebug() << "Current Context: " << this->format(); | ||
2963 | 416 | if (!format().stencil()) | ||
2964 | 417 | qWarning("Could not get stencil buffer; results will be suboptimal"); | ||
2965 | 418 | if (!format().depth()) | ||
2966 | 419 | qWarning("Could not get depth buffer; results will be suboptimal"); | ||
2967 | 420 | if (!format().doubleBuffer()) | ||
2968 | 421 | qWarning("Could not get double buffer; results will be suboptimal"); | ||
2969 | 422 | } | ||
2970 | 423 | |||
2971 | 424 | }; | ||
2972 | 425 | #endif | ||
2973 | 426 | |||
2974 | 427 | |||
2975 | 428 | StelMainView::StelMainView(QWidget* parent) | ||
2976 | 429 | : QGraphicsView(parent), guiItem(NULL), | ||
2980 | 430 | gui(NULL), | 510 | gui(NULL), |
2981 | 511 | stelApp(NULL), | ||
2982 | 512 | updateQueued(false), | ||
2983 | 431 | flagInvertScreenShotColors(false), | 513 | flagInvertScreenShotColors(false), |
2984 | 432 | flagOverwriteScreenshots(false), | 514 | flagOverwriteScreenshots(false), |
2985 | 433 | screenShotPrefix("stellarium-"), | 515 | screenShotPrefix("stellarium-"), |
2986 | 434 | screenShotDir(""), | 516 | screenShotDir(""), |
2988 | 435 | cursorTimeout(-1.f), flagCursorTimeout(false), minFpsTimer(NULL), maxfps(10000.f) | 517 | cursorTimeout(-1.f), flagCursorTimeout(false), maxfps(10000.f) |
2989 | 436 | { | 518 | { |
2990 | 519 | setAttribute(Qt::WA_OpaquePaintEvent); | ||
2991 | 520 | setAutoFillBackground(false); | ||
2992 | 521 | |||
2993 | 522 | configuration = settings; | ||
2994 | 437 | StelApp::initStatic(); | 523 | StelApp::initStatic(); |
2995 | 524 | |||
2996 | 525 | minFpsTimer = new QTimer(this); | ||
2997 | 526 | minFpsTimer->setTimerType(Qt::PreciseTimer); | ||
2998 | 527 | minFpsTimer->setInterval(1000/minfps); | ||
2999 | 528 | connect(minFpsTimer,SIGNAL(timeout()),this,SLOT(minFPSUpdate())); | ||
3000 | 438 | 529 | ||
3001 | 439 | // Can't create 2 StelMainView instances | 530 | // Can't create 2 StelMainView instances |
3002 | 440 | Q_ASSERT(!singleton); | 531 | Q_ASSERT(!singleton); |
3003 | @@ -444,83 +535,48 @@ | |||
3004 | 444 | initTitleI18n(); | 535 | initTitleI18n(); |
3005 | 445 | setObjectName("Mainview"); | 536 | setObjectName("Mainview"); |
3006 | 446 | 537 | ||
3007 | 447 | // Allows for precise FPS control | ||
3008 | 448 | setViewportUpdateMode(QGraphicsView::NoViewportUpdate); | 538 | setViewportUpdateMode(QGraphicsView::NoViewportUpdate); |
3009 | 449 | setFrameShape(QFrame::NoFrame); | 539 | setFrameShape(QFrame::NoFrame); |
3010 | 450 | setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | 540 | setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
3011 | 451 | setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | 541 | setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
3013 | 452 | setFocusPolicy(Qt::StrongFocus); | 542 | //because we only want child elements to have focus, we turn it off here |
3014 | 543 | setFocusPolicy(Qt::NoFocus); | ||
3015 | 453 | connect(this, SIGNAL(screenshotRequested()), this, SLOT(doScreenshot())); | 544 | connect(this, SIGNAL(screenshotRequested()), this, SLOT(doScreenshot())); |
3016 | 454 | 545 | ||
3017 | 455 | lastEventTimeSec = 0; | 546 | lastEventTimeSec = 0; |
3018 | 456 | 547 | ||
3035 | 457 | 548 | #ifdef OPENGL_DEBUG_LOGGING | |
3036 | 458 | #if STEL_USE_NEW_OPENGL_WIDGETS | 549 | glLogger = new QOpenGLDebugLogger(this); |
3037 | 459 | // Primary test for OpenGL existence | 550 | connect(glLogger, SIGNAL(messageLogged(QOpenGLDebugMessage)), this, SLOT(logGLMessage(QOpenGLDebugMessage))); |
3038 | 460 | if (QSurfaceFormat::defaultFormat().majorVersion() < 2) | 551 | #endif |
3039 | 461 | { | 552 | |
3040 | 462 | qWarning() << "No OpenGL 2 support on this system. Aborting."; | 553 | // VSync control |
3041 | 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(); |
3042 | 464 | exit(0); | 555 | #if QT_VERSION >= QT_VERSION_CHECK(5,4,0) |
3043 | 465 | } | 556 | // with the QOpenGLWidget, this seems to be needed on the default surface format before creating any windows |
3044 | 466 | 557 | QSurfaceFormat defFmt = QSurfaceFormat::defaultFormat(); | |
3045 | 467 | //QSurfaceFormat format(); | 558 | defFmt.setSwapInterval(vsync); |
3046 | 468 | //// TBD: What options shall be default? | 559 | QSurfaceFormat::setDefaultFormat(defFmt); |
3047 | 469 | //QSurfaceFormat::setDefaultFormat(format); | 560 | #endif |
3048 | 470 | ////QOpenGLContext* context=new QOpenGLContext::create(); | 561 | |
3049 | 471 | glWidget = new StelQOpenGLWidget(this); | 562 | QSurfaceFormat widgetFormat = getDesiredGLFormat(); |
3050 | 472 | //glWidget->setFormat(format); | 563 | widgetFormat.setSwapInterval(vsync); |
3051 | 564 | glWidget = new StelGLWidget(this); | ||
3052 | 565 | //Set the surface format BEFORE showing the widget | ||
3053 | 566 | //We could also set this as default format instead of just the widget's format, | ||
3054 | 567 | //but I don't know if some background Qt stuff needs another buffer configuration or something, | ||
3055 | 568 | //so let's be safe and just set it here | ||
3056 | 569 | #ifdef USE_OLD_QGLWIDGET | ||
3057 | 570 | glWidget->setFormat(QGLFormat::fromSurfaceFormat(widgetFormat)); | ||
3058 | 473 | #else | 571 | #else |
3101 | 474 | // Primary test for OpenGL existence | 572 | glWidget->setFormat(widgetFormat); |
3060 | 475 | if (QGLFormat::openGLVersionFlags() < QGLFormat::OpenGL_Version_2_1) | ||
3061 | 476 | { | ||
3062 | 477 | qWarning() << "No OpenGL 2.1 support on this system. Aborting."; | ||
3063 | 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); | ||
3064 | 479 | exit(1); | ||
3065 | 480 | } | ||
3066 | 481 | |||
3067 | 482 | // Create an openGL viewport | ||
3068 | 483 | QGLFormat glFormat(QGL::StencilBuffer | QGL::DepthBuffer | QGL::DoubleBuffer); | ||
3069 | 484 | // Even if setting a version here, it may not be accepted in StelQGLWidget()! | ||
3070 | 485 | // Currently, not setting a version explicitly works on Windows and Linux. | ||
3071 | 486 | // Apparently some Macs have problems however and default to 2.1. | ||
3072 | 487 | // We try a new CLI flag here which requests 3.3 Compatibiliy Profile which modern Macs should deliver. | ||
3073 | 488 | // OpenGL Specs say this will deliver at least the requested version, if possible. | ||
3074 | 489 | // TBD: Maybe this must make a differentiation between OpenGL and OpenGL ES! | ||
3075 | 490 | // TBD: If this works for Mac, it should be requested on all Macs without CLI option! | ||
3076 | 491 | if (qApp->property("onetime_compat33")==true) | ||
3077 | 492 | { | ||
3078 | 493 | if (!(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_3_3)) | ||
3079 | 494 | { | ||
3080 | 495 | qWarning() << "No OpenGL 3.3 found here. We will get whatever is available."; | ||
3081 | 496 | qDebug() << "FYI: OpenGL Versions Supported: " << QGLFormat::openGLVersionFlags(); | ||
3082 | 497 | } | ||
3083 | 498 | glFormat.setVersion(3, 3); | ||
3084 | 499 | glFormat.setProfile(QGLFormat::CompatibilityProfile); | ||
3085 | 500 | } | ||
3086 | 501 | QGLContext* context=new QGLContext(glFormat); | ||
3087 | 502 | |||
3088 | 503 | if (context->format() != glFormat) | ||
3089 | 504 | { | ||
3090 | 505 | qWarning() << "Cannot provide requested OpenGL format. Apparently insufficient OpenGL resources on this system."; | ||
3091 | 506 | QMessageBox::critical(0, "Stellarium", q_("Cannot acquire necessary OpenGL resources."), QMessageBox::Abort, QMessageBox::Abort); | ||
3092 | 507 | exit(1); | ||
3093 | 508 | } | ||
3094 | 509 | glWidget = new StelQGLWidget(context, this); | ||
3095 | 510 | if (qApp->property("onetime_compat33")==true) | ||
3096 | 511 | { | ||
3097 | 512 | // This may not return the version number set previously! | ||
3098 | 513 | qDebug() << "StelQGLWidget context format version:" << glWidget->context()->format().majorVersion() << "." << glWidget->context()->format().minorVersion(); | ||
3099 | 514 | qDebug() << "StelQGLWidget has CompatibilityProfile:" << (glWidget->context()->format().profile()==QGLFormat::CompatibilityProfile ? "yes" : "no") << "(" <<glWidget->context()->format().profile() << ")"; | ||
3100 | 515 | } | ||
3102 | 516 | #endif | 573 | #endif |
3103 | 517 | |||
3104 | 518 | setViewport(glWidget); | 574 | setViewport(glWidget); |
3105 | 519 | 575 | ||
3107 | 520 | setScene(new QGraphicsScene(this)); | 576 | stelScene = new StelGraphicsScene(this); |
3108 | 577 | setScene(stelScene); | ||
3109 | 521 | scene()->setItemIndexMethod(QGraphicsScene::NoIndex); | 578 | scene()->setItemIndexMethod(QGraphicsScene::NoIndex); |
3112 | 522 | rootItem = new QGraphicsWidget(); | 579 | rootItem = new StelRootItem(this); |
3111 | 523 | rootItem->setFocusPolicy(Qt::NoFocus); | ||
3113 | 524 | 580 | ||
3114 | 525 | // Workaround (see Bug #940638) Although we have already explicitly set | 581 | // Workaround (see Bug #940638) Although we have already explicitly set |
3115 | 526 | // LC_NUMERIC to "C" in main.cpp there seems to be a bug in OpenGL where | 582 | // LC_NUMERIC to "C" in main.cpp there seems to be a bug in OpenGL where |
3116 | @@ -529,79 +585,157 @@ | |||
3117 | 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. |
3118 | 530 | setlocale(LC_NUMERIC, "C"); | 586 | setlocale(LC_NUMERIC, "C"); |
3119 | 531 | // End workaround | 587 | // End workaround |
3120 | 588 | |||
3121 | 589 | #ifdef USE_OLD_QGLWIDGET | ||
3122 | 590 | // StelGLWidget::initializeGL is seemingly never called automatically with the QGLWidget, so we have to do it ourselves | ||
3123 | 591 | //we have to force context creation here | ||
3124 | 592 | glWidget->makeCurrent(); | ||
3125 | 593 | glWidget->initializeGL(); | ||
3126 | 594 | #endif | ||
3127 | 532 | } | 595 | } |
3128 | 533 | 596 | ||
3129 | 534 | void StelMainView::resizeEvent(QResizeEvent* event) | 597 | void StelMainView::resizeEvent(QResizeEvent* event) |
3130 | 535 | { | 598 | { |
3133 | 536 | scene()->setSceneRect(QRect(QPoint(0, 0), event->size())); | 599 | if(scene()) |
3134 | 537 | rootItem->setGeometry(0,0,event->size().width(),event->size().height()); | 600 | { |
3135 | 601 | const QSize& sz = event->size(); | ||
3136 | 602 | scene()->setSceneRect(QRect(QPoint(0, 0), sz)); | ||
3137 | 603 | rootItem->setSize(sz); | ||
3138 | 604 | if(guiItem) | ||
3139 | 605 | guiItem->setGeometry(QRectF(0.0f,0.0f,sz.width(),sz.height())); | ||
3140 | 606 | } | ||
3141 | 538 | QGraphicsView::resizeEvent(event); | 607 | QGraphicsView::resizeEvent(event); |
3142 | 539 | } | 608 | } |
3143 | 540 | 609 | ||
3144 | 541 | void StelMainView::focusSky() { | 610 | void StelMainView::focusSky() { |
3147 | 542 | scene()->setActiveWindow(0); | 611 | //scene()->setActiveWindow(0); |
3148 | 543 | skyItem->setFocus(); | 612 | rootItem->setFocus(); |
3149 | 544 | } | 613 | } |
3150 | 545 | 614 | ||
3151 | 546 | StelMainView::~StelMainView() | 615 | StelMainView::~StelMainView() |
3152 | 547 | { | 616 | { |
3153 | 617 | //delete the night view graphic effect here while GL context is still valid | ||
3154 | 618 | rootItem->setGraphicsEffect(Q_NULLPTR); | ||
3155 | 548 | StelApp::deinitStatic(); | 619 | StelApp::deinitStatic(); |
3156 | 549 | } | 620 | } |
3157 | 550 | 621 | ||
3160 | 551 | void StelMainView::init(QSettings* conf) | 622 | QSurfaceFormat StelMainView::getDesiredGLFormat() const |
3161 | 552 | { | 623 | { |
3162 | 624 | #if QT_VERSION < QT_VERSION_CHECK(5,4,0) | ||
3163 | 625 | //default-constructed format | ||
3164 | 626 | QSurfaceFormat fmt; | ||
3165 | 627 | #else | ||
3166 | 628 | //use the default format as basis | ||
3167 | 629 | QSurfaceFormat fmt = QSurfaceFormat::defaultFormat(); | ||
3168 | 630 | qDebug()<<"Default surface format: "<<fmt; | ||
3169 | 631 | #endif | ||
3170 | 632 | |||
3171 | 633 | //if on an GLES build, do not set the format | ||
3172 | 634 | #ifndef QT_OPENGL_ES_2 | ||
3173 | 635 | // OGL 2.1 + FBOs should basically be the minimum required for Stellarium | ||
3174 | 636 | fmt.setRenderableType(QSurfaceFormat::OpenGL); | ||
3175 | 637 | fmt.setMajorVersion(2); | ||
3176 | 638 | fmt.setMinorVersion(1); | ||
3177 | 639 | |||
3178 | 640 | // The following is NOT needed (or even supported) when we request a 2.1 context | ||
3179 | 641 | // The implementation may give us a newer context, | ||
3180 | 642 | // but compatibility with 2.1 should be ensured automatically | ||
3181 | 643 | //fmt.setProfile(QSurfaceFormat::CompatibilityProfile); | ||
3182 | 644 | //fmt.setOption(QSurfaceFormat::DeprecatedFunctions); | ||
3183 | 645 | #endif | ||
3184 | 646 | |||
3185 | 647 | //request some sane buffer formats | ||
3186 | 648 | fmt.setRedBufferSize(8); | ||
3187 | 649 | fmt.setGreenBufferSize(8); | ||
3188 | 650 | fmt.setBlueBufferSize(8); | ||
3189 | 651 | fmt.setAlphaBufferSize(8); | ||
3190 | 652 | fmt.setDepthBufferSize(24); | ||
3191 | 653 | //I dont think we use the stencil buffer for anything | ||
3192 | 654 | //but maybe Qt needs it | ||
3193 | 655 | fmt.setStencilBufferSize(8); | ||
3194 | 656 | |||
3195 | 657 | #ifdef OPENGL_DEBUG_LOGGING | ||
3196 | 658 | //try to enable GL debugging using GL_KHR_debug | ||
3197 | 659 | fmt.setOption(QSurfaceFormat::DebugContext); | ||
3198 | 660 | #endif | ||
3199 | 661 | //vsync needs to be set on the default format for it to work | ||
3200 | 662 | //fmt.setSwapInterval(0); | ||
3201 | 663 | |||
3202 | 664 | qDebug()<<"Desired surface format: "<<fmt; | ||
3203 | 665 | return fmt; | ||
3204 | 666 | } | ||
3205 | 667 | |||
3206 | 668 | void StelMainView::init() | ||
3207 | 669 | { | ||
3208 | 670 | #ifdef OPENGL_DEBUG_LOGGING | ||
3209 | 671 | if(!QOpenGLContext::currentContext()->hasExtension(QByteArrayLiteral("GL_KHR_debug"))) | ||
3210 | 672 | qWarning()<<"GL_KHR_debug extension missing, OpenGL debug logger will likely not work"; | ||
3211 | 673 | if(glLogger->initialize()) | ||
3212 | 674 | { | ||
3213 | 675 | qDebug()<<"OpenGL debug logger initialized"; | ||
3214 | 676 | QVector<GLuint> disabledMsgs; | ||
3215 | 677 | //if your GL implementation spams some output you are not interested in, | ||
3216 | 678 | //you can disable their message IDs here | ||
3217 | 679 | //disabledMsgs.append(100); | ||
3218 | 680 | glLogger->disableMessages(disabledMsgs); | ||
3219 | 681 | glLogger->startLogging(QOpenGLDebugLogger::SynchronousLogging); | ||
3220 | 682 | //the internal log buffer may not be empty, so check it | ||
3221 | 683 | foreach(const QOpenGLDebugMessage& msg, glLogger->loggedMessages()) | ||
3222 | 684 | { | ||
3223 | 685 | logGLMessage(msg); | ||
3224 | 686 | } | ||
3225 | 687 | } | ||
3226 | 688 | else | ||
3227 | 689 | qWarning()<<"Failed to initialize OpenGL debug logger"; | ||
3228 | 690 | |||
3229 | 691 | connect(QOpenGLContext::currentContext(),SIGNAL(aboutToBeDestroyed()),this,SLOT(contextDestroyed())); | ||
3230 | 692 | //for easier debugging, print the adress of the main GL context | ||
3231 | 693 | qDebug()<<"CurCtxPtr:"<<QOpenGLContext::currentContext(); | ||
3232 | 694 | #endif | ||
3233 | 695 | |||
3234 | 696 | qDebug()<<"StelMainView::init"; | ||
3235 | 697 | |||
3236 | 698 | glInfo.mainContext = QOpenGLContext::currentContext(); | ||
3237 | 699 | glInfo.functions = glInfo.mainContext->functions(); | ||
3238 | 700 | glInfo.vendor = QString(reinterpret_cast<const char*>(glInfo.functions->glGetString(GL_VENDOR))); | ||
3239 | 701 | glInfo.renderer = QString(reinterpret_cast<const char*>(glInfo.functions->glGetString(GL_RENDERER))); | ||
3240 | 702 | |||
3241 | 553 | gui = new StelGui(); | 703 | gui = new StelGui(); |
3242 | 554 | 704 | ||
3250 | 555 | #if STEL_USE_NEW_OPENGL_WIDGETS | 705 | QSettings* conf = configuration; |
3244 | 556 | //glWidget->initializeGL(); // protected... | ||
3245 | 557 | //Q_ASSERT(glWidget->isValid()); | ||
3246 | 558 | #else | ||
3247 | 559 | Q_ASSERT(glWidget->isValid()); | ||
3248 | 560 | glWidget->makeCurrent(); | ||
3249 | 561 | #endif | ||
3251 | 562 | 706 | ||
3252 | 563 | // Should be check of requirements disabled? | 707 | // Should be check of requirements disabled? |
3253 | 564 | if (conf->value("main/check_requirements", true).toBool()) | 708 | if (conf->value("main/check_requirements", true).toBool()) |
3254 | 565 | { | 709 | { |
3255 | 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. |
3257 | 567 | processOpenGLdiagnosticsAndWarnings(conf, glWidget); | 711 | processOpenGLdiagnosticsAndWarnings(conf, QOpenGLContext::currentContext()); |
3258 | 568 | } | 712 | } |
3259 | 569 | 713 | ||
3262 | 570 | 714 | //create and initialize main app | |
3263 | 571 | stelApp= new StelApp(); | 715 | stelApp = new StelApp(this); |
3264 | 572 | stelApp->setGui(gui); | 716 | stelApp->setGui(gui); |
3265 | 573 | 717 | ||
3266 | 574 | stelApp->init(conf); | 718 | stelApp->init(conf); |
3267 | 719 | //this makes sure the app knows how large the window is | ||
3268 | 720 | connect(stelScene,SIGNAL(sceneRectChanged(QRectF)),stelApp,SLOT(glWindowHasBeenResized(QRectF))); | ||
3269 | 721 | //also immediately set the current values | ||
3270 | 722 | stelApp->glWindowHasBeenResized(stelScene->sceneRect()); | ||
3271 | 723 | |||
3272 | 575 | StelActionMgr *actionMgr = stelApp->getStelActionManager(); | 724 | StelActionMgr *actionMgr = stelApp->getStelActionManager(); |
3273 | 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"); |
3274 | 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"); |
3275 | 578 | 727 | ||
3276 | 579 | StelPainter::initGLShaders(); | 728 | StelPainter::initGLShaders(); |
3277 | 580 | 729 | ||
3288 | 581 | skyItem = new StelSkyItem(); | 730 | guiItem = new StelGuiItem(rootItem); |
3279 | 582 | guiItem = new StelGuiItem(); | ||
3280 | 583 | QGraphicsAnchorLayout* l = new QGraphicsAnchorLayout(rootItem); | ||
3281 | 584 | l->setSpacing(0); | ||
3282 | 585 | l->setContentsMargins(0,0,0,0); | ||
3283 | 586 | l->addCornerAnchors(skyItem, Qt::TopLeftCorner, l, Qt::TopLeftCorner); | ||
3284 | 587 | l->addCornerAnchors(skyItem, Qt::BottomRightCorner, l, Qt::BottomRightCorner); | ||
3285 | 588 | l->addCornerAnchors(guiItem, Qt::BottomLeftCorner, l, Qt::BottomLeftCorner); | ||
3286 | 589 | l->addCornerAnchors(guiItem, Qt::TopRightCorner, l, Qt::TopRightCorner); | ||
3287 | 590 | rootItem->setLayout(l); | ||
3289 | 591 | scene()->addItem(rootItem); | 731 | scene()->addItem(rootItem); |
3290 | 732 | //set the default focus to the sky | ||
3291 | 733 | focusSky(); | ||
3292 | 592 | nightModeEffect = new NightModeGraphicsEffect(this); | 734 | nightModeEffect = new NightModeGraphicsEffect(this); |
3293 | 593 | updateNightModeProperty(StelApp::getInstance().getVisionModeNight()); | 735 | updateNightModeProperty(StelApp::getInstance().getVisionModeNight()); |
3294 | 736 | //install the effect on the whole view | ||
3295 | 594 | rootItem->setGraphicsEffect(nightModeEffect); | 737 | rootItem->setGraphicsEffect(nightModeEffect); |
3296 | 595 | 738 | ||
3297 | 596 | QSize size = glWidget->windowHandle()->screen()->size(); | ||
3298 | 597 | size = QSize(conf->value("video/screen_w", size.width()).toInt(), | ||
3299 | 598 | conf->value("video/screen_h", size.height()).toInt()); | ||
3300 | 599 | |||
3301 | 600 | bool fullscreen = conf->value("video/fullscreen", true).toBool(); | ||
3302 | 601 | |||
3303 | 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??? | ||
3304 | 603 | resize(size); | ||
3305 | 604 | |||
3306 | 605 | QDesktopWidget *desktop = QApplication::desktop(); | 739 | QDesktopWidget *desktop = QApplication::desktop(); |
3307 | 606 | int screen = conf->value("video/screen_number", 0).toInt(); | 740 | int screen = conf->value("video/screen_number", 0).toInt(); |
3308 | 607 | if (screen < 0 || screen >= desktop->screenCount()) | 741 | if (screen < 0 || screen >= desktop->screenCount()) |
3309 | @@ -611,6 +745,14 @@ | |||
3310 | 611 | } | 745 | } |
3311 | 612 | QRect screenGeom = desktop->screenGeometry(screen); | 746 | QRect screenGeom = desktop->screenGeometry(screen); |
3312 | 613 | 747 | ||
3313 | 748 | QSize size = QSize(conf->value("video/screen_w", screenGeom.width()).toInt(), | ||
3314 | 749 | conf->value("video/screen_h", screenGeom.height()).toInt()); | ||
3315 | 750 | |||
3316 | 751 | bool fullscreen = conf->value("video/fullscreen", true).toBool(); | ||
3317 | 752 | |||
3318 | 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??? | ||
3319 | 754 | resize(size); | ||
3320 | 755 | |||
3321 | 614 | if (fullscreen) | 756 | if (fullscreen) |
3322 | 615 | { | 757 | { |
3323 | 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. |
3324 | @@ -632,26 +774,23 @@ | |||
3325 | 632 | flagInvertScreenShotColors = conf->value("main/invert_screenshots_colors", false).toBool(); | 774 | flagInvertScreenShotColors = conf->value("main/invert_screenshots_colors", false).toBool(); |
3326 | 633 | setFlagCursorTimeout(conf->value("gui/flag_mouse_cursor_timeout", false).toBool()); | 775 | setFlagCursorTimeout(conf->value("gui/flag_mouse_cursor_timeout", false).toBool()); |
3327 | 634 | setCursorTimeout(conf->value("gui/mouse_cursor_timeout", 10.f).toFloat()); | 776 | setCursorTimeout(conf->value("gui/mouse_cursor_timeout", 10.f).toFloat()); |
3331 | 635 | maxfps = conf->value("video/maximum_fps",10000.f).toFloat(); | 777 | setMaxFps(conf->value("video/maximum_fps",10000.f).toFloat()); |
3332 | 636 | minfps = conf->value("video/minimum_fps",10000.f).toFloat(); | 778 | setMinFps(conf->value("video/minimum_fps",10000.f).toFloat()); |
3330 | 637 | flagMaxFpsUpdatePending = false; | ||
3333 | 638 | 779 | ||
3334 | 639 | // XXX: This should be done in StelApp::init(), unfortunately for the moment we need to init the gui before the | 780 | // XXX: This should be done in StelApp::init(), unfortunately for the moment we need to init the gui before the |
3335 | 640 | // plugins, because the gui creates the QActions needed by some plugins. | 781 | // plugins, because the gui creates the QActions needed by some plugins. |
3340 | 641 | StelApp::getInstance().initPlugIns(); | 782 | stelApp->initPlugIns(); |
3337 | 642 | |||
3338 | 643 | // activate DE430/431 | ||
3339 | 644 | StelApp::getInstance().getCore()->initEphemeridesFunctions(); | ||
3341 | 645 | 783 | ||
3342 | 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. |
3344 | 647 | StelApp::getInstance().initScriptMgr(); | 785 | stelApp->initScriptMgr(); |
3345 | 648 | 786 | ||
3346 | 649 | // Set the global stylesheet, this is only useful for the tooltips. | 787 | // Set the global stylesheet, this is only useful for the tooltips. |
3348 | 650 | StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); | 788 | StelGui* gui = dynamic_cast<StelGui*>(stelApp->getGui()); |
3349 | 651 | if (gui!=NULL) | 789 | if (gui!=NULL) |
3350 | 652 | setStyleSheet(gui->getStelStyle().qtStyleSheet); | 790 | setStyleSheet(gui->getStelStyle().qtStyleSheet); |
3352 | 653 | connect(&StelApp::getInstance(), SIGNAL(visionNightModeChanged(bool)), this, SLOT(updateNightModeProperty(bool))); | 791 | connect(stelApp, SIGNAL(visionNightModeChanged(bool)), this, SLOT(updateNightModeProperty(bool))); |
3353 | 654 | 792 | ||
3354 | 793 | // I doubt this will have any effect on framerate, but may cause problems elsewhere? | ||
3355 | 655 | QThread::currentThread()->setPriority(QThread::HighestPriority); | 794 | QThread::currentThread()->setPriority(QThread::HighestPriority); |
3356 | 656 | #ifndef NDEBUG | 795 | #ifndef NDEBUG |
3357 | 657 | // Get an overview of module callOrders | 796 | // Get an overview of module callOrders |
3358 | @@ -664,7 +803,6 @@ | |||
3359 | 664 | StelApp::getInstance().dumpModuleActionPriorities(StelModule::ActionHandleKeys); | 803 | StelApp::getInstance().dumpModuleActionPriorities(StelModule::ActionHandleKeys); |
3360 | 665 | } | 804 | } |
3361 | 666 | #endif | 805 | #endif |
3362 | 667 | startMainLoop(); | ||
3363 | 668 | } | 806 | } |
3364 | 669 | 807 | ||
3365 | 670 | void StelMainView::updateNightModeProperty(bool b) | 808 | void StelMainView::updateNightModeProperty(bool b) |
3366 | @@ -680,17 +818,11 @@ | |||
3367 | 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. |
3368 | 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. |
3369 | 682 | // Several tests do not apply to MacOS X. | 820 | // Several tests do not apply to MacOS X. |
3375 | 683 | #if STEL_USE_NEW_OPENGL_WIDGETS | 821 | void StelMainView::processOpenGLdiagnosticsAndWarnings(QSettings *conf, QOpenGLContext *context) const |
3371 | 684 | void StelMainView::processOpenGLdiagnosticsAndWarnings(QSettings *conf, StelQOpenGLWidget* glWidget) const | ||
3372 | 685 | #else | ||
3373 | 686 | void StelMainView::processOpenGLdiagnosticsAndWarnings(QSettings *conf, StelQGLWidget* glWidget) const | ||
3374 | 687 | #endif | ||
3376 | 688 | { | 822 | { |
3377 | 689 | #ifdef Q_OS_MAC | 823 | #ifdef Q_OS_MAC |
3378 | 690 | Q_UNUSED(conf); | 824 | Q_UNUSED(conf); |
3379 | 691 | #endif | 825 | #endif |
3380 | 692 | |||
3381 | 693 | QOpenGLContext* context=glWidget->context()->contextHandle(); | ||
3382 | 694 | QSurfaceFormat format=context->format(); | 826 | QSurfaceFormat format=context->format(); |
3383 | 695 | 827 | ||
3384 | 696 | // These tests are not required on MacOS X | 828 | // These tests are not required on MacOS X |
3385 | @@ -706,12 +838,13 @@ | |||
3386 | 706 | qDebug() << "Neither OpenGL nor OpenGL ES detected: Unsupported Format!"; | 838 | qDebug() << "Neither OpenGL nor OpenGL ES detected: Unsupported Format!"; |
3387 | 707 | } | 839 | } |
3388 | 708 | #endif | 840 | #endif |
3389 | 841 | QOpenGLFunctions* gl = context->functions(); | ||
3390 | 709 | 842 | ||
3392 | 710 | QString glDriver(reinterpret_cast<const char*>(glGetString(GL_VERSION))); | 843 | QString glDriver(reinterpret_cast<const char*>(gl->glGetString(GL_VERSION))); |
3393 | 711 | qDebug() << "Driver version string:" << glDriver; | 844 | qDebug() << "Driver version string:" << glDriver; |
3397 | 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))); |
3398 | 713 | QString glRenderer(reinterpret_cast<const char*>(glGetString(GL_RENDERER))); | 846 | QString glRenderer(reinterpret_cast<const char*>(gl->glGetString(GL_RENDERER))); |
3399 | 714 | qDebug() << "GL renderer is" << glRenderer; | 847 | qDebug() << "GL renderer is" << glRenderer; |
3400 | 715 | 848 | ||
3401 | 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). |
3402 | 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 hardware | 850 | // 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 |
3403 | @@ -739,7 +872,7 @@ | |||
3404 | 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."; |
3405 | 740 | 873 | ||
3406 | 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); |
3408 | 742 | #else | 875 | #else |
3409 | 743 | qWarning() << "Oops... Insufficient OpenGL version. Please update drivers, or graphics hardware."; | 876 | qWarning() << "Oops... Insufficient OpenGL version. Please update drivers, or graphics hardware."; |
3410 | 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); |
3411 | 745 | #endif | 878 | #endif |
3412 | @@ -747,7 +880,7 @@ | |||
3413 | 747 | } | 880 | } |
3414 | 748 | #endif | 881 | #endif |
3415 | 749 | // This call requires OpenGL2+. | 882 | // This call requires OpenGL2+. |
3417 | 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))); |
3418 | 751 | qDebug() << "GL Shading Language version is" << glslString; | 884 | qDebug() << "GL Shading Language version is" << glslString; |
3419 | 752 | 885 | ||
3420 | 753 | // Only give extended info if called on command line, for diagnostic. | 886 | // Only give extended info if called on command line, for diagnostic. |
3421 | @@ -1034,6 +1167,7 @@ | |||
3422 | 1034 | 1167 | ||
3423 | 1035 | void StelMainView::deinit() | 1168 | void StelMainView::deinit() |
3424 | 1036 | { | 1169 | { |
3425 | 1170 | glContextMakeCurrent(); | ||
3426 | 1037 | deinitGL(); | 1171 | deinitGL(); |
3427 | 1038 | delete stelApp; | 1172 | delete stelApp; |
3428 | 1039 | stelApp = NULL; | 1173 | stelApp = NULL; |
3429 | @@ -1057,7 +1191,7 @@ | |||
3430 | 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. |
3431 | 1058 | if ( (x()<0) && (y()<0)) | 1192 | if ( (x()<0) && (y()<0)) |
3432 | 1059 | { | 1193 | { |
3434 | 1060 | QSettings *conf = StelApp::getInstance().getSettings(); | 1194 | QSettings *conf = stelApp->getSettings(); |
3435 | 1061 | QDesktopWidget *desktop = QApplication::desktop(); | 1195 | QDesktopWidget *desktop = QApplication::desktop(); |
3436 | 1062 | int screen = conf->value("video/screen_number", 0).toInt(); | 1196 | int screen = conf->value("video/screen_number", 0).toInt(); |
3437 | 1063 | if (screen < 0 || screen >= desktop->screenCount()) | 1197 | if (screen < 0 || screen >= desktop->screenCount()) |
3438 | @@ -1074,118 +1208,66 @@ | |||
3439 | 1074 | emit fullScreenChanged(b); | 1208 | emit fullScreenChanged(b); |
3440 | 1075 | } | 1209 | } |
3441 | 1076 | 1210 | ||
3448 | 1077 | void StelMainView::updateScene() { | 1211 | void StelMainView::drawEnded() |
3449 | 1078 | // For some reason the skyItem is not updated when the night mode shader is on. | 1212 | { |
3450 | 1079 | // To fix this we manually do it here. | 1213 | updateQueued = false; |
3451 | 1080 | skyItem->update(); | 1214 | |
3452 | 1081 | scene()->update(); | 1215 | //requeue the next draw |
3453 | 1082 | } | 1216 | if(needsMaxFPS()) |
3454 | 1217 | { | ||
3455 | 1218 | updateQueued = true; | ||
3456 | 1219 | minFpsTimer->stop(); | ||
3457 | 1220 | glWidget->update(); | ||
3458 | 1221 | } | ||
3459 | 1222 | else | ||
3460 | 1223 | { | ||
3461 | 1224 | if(!minFpsTimer->isActive()) | ||
3462 | 1225 | minFpsTimer->start(); | ||
3463 | 1226 | } | ||
3464 | 1227 | } | ||
3465 | 1228 | |||
3466 | 1229 | void StelMainView::minFPSUpdate() | ||
3467 | 1230 | { | ||
3468 | 1231 | if(!updateQueued) | ||
3469 | 1232 | { | ||
3470 | 1233 | updateQueued = true; | ||
3471 | 1234 | //qDebug()<<"minFPSUpdate"; | ||
3472 | 1235 | glWidget->update(); | ||
3473 | 1236 | } | ||
3474 | 1237 | else | ||
3475 | 1238 | { | ||
3476 | 1239 | //qDebug()<<"double update"; | ||
3477 | 1240 | } | ||
3478 | 1241 | } | ||
3479 | 1242 | |||
3480 | 1243 | #ifdef OPENGL_DEBUG_LOGGING | ||
3481 | 1244 | void StelMainView::logGLMessage(const QOpenGLDebugMessage &debugMessage) | ||
3482 | 1245 | { | ||
3483 | 1246 | qDebug()<<debugMessage; | ||
3484 | 1247 | } | ||
3485 | 1248 | |||
3486 | 1249 | void StelMainView::contextDestroyed() | ||
3487 | 1250 | { | ||
3488 | 1251 | qDebug()<<"Main OpenGL context destroyed"; | ||
3489 | 1252 | } | ||
3490 | 1253 | #endif | ||
3491 | 1083 | 1254 | ||
3492 | 1084 | void StelMainView::thereWasAnEvent() | 1255 | void StelMainView::thereWasAnEvent() |
3493 | 1085 | { | 1256 | { |
3494 | 1257 | //qDebug()<<"event"; | ||
3495 | 1086 | lastEventTimeSec = StelApp::getTotalRunTime(); | 1258 | lastEventTimeSec = StelApp::getTotalRunTime(); |
3496 | 1087 | } | 1259 | } |
3497 | 1088 | 1260 | ||
3505 | 1089 | void StelMainView::maxFpsSceneUpdate() | 1261 | bool StelMainView::needsMaxFPS() const |
3499 | 1090 | { | ||
3500 | 1091 | updateScene(); | ||
3501 | 1092 | flagMaxFpsUpdatePending = false; | ||
3502 | 1093 | } | ||
3503 | 1094 | |||
3504 | 1095 | void StelMainView::drawBackground(QPainter*, const QRectF&) | ||
3506 | 1096 | { | 1262 | { |
3507 | 1097 | const double now = StelApp::getTotalRunTime(); | 1263 | const double now = StelApp::getTotalRunTime(); |
3508 | 1098 | const double JD_SECOND=0.000011574074074074074074; | ||
3509 | 1099 | 1264 | ||
3510 | 1100 | // Determines when the next display will need to be triggered | 1265 | // Determines when the next display will need to be triggered |
3511 | 1101 | // The current policy is that after an event, the FPS is maximum for 2.5 seconds | 1266 | // The current policy is that after an event, the FPS is maximum for 2.5 seconds |
3512 | 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. |
3513 | 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. |
3599 | 1104 | const float timeRate = StelApp::getInstance().getCore()->getTimeRate(); | 1269 | const float timeRate = stelApp->getCore()->getTimeRate(); |
3600 | 1105 | const bool needMaxFps = (now - lastEventTimeSec < 2.5) || fabs(timeRate) > JD_SECOND; | 1270 | return (now - lastEventTimeSec < 2.5) || fabs(timeRate) > StelCore::JD_SECOND; |
3516 | 1106 | if (needMaxFps) | ||
3517 | 1107 | { | ||
3518 | 1108 | if (!flagMaxFpsUpdatePending) | ||
3519 | 1109 | { | ||
3520 | 1110 | double duration = 1./getMaxFps(); | ||
3521 | 1111 | int dur = (int)(duration*1000); | ||
3522 | 1112 | |||
3523 | 1113 | if (minFpsTimer!=NULL) | ||
3524 | 1114 | { | ||
3525 | 1115 | disconnect(minFpsTimer, SIGNAL(timeout()), 0, 0); | ||
3526 | 1116 | delete minFpsTimer; | ||
3527 | 1117 | minFpsTimer = NULL; | ||
3528 | 1118 | } | ||
3529 | 1119 | flagMaxFpsUpdatePending = true; | ||
3530 | 1120 | QTimer::singleShot(dur<5 ? 5 : dur, this, SLOT(maxFpsSceneUpdate())); | ||
3531 | 1121 | } | ||
3532 | 1122 | } else if (minFpsTimer == NULL) { | ||
3533 | 1123 | // Restart the minfps timer | ||
3534 | 1124 | minFpsChanged(); | ||
3535 | 1125 | } | ||
3536 | 1126 | |||
3537 | 1127 | // Manage cursor timeout | ||
3538 | 1128 | if (cursorTimeout>0.f && (now-lastEventTimeSec>cursorTimeout) && flagCursorTimeout) | ||
3539 | 1129 | { | ||
3540 | 1130 | if (QGuiApplication::overrideCursor()==0) | ||
3541 | 1131 | QGuiApplication::setOverrideCursor(Qt::BlankCursor); | ||
3542 | 1132 | } | ||
3543 | 1133 | else | ||
3544 | 1134 | { | ||
3545 | 1135 | if (QGuiApplication::overrideCursor()!=0) | ||
3546 | 1136 | QGuiApplication::restoreOverrideCursor(); | ||
3547 | 1137 | } | ||
3548 | 1138 | } | ||
3549 | 1139 | |||
3550 | 1140 | void StelMainView::startMainLoop() | ||
3551 | 1141 | { | ||
3552 | 1142 | // Set a timer refreshing for every minfps frames | ||
3553 | 1143 | minFpsChanged(); | ||
3554 | 1144 | } | ||
3555 | 1145 | |||
3556 | 1146 | void StelMainView::minFpsChanged() | ||
3557 | 1147 | { | ||
3558 | 1148 | if (minFpsTimer!=NULL) | ||
3559 | 1149 | { | ||
3560 | 1150 | disconnect(minFpsTimer, SIGNAL(timeout()), 0, 0); | ||
3561 | 1151 | delete minFpsTimer; | ||
3562 | 1152 | minFpsTimer = NULL; | ||
3563 | 1153 | } | ||
3564 | 1154 | |||
3565 | 1155 | minFpsTimer = new QTimer(this); | ||
3566 | 1156 | connect(minFpsTimer, SIGNAL(timeout()), this, SLOT(updateScene())); | ||
3567 | 1157 | |||
3568 | 1158 | minFpsTimer->start((int)(1./getMinFps()*1000.)); | ||
3569 | 1159 | } | ||
3570 | 1160 | |||
3571 | 1161 | |||
3572 | 1162 | |||
3573 | 1163 | void StelMainView::mouseMoveEvent(QMouseEvent* event) | ||
3574 | 1164 | { | ||
3575 | 1165 | // We notify the application to increase the fps if a button has been | ||
3576 | 1166 | // clicked, but also if the cursor is currently hidden, so that it gets | ||
3577 | 1167 | // restored. | ||
3578 | 1168 | if (event->buttons() || QGuiApplication::overrideCursor()!=0) | ||
3579 | 1169 | thereWasAnEvent(); // Refresh screen ASAP | ||
3580 | 1170 | QGraphicsView::mouseMoveEvent(event); | ||
3581 | 1171 | } | ||
3582 | 1172 | |||
3583 | 1173 | void StelMainView::mousePressEvent(QMouseEvent* event) | ||
3584 | 1174 | { | ||
3585 | 1175 | thereWasAnEvent(); // Refresh screen ASAP | ||
3586 | 1176 | QGraphicsView::mousePressEvent(event); | ||
3587 | 1177 | } | ||
3588 | 1178 | |||
3589 | 1179 | void StelMainView::mouseReleaseEvent(QMouseEvent* event) | ||
3590 | 1180 | { | ||
3591 | 1181 | thereWasAnEvent(); // Refresh screen ASAP | ||
3592 | 1182 | QGraphicsView::mouseReleaseEvent(event); | ||
3593 | 1183 | } | ||
3594 | 1184 | |||
3595 | 1185 | void StelMainView::wheelEvent(QWheelEvent* event) | ||
3596 | 1186 | { | ||
3597 | 1187 | thereWasAnEvent(); // Refresh screen ASAP | ||
3598 | 1188 | QGraphicsView::wheelEvent(event); | ||
3601 | 1189 | } | 1271 | } |
3602 | 1190 | 1272 | ||
3603 | 1191 | void StelMainView::moveEvent(QMoveEvent * event) | 1273 | void StelMainView::moveEvent(QMoveEvent * event) |
3604 | @@ -1193,38 +1275,21 @@ | |||
3605 | 1193 | Q_UNUSED(event); | 1275 | Q_UNUSED(event); |
3606 | 1194 | 1276 | ||
3607 | 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. |
3609 | 1196 | StelApp::getInstance().setDevicePixelsPerPixel(glWidget->windowHandle()->devicePixelRatio()); | 1278 | QWindow* win = glWidget->windowHandle(); |
3610 | 1279 | if(win) | ||
3611 | 1280 | stelApp->setDevicePixelsPerPixel(win->devicePixelRatio()); | ||
3612 | 1197 | } | 1281 | } |
3613 | 1198 | 1282 | ||
3614 | 1199 | void StelMainView::closeEvent(QCloseEvent* event) | 1283 | void StelMainView::closeEvent(QCloseEvent* event) |
3615 | 1200 | { | 1284 | { |
3616 | 1201 | Q_UNUSED(event); | 1285 | Q_UNUSED(event); |
3638 | 1202 | StelApp::getInstance().quit(); | 1286 | stelApp->quit(); |
3639 | 1203 | } | 1287 | } |
3619 | 1204 | |||
3620 | 1205 | void StelMainView::keyPressEvent(QKeyEvent* event) | ||
3621 | 1206 | { | ||
3622 | 1207 | thereWasAnEvent(); // Refresh screen ASAP | ||
3623 | 1208 | // Try to trigger a gobal shortcut. | ||
3624 | 1209 | StelActionMgr* actionMgr = StelApp::getInstance().getStelActionManager(); | ||
3625 | 1210 | if (actionMgr->pushKey(event->key() + event->modifiers(), true)) { | ||
3626 | 1211 | event->setAccepted(true); | ||
3627 | 1212 | return; | ||
3628 | 1213 | } | ||
3629 | 1214 | QGraphicsView::keyPressEvent(event); | ||
3630 | 1215 | } | ||
3631 | 1216 | |||
3632 | 1217 | void StelMainView::keyReleaseEvent(QKeyEvent* event) | ||
3633 | 1218 | { | ||
3634 | 1219 | thereWasAnEvent(); // Refresh screen ASAP | ||
3635 | 1220 | QGraphicsView::keyReleaseEvent(event); | ||
3636 | 1221 | } | ||
3637 | 1222 | |||
3640 | 1223 | 1288 | ||
3641 | 1224 | //! Delete openGL textures (to call before the GLContext disappears) | 1289 | //! Delete openGL textures (to call before the GLContext disappears) |
3642 | 1225 | void StelMainView::deinitGL() | 1290 | void StelMainView::deinitGL() |
3643 | 1226 | { | 1291 | { |
3645 | 1227 | StelApp::getInstance().deinit(); | 1292 | stelApp->deinit(); |
3646 | 1228 | delete gui; | 1293 | delete gui; |
3647 | 1229 | gui = NULL; | 1294 | gui = NULL; |
3648 | 1230 | } | 1295 | } |
3649 | @@ -1240,11 +1305,12 @@ | |||
3650 | 1240 | void StelMainView::doScreenshot(void) | 1305 | void StelMainView::doScreenshot(void) |
3651 | 1241 | { | 1306 | { |
3652 | 1242 | QFileInfo shotDir; | 1307 | QFileInfo shotDir; |
3654 | 1243 | #if STEL_USE_NEW_OPENGL_WIDGETS | 1308 | #ifdef USE_OLD_QGLWIDGET |
3655 | 1309 | QImage im = glWidget->grabFrameBuffer(); | ||
3656 | 1310 | #else | ||
3657 | 1244 | QImage im = glWidget->grabFramebuffer(); | 1311 | QImage im = glWidget->grabFramebuffer(); |
3658 | 1245 | #else | ||
3659 | 1246 | QImage im = glWidget->grabFrameBuffer(); | ||
3660 | 1247 | #endif | 1312 | #endif |
3661 | 1313 | |||
3662 | 1248 | if (flagInvertScreenShotColors) | 1314 | if (flagInvertScreenShotColors) |
3663 | 1249 | im.invertPixels(); | 1315 | im.invertPixels(); |
3664 | 1250 | 1316 | ||
3665 | @@ -1289,7 +1355,21 @@ | |||
3666 | 1289 | return glWidget->mapFromGlobal(QCursor::pos()); | 1355 | return glWidget->mapFromGlobal(QCursor::pos()); |
3667 | 1290 | } | 1356 | } |
3668 | 1291 | 1357 | ||
3672 | 1292 | void StelMainView::setFocusOnSky() | 1358 | QOpenGLContext* StelMainView::glContext() const |
3673 | 1293 | { | 1359 | { |
3674 | 1294 | skyItem->setFocus(); | 1360 | #ifdef USE_OLD_QGLWIDGET |
3675 | 1361 | return glWidget->context()->contextHandle(); | ||
3676 | 1362 | #else | ||
3677 | 1363 | return glWidget->context(); | ||
3678 | 1364 | #endif | ||
3679 | 1365 | } | ||
3680 | 1366 | |||
3681 | 1367 | void StelMainView::glContextMakeCurrent() | ||
3682 | 1368 | { | ||
3683 | 1369 | glWidget->makeCurrent(); | ||
3684 | 1370 | } | ||
3685 | 1371 | |||
3686 | 1372 | void StelMainView::glContextDoneCurrent() | ||
3687 | 1373 | { | ||
3688 | 1374 | glWidget->doneCurrent(); | ||
3689 | 1295 | } | 1375 | } |
3690 | 1296 | 1376 | ||
3691 | === modified file 'src/StelMainView.hpp' | |||
3692 | --- src/StelMainView.hpp 2016-12-10 10:33:35 +0000 | |||
3693 | +++ src/StelMainView.hpp 2017-01-12 21:08:38 +0000 | |||
3694 | @@ -24,19 +24,13 @@ | |||
3695 | 24 | #include <QGraphicsView> | 24 | #include <QGraphicsView> |
3696 | 25 | #include <QEventLoop> | 25 | #include <QEventLoop> |
3697 | 26 | #include <QOpenGLContext> | 26 | #include <QOpenGLContext> |
3710 | 27 | 27 | #include <QTimer> | |
3711 | 28 | // This define (only used here and in StelMainView.cpp) is temporarily used | 28 | #ifdef OPENGL_DEBUG_LOGGING |
3712 | 29 | // to allow uncompromised compiling while the migration to the new QOpenGL... classes | 29 | #include <QOpenGLDebugMessage> |
3701 | 30 | // has not been done. As soon as Qt5.4 is out, we should finish this migration process! | ||
3702 | 31 | #define STEL_USE_NEW_OPENGL_WIDGETS 0 | ||
3703 | 32 | |||
3704 | 33 | #if STEL_USE_NEW_OPENGL_WIDGETS | ||
3705 | 34 | class QOpenGLWidget; | ||
3706 | 35 | class StelQOpenGLWidget; | ||
3707 | 36 | #else | ||
3708 | 37 | class QGLWidget; | ||
3709 | 38 | class StelQGLWidget; | ||
3713 | 39 | #endif | 30 | #endif |
3714 | 31 | |||
3715 | 32 | class StelGLWidget; | ||
3716 | 33 | class StelGraphicsScene; | ||
3717 | 40 | class QMoveEvent; | 34 | class QMoveEvent; |
3718 | 41 | class QResizeEvent; | 35 | class QResizeEvent; |
3719 | 42 | class StelGuiBase; | 36 | class StelGuiBase; |
3720 | @@ -49,16 +43,27 @@ | |||
3721 | 49 | class StelMainView : public QGraphicsView | 43 | class StelMainView : public QGraphicsView |
3722 | 50 | { | 44 | { |
3723 | 51 | friend class StelGuiItem; | 45 | friend class StelGuiItem; |
3725 | 52 | friend class StelSkyItem; | 46 | friend class StelRootItem; |
3726 | 47 | friend class StelGraphicsScene; | ||
3727 | 48 | friend class NightModeGraphicsEffect; | ||
3728 | 53 | Q_OBJECT | 49 | Q_OBJECT |
3729 | 54 | Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged) | 50 | Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged) |
3730 | 55 | 51 | ||
3731 | 56 | public: | 52 | public: |
3733 | 57 | StelMainView(QWidget* parent = NULL); | 53 | //! Contains some basic info about the OpenGL context used |
3734 | 54 | struct GLInfo | ||
3735 | 55 | { | ||
3736 | 56 | QString vendor; | ||
3737 | 57 | QString renderer; | ||
3738 | 58 | QOpenGLContext* mainContext; | ||
3739 | 59 | QOpenGLFunctions* functions; | ||
3740 | 60 | }; | ||
3741 | 61 | |||
3742 | 62 | StelMainView(QSettings* settings); | ||
3743 | 58 | virtual ~StelMainView(); | 63 | virtual ~StelMainView(); |
3744 | 59 | 64 | ||
3745 | 60 | //! Start the main initialization of Stellarium | 65 | //! Start the main initialization of Stellarium |
3747 | 61 | void init(class QSettings* conf); | 66 | void init(); |
3748 | 62 | void deinit(); | 67 | void deinit(); |
3749 | 63 | 68 | ||
3750 | 64 | //! Set the application title for the current language. | 69 | //! Set the application title for the current language. |
3751 | @@ -70,20 +75,33 @@ | |||
3752 | 70 | 75 | ||
3753 | 71 | //! Delete openGL textures (to call before the GLContext disappears) | 76 | //! Delete openGL textures (to call before the GLContext disappears) |
3754 | 72 | void deinitGL(); | 77 | void deinitGL(); |
3757 | 73 | //! Return focus to the sky item. To be used when we close a dialog. | 78 | |
3756 | 74 | void focusSky(); | ||
3758 | 75 | //! Return the parent gui widget, this should be used as parent to all | 79 | //! Return the parent gui widget, this should be used as parent to all |
3759 | 76 | //! the StelDialog instances. | 80 | //! the StelDialog instances. |
3760 | 77 | QGraphicsWidget* getGuiWidget() const {return guiItem;} | 81 | QGraphicsWidget* getGuiWidget() const {return guiItem;} |
3761 | 78 | //! Return mouse position coordinates | 82 | //! Return mouse position coordinates |
3762 | 79 | QPoint getMousePos(); | 83 | QPoint getMousePos(); |
3763 | 84 | |||
3764 | 85 | //! Returns the main application OpenGL context, | ||
3765 | 86 | //! which should be used for all drawing Stellarium does | ||
3766 | 87 | //! @sa glContextMakeCurrent() | ||
3767 | 88 | //! @sa glContextDoneCurrent() | ||
3768 | 89 | QOpenGLContext* glContext() const; | ||
3769 | 90 | //! Make the main GL context (the one returned from glContext()) current | ||
3770 | 91 | //! on the main view surface | ||
3771 | 92 | void glContextMakeCurrent(); | ||
3772 | 93 | //! Releases the main GL context | ||
3773 | 94 | void glContextDoneCurrent(); | ||
3774 | 95 | |||
3775 | 96 | //! Returns the information about the GL context, this does not require the context to be active. | ||
3776 | 97 | GLInfo getGLInformation() const { return glInfo; } | ||
3777 | 80 | public slots: | 98 | public slots: |
3778 | 81 | 99 | ||
3779 | 82 | //! Set whether fullscreen is activated or not | 100 | //! Set whether fullscreen is activated or not |
3780 | 83 | void setFullScreen(bool); | 101 | void setFullScreen(bool); |
3781 | 84 | 102 | ||
3784 | 85 | //! Set focus on the sky | 103 | //! Return focus to the sky item. To be used when we close a dialog. |
3785 | 86 | void setFocusOnSky(); | 104 | void focusSky(); |
3786 | 87 | 105 | ||
3787 | 88 | /////////////////////////////////////////////////////////////////////////// | 106 | /////////////////////////////////////////////////////////////////////////// |
3788 | 89 | // Specific methods | 107 | // Specific methods |
3789 | @@ -119,82 +137,86 @@ | |||
3790 | 119 | //! user events for some seconds to save power. However, if can be useful to set this to a high | 137 | //! user events for some seconds to save power. However, if can be useful to set this to a high |
3791 | 120 | //! value to improve playing smoothness in scripts. | 138 | //! value to improve playing smoothness in scripts. |
3792 | 121 | //! @param m the new minimum fps setting. | 139 | //! @param m the new minimum fps setting. |
3794 | 122 | void setMinFps(float m) {minfps=m; minFpsChanged();} | 140 | void setMinFps(float m) {minfps=m; minFpsTimer->setInterval(1000/minfps);} |
3795 | 123 | //! Get the current minimum frames per second. | 141 | //! Get the current minimum frames per second. |
3796 | 124 | float getMinFps() {return minfps;} | 142 | float getMinFps() {return minfps;} |
3797 | 125 | //! Set the maximum frames per second. | 143 | //! Set the maximum frames per second. |
3798 | 126 | //! @param m the new maximum fps setting. | 144 | //! @param m the new maximum fps setting. |
3799 | 145 | //! @todo this setting currently does nothing | ||
3800 | 127 | void setMaxFps(float m) {maxfps = m;} | 146 | void setMaxFps(float m) {maxfps = m;} |
3801 | 128 | //! Get the current maximum frames per second. | 147 | //! Get the current maximum frames per second. |
3802 | 129 | float getMaxFps() {return maxfps;} | 148 | float getMaxFps() {return maxfps;} |
3803 | 130 | 149 | ||
3804 | 131 | void maxFpsSceneUpdate(); | ||
3805 | 132 | //! Updates the scene and process all events | ||
3806 | 133 | void updateScene(); | ||
3807 | 134 | |||
3808 | 135 | //! Notify that an event was handled by the program and therefore the | 150 | //! Notify that an event was handled by the program and therefore the |
3809 | 136 | //! FPS should be maximized for a couple of seconds. | 151 | //! FPS should be maximized for a couple of seconds. |
3810 | 137 | void thereWasAnEvent(); | 152 | void thereWasAnEvent(); |
3811 | 138 | 153 | ||
3812 | 154 | //! Determines if we should render as fast as possible, | ||
3813 | 155 | //! or limit the FPS. This depends on the time the last user event | ||
3814 | 156 | //! happened. | ||
3815 | 157 | bool needsMaxFPS() const; | ||
3816 | 158 | |||
3817 | 139 | protected: | 159 | protected: |
3832 | 140 | virtual void mouseMoveEvent(QMouseEvent* event); | 160 | //! Hack to determine current monitor pixel ratio |
3833 | 141 | virtual void mousePressEvent(QMouseEvent* event); | 161 | //! @todo Find a better way to handle this |
3834 | 142 | virtual void mouseReleaseEvent(QMouseEvent* event); | 162 | virtual void moveEvent(QMoveEvent* event) Q_DECL_OVERRIDE; |
3835 | 143 | virtual void keyPressEvent(QKeyEvent* event); | 163 | //! Handle window closed event, calling StelApp::quit() |
3836 | 144 | virtual void keyReleaseEvent(QKeyEvent* event); | 164 | virtual void closeEvent(QCloseEvent* event) Q_DECL_OVERRIDE; |
3837 | 145 | virtual void wheelEvent(QWheelEvent* wheelEvent); | 165 | //! Handle window resized events, and change the size of the underlying |
3838 | 146 | virtual void moveEvent(QMoveEvent* event); | 166 | //! QGraphicsScene to be the same |
3839 | 147 | virtual void closeEvent(QCloseEvent* event); | 167 | virtual void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE; |
3826 | 148 | virtual void resizeEvent(QResizeEvent* event); | ||
3827 | 149 | |||
3828 | 150 | //! Update the mouse pointer state and schedule next redraw. | ||
3829 | 151 | //! This method is called automatically by Qt. | ||
3830 | 152 | virtual void drawBackground(QPainter* painter, const QRectF &rect); | ||
3831 | 153 | |||
3840 | 154 | signals: | 168 | signals: |
3841 | 155 | //! emitted when saveScreenShot is requested with saveScreenShot(). | 169 | //! emitted when saveScreenShot is requested with saveScreenShot(). |
3842 | 156 | //! doScreenshot() does the actual work (it has to do it in the main | 170 | //! doScreenshot() does the actual work (it has to do it in the main |
3843 | 157 | //! thread, where as saveScreenShot() might get called from another one. | 171 | //! thread, where as saveScreenShot() might get called from another one. |
3844 | 172 | //! | ||
3845 | 173 | //! @remark FS: is threaded access here even a possibility anymore, or a remnant of older code? | ||
3846 | 158 | void screenshotRequested(void); | 174 | void screenshotRequested(void); |
3847 | 159 | void fullScreenChanged(bool b); | 175 | void fullScreenChanged(bool b); |
3848 | 160 | |||
3849 | 161 | private slots: | 176 | private slots: |
3850 | 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. |
3851 | 163 | void doScreenshot(void); | 178 | void doScreenshot(void); |
3853 | 164 | void minFpsChanged(); | 179 | void minFPSUpdate(); |
3854 | 180 | #ifdef OPENGL_DEBUG_LOGGING | ||
3855 | 181 | void logGLMessage(const QOpenGLDebugMessage& debugMessage); | ||
3856 | 182 | void contextDestroyed(); | ||
3857 | 183 | #endif | ||
3858 | 165 | void updateNightModeProperty(bool b); | 184 | void updateNightModeProperty(bool b); |
3859 | 166 | 185 | ||
3860 | 167 | private: | 186 | private: |
3864 | 168 | //! Start the display loop | 187 | //! The graphics scene notifies us when a draw finished, so that we can queue the next one |
3865 | 169 | void startMainLoop(); | 188 | void drawEnded(); |
3866 | 170 | 189 | //! Returns the desired OpenGL format settings, | |
3867 | 190 | //! on desktop this corresponds to a GL 2.1 context, | ||
3868 | 191 | //! with 32bit RGBA buffer and 24/8 depth/stencil buffer | ||
3869 | 192 | QSurfaceFormat getDesiredGLFormat() const; | ||
3870 | 171 | //! provide extended OpenGL diagnostics in logfile. | 193 | //! provide extended OpenGL diagnostics in logfile. |
3871 | 172 | void dumpOpenGLdiagnostics() const; | 194 | void dumpOpenGLdiagnostics() const; |
3872 | 173 | //! Startup diagnostics, providing test for various circumstances of bad OS/OpenGL driver combinations | 195 | //! Startup diagnostics, providing test for various circumstances of bad OS/OpenGL driver combinations |
3873 | 174 | //! to provide feedback to the user about bad OpenGL drivers. | 196 | //! to provide feedback to the user about bad OpenGL drivers. |
3879 | 175 | #if STEL_USE_NEW_OPENGL_WIDGETS | 197 | void processOpenGLdiagnosticsAndWarnings(QSettings *conf, QOpenGLContext* context) const; |
3875 | 176 | void processOpenGLdiagnosticsAndWarnings(QSettings *conf, StelQOpenGLWidget* glWidget) const; | ||
3876 | 177 | #else | ||
3877 | 178 | void processOpenGLdiagnosticsAndWarnings(QSettings *conf, StelQGLWidget* glWidget) const; | ||
3878 | 179 | #endif | ||
3880 | 180 | 198 | ||
3881 | 181 | //! The StelMainView singleton | 199 | //! The StelMainView singleton |
3882 | 182 | static StelMainView* singleton; | 200 | static StelMainView* singleton; |
3883 | 183 | 201 | ||
3886 | 184 | QGraphicsWidget* rootItem; | 202 | GLInfo glInfo; |
3887 | 185 | QGraphicsWidget* skyItem; | 203 | |
3888 | 204 | QSettings* configuration; | ||
3889 | 205 | |||
3890 | 206 | class StelRootItem* rootItem; | ||
3891 | 186 | QGraphicsWidget* guiItem; | 207 | QGraphicsWidget* guiItem; |
3892 | 187 | QGraphicsEffect* nightModeEffect; | 208 | QGraphicsEffect* nightModeEffect; |
3893 | 188 | 209 | ||
3900 | 189 | //! The openGL window | 210 | //! The openGL viewport of the graphics scene |
3901 | 190 | #if STEL_USE_NEW_OPENGL_WIDGETS | 211 | //! Responsible for main GL setup, rendering is done in the scene background |
3902 | 191 | StelQOpenGLWidget* glWidget; | 212 | StelGLWidget* glWidget; |
3903 | 192 | #else | 213 | //! Custom QGraphicsScene, this renders our scene background |
3904 | 193 | StelQGLWidget* glWidget; | 214 | StelGraphicsScene* stelScene; |
3905 | 194 | #endif | 215 | |
3906 | 195 | StelGuiBase* gui; | 216 | StelGuiBase* gui; |
3907 | 196 | class StelApp* stelApp; | 217 | class StelApp* stelApp; |
3908 | 197 | 218 | ||
3909 | 219 | bool updateQueued; | ||
3910 | 198 | bool flagInvertScreenShotColors; | 220 | bool flagInvertScreenShotColors; |
3911 | 199 | bool flagOverwriteScreenshots; //! if set to true, screenshot is named exactly screenShotPrefix.png and overwrites existing file | 221 | bool flagOverwriteScreenshots; //! if set to true, screenshot is named exactly screenShotPrefix.png and overwrites existing file |
3912 | 200 | 222 | ||
3913 | @@ -207,12 +229,15 @@ | |||
3914 | 207 | 229 | ||
3915 | 208 | double lastEventTimeSec; | 230 | double lastEventTimeSec; |
3916 | 209 | 231 | ||
3917 | 210 | QTimer* minFpsTimer; | ||
3918 | 211 | bool flagMaxFpsUpdatePending; | ||
3919 | 212 | //! The minimum desired frame rate in frame per second. | 232 | //! The minimum desired frame rate in frame per second. |
3920 | 213 | float minfps; | 233 | float minfps; |
3921 | 214 | //! The maximum desired frame rate in frame per second. | 234 | //! The maximum desired frame rate in frame per second. |
3922 | 215 | float maxfps; | 235 | float maxfps; |
3923 | 236 | QTimer* minFpsTimer; | ||
3924 | 237 | |||
3925 | 238 | #ifdef OPENGL_DEBUG_LOGGING | ||
3926 | 239 | QOpenGLDebugLogger* glLogger; | ||
3927 | 240 | #endif | ||
3928 | 216 | }; | 241 | }; |
3929 | 217 | 242 | ||
3930 | 218 | 243 | ||
3931 | 219 | 244 | ||
3932 | === modified file 'src/core/OctahedronPolygon.cpp' | |||
3933 | --- src/core/OctahedronPolygon.cpp 2015-03-24 16:31:04 +0000 | |||
3934 | +++ src/core/OctahedronPolygon.cpp 2017-01-12 21:08:38 +0000 | |||
3935 | @@ -91,7 +91,7 @@ | |||
3936 | 91 | } | 91 | } |
3937 | 92 | res[res.size()-1]=']'; | 92 | res[res.size()-1]=']'; |
3938 | 93 | return res; | 93 | return res; |
3940 | 94 | }; | 94 | } |
3941 | 95 | 95 | ||
3942 | 96 | OctahedronPolygon::OctahedronPolygon(const QVector<Vec3d>& contour) : fillCachedVertexArray(StelVertexArray::Triangles), outlineCachedVertexArray(StelVertexArray::Lines) | 96 | OctahedronPolygon::OctahedronPolygon(const QVector<Vec3d>& contour) : fillCachedVertexArray(StelVertexArray::Triangles), outlineCachedVertexArray(StelVertexArray::Lines) |
3943 | 97 | { | 97 | { |
3944 | 98 | 98 | ||
3945 | === modified file 'src/core/SpoutSender.cpp' | |||
3946 | --- src/core/SpoutSender.cpp 2016-12-18 22:26:48 +0000 | |||
3947 | +++ src/core/SpoutSender.cpp 2017-01-12 21:08:38 +0000 | |||
3948 | @@ -18,7 +18,7 @@ | |||
3949 | 18 | */ | 18 | */ |
3950 | 19 | 19 | ||
3951 | 20 | #include "SpoutSender.hpp" | 20 | #include "SpoutSender.hpp" |
3953 | 21 | #include "SpoutLibrary.h" | 21 | #include "../../external/SpoutLibrary.h" |
3954 | 22 | 22 | ||
3955 | 23 | Q_LOGGING_CATEGORY(spout,"stel.spout") | 23 | Q_LOGGING_CATEGORY(spout,"stel.spout") |
3956 | 24 | 24 | ||
3957 | 25 | 25 | ||
3958 | === modified file 'src/core/StelApp.cpp' | |||
3959 | --- src/core/StelApp.cpp 2017-01-09 17:24:41 +0000 | |||
3960 | +++ src/core/StelApp.cpp 2017-01-12 21:08:38 +0000 | |||
3961 | @@ -20,6 +20,7 @@ | |||
3962 | 20 | #include "StelApp.hpp" | 20 | #include "StelApp.hpp" |
3963 | 21 | 21 | ||
3964 | 22 | #include "StelCore.hpp" | 22 | #include "StelCore.hpp" |
3965 | 23 | #include "StelMainView.hpp" | ||
3966 | 23 | #include "StelUtils.hpp" | 24 | #include "StelUtils.hpp" |
3967 | 24 | #include "StelTextureMgr.hpp" | 25 | #include "StelTextureMgr.hpp" |
3968 | 25 | #include "StelObjectMgr.hpp" | 26 | #include "StelObjectMgr.hpp" |
3969 | @@ -202,9 +203,10 @@ | |||
3970 | 202 | /************************************************************************* | 203 | /************************************************************************* |
3971 | 203 | Create and initialize the main Stellarium application. | 204 | Create and initialize the main Stellarium application. |
3972 | 204 | *************************************************************************/ | 205 | *************************************************************************/ |
3974 | 205 | StelApp::StelApp(QObject* parent) | 206 | StelApp::StelApp(StelMainView *parent) |
3975 | 206 | : QObject(parent) | 207 | : QObject(parent) |
3977 | 207 | , core(NULL) | 208 | , mainWin(parent) |
3978 | 209 | , core(NULL) | ||
3979 | 208 | , moduleMgr(NULL) | 210 | , moduleMgr(NULL) |
3980 | 209 | , localeMgr(NULL) | 211 | , localeMgr(NULL) |
3981 | 210 | , skyCultureMgr(NULL) | 212 | , skyCultureMgr(NULL) |
3982 | @@ -226,8 +228,7 @@ | |||
3983 | 226 | , globalScalingRatio(1.f) | 228 | , globalScalingRatio(1.f) |
3984 | 227 | , fps(0) | 229 | , fps(0) |
3985 | 228 | , frame(0) | 230 | , frame(0) |
3988 | 229 | , timefr(0.) | 231 | , frameTimeAccum(0.) |
3987 | 230 | , timeBase(0.) | ||
3989 | 231 | , flagNightVision(false) | 232 | , flagNightVision(false) |
3990 | 232 | , confSettings(NULL) | 233 | , confSettings(NULL) |
3991 | 233 | , initialized(false) | 234 | , initialized(false) |
3992 | @@ -390,6 +391,7 @@ | |||
3993 | 390 | 391 | ||
3994 | 391 | void StelApp::init(QSettings* conf) | 392 | void StelApp::init(QSettings* conf) |
3995 | 392 | { | 393 | { |
3996 | 394 | gl = QOpenGLContext::currentContext()->functions(); | ||
3997 | 393 | confSettings = conf; | 395 | confSettings = conf; |
3998 | 394 | 396 | ||
3999 | 395 | devicePixelsPerPixel = QOpenGLContext::currentContext()->screen()->devicePixelRatio(); | 397 | devicePixelsPerPixel = QOpenGLContext::currentContext()->screen()->devicePixelRatio(); |
4000 | @@ -632,13 +634,13 @@ | |||
4001 | 632 | return; | 634 | return; |
4002 | 633 | 635 | ||
4003 | 634 | ++frame; | 636 | ++frame; |
4006 | 635 | timefr+=deltaTime; | 637 | frameTimeAccum+=deltaTime; |
4007 | 636 | if (timefr-timeBase > 1.) | 638 | if (frameTimeAccum > 1.) |
4008 | 637 | { | 639 | { |
4009 | 638 | // Calc the FPS rate every seconds | 640 | // Calc the FPS rate every seconds |
4011 | 639 | fps=(double)frame/(timefr-timeBase); | 641 | fps=(double)frame/frameTimeAccum; |
4012 | 640 | frame = 0; | 642 | frame = 0; |
4014 | 641 | timeBase+=1.; | 643 | frameTimeAccum=0.; |
4015 | 642 | } | 644 | } |
4016 | 643 | 645 | ||
4017 | 644 | core->update(deltaTime); | 646 | core->update(deltaTime); |
4018 | @@ -668,11 +670,10 @@ | |||
4019 | 668 | renderBuffer->bind(); | 670 | renderBuffer->bind(); |
4020 | 669 | } | 671 | } |
4021 | 670 | 672 | ||
4023 | 671 | void StelApp::applyRenderBuffer(int drawFbo) | 673 | void StelApp::applyRenderBuffer(GLuint drawFbo) |
4024 | 672 | { | 674 | { |
4025 | 673 | if (!renderBuffer) return; | 675 | if (!renderBuffer) return; |
4028 | 674 | renderBuffer->release(); | 676 | GL(gl->glBindFramebuffer(GL_FRAMEBUFFER, drawFbo)); |
4027 | 675 | if (drawFbo) GL(glBindFramebuffer(GL_FRAMEBUFFER, drawFbo)); | ||
4029 | 676 | viewportEffect->paintViewportBuffer(renderBuffer); | 677 | viewportEffect->paintViewportBuffer(renderBuffer); |
4030 | 677 | } | 678 | } |
4031 | 678 | 679 | ||
4032 | @@ -682,11 +683,18 @@ | |||
4033 | 682 | if (!initialized) | 683 | if (!initialized) |
4034 | 683 | return; | 684 | return; |
4035 | 684 | 685 | ||
4038 | 685 | int drawFbo; | 686 | //find out which framebuffer is the current one |
4039 | 686 | glGetIntegerv(GL_FRAMEBUFFER_BINDING, &drawFbo); | 687 | //this is usually NOT the "zero" FBO, but one provided by QOpenGLWidget |
4040 | 688 | GLint drawFbo; | ||
4041 | 689 | GL(gl->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &drawFbo)); | ||
4042 | 687 | 690 | ||
4043 | 688 | prepareRenderBuffer(); | 691 | prepareRenderBuffer(); |
4044 | 692 | currentFbo = renderBuffer ? renderBuffer->handle() : drawFbo; | ||
4045 | 693 | |||
4046 | 689 | core->preDraw(); | 694 | core->preDraw(); |
4047 | 695 | // Clear areas not redrawn by main viewport (i.e. fisheye square viewport) | ||
4048 | 696 | GL(gl->glClearColor(0,0,0,0)); | ||
4049 | 697 | GL(gl->glClear(GL_COLOR_BUFFER_BIT)); | ||
4050 | 690 | 698 | ||
4051 | 691 | const QList<StelModule*> modules = moduleMgr->getCallOrders(StelModule::ActionDraw); | 699 | const QList<StelModule*> modules = moduleMgr->getCallOrders(StelModule::ActionDraw); |
4052 | 692 | foreach(StelModule* module, modules) | 700 | foreach(StelModule* module, modules) |
4053 | @@ -706,23 +714,24 @@ | |||
4054 | 706 | /************************************************************************* | 714 | /************************************************************************* |
4055 | 707 | Call this when the size of the GL window has changed | 715 | Call this when the size of the GL window has changed |
4056 | 708 | *************************************************************************/ | 716 | *************************************************************************/ |
4058 | 709 | void StelApp::glWindowHasBeenResized(float x, float y, float w, float h) | 717 | void StelApp::glWindowHasBeenResized(const QRectF& rect) |
4059 | 710 | { | 718 | { |
4060 | 711 | if (core) | 719 | if (core) |
4062 | 712 | core->windowHasBeenResized(x, y, w, h); | 720 | core->windowHasBeenResized(rect.x(), rect.y(), rect.width(), rect.height()); |
4063 | 713 | else | 721 | else |
4064 | 714 | { | 722 | { |
4067 | 715 | saveProjW = w; | 723 | saveProjW = rect.width(); |
4068 | 716 | saveProjH = h; | 724 | saveProjH = rect.height(); |
4069 | 717 | } | 725 | } |
4070 | 718 | if (renderBuffer) | 726 | if (renderBuffer) |
4071 | 719 | { | 727 | { |
4072 | 728 | ensureGLContextCurrent(); | ||
4073 | 720 | delete renderBuffer; | 729 | delete renderBuffer; |
4074 | 721 | renderBuffer = NULL; | 730 | renderBuffer = NULL; |
4075 | 722 | } | 731 | } |
4076 | 723 | #ifdef ENABLE_SPOUT | 732 | #ifdef ENABLE_SPOUT |
4077 | 724 | if (spoutSender) | 733 | if (spoutSender) |
4079 | 725 | spoutSender->resize(w,h); | 734 | spoutSender->resize(rect.width(),rect.height()); |
4080 | 726 | #endif | 735 | #endif |
4081 | 727 | } | 736 | } |
4082 | 728 | 737 | ||
4083 | @@ -788,7 +797,7 @@ | |||
4084 | 788 | } | 797 | } |
4085 | 789 | 798 | ||
4086 | 790 | // Handle mouse move | 799 | // Handle mouse move |
4088 | 791 | void StelApp::handleMove(float x, float y, Qt::MouseButtons b) | 800 | bool StelApp::handleMove(float x, float y, Qt::MouseButtons b) |
4089 | 792 | { | 801 | { |
4090 | 793 | if (viewportEffect) | 802 | if (viewportEffect) |
4091 | 794 | viewportEffect->distortXY(x, y); | 803 | viewportEffect->distortXY(x, y); |
4092 | @@ -796,8 +805,9 @@ | |||
4093 | 796 | foreach (StelModule* i, moduleMgr->getCallOrders(StelModule::ActionHandleMouseMoves)) | 805 | foreach (StelModule* i, moduleMgr->getCallOrders(StelModule::ActionHandleMouseMoves)) |
4094 | 797 | { | 806 | { |
4095 | 798 | if (i->handleMouseMoves(x*devicePixelsPerPixel, y*devicePixelsPerPixel, b)) | 807 | if (i->handleMouseMoves(x*devicePixelsPerPixel, y*devicePixelsPerPixel, b)) |
4097 | 799 | return; | 808 | return true; |
4098 | 800 | } | 809 | } |
4099 | 810 | return false; | ||
4100 | 801 | } | 811 | } |
4101 | 802 | 812 | ||
4102 | 803 | // Handle key press and release | 813 | // Handle key press and release |
4103 | @@ -857,6 +867,11 @@ | |||
4104 | 857 | #endif | 867 | #endif |
4105 | 858 | } | 868 | } |
4106 | 859 | 869 | ||
4107 | 870 | void StelApp::ensureGLContextCurrent() | ||
4108 | 871 | { | ||
4109 | 872 | mainWin->glContextMakeCurrent(); | ||
4110 | 873 | } | ||
4111 | 874 | |||
4112 | 860 | // Return the time since when stellarium is running in second. | 875 | // Return the time since when stellarium is running in second. |
4113 | 861 | double StelApp::getTotalRunTime() | 876 | double StelApp::getTotalRunTime() |
4114 | 862 | { | 877 | { |
4115 | @@ -907,6 +922,7 @@ | |||
4116 | 907 | if (name == getViewportEffect()) return; | 922 | if (name == getViewportEffect()) return; |
4117 | 908 | if (renderBuffer) | 923 | if (renderBuffer) |
4118 | 909 | { | 924 | { |
4119 | 925 | ensureGLContextCurrent(); | ||
4120 | 910 | delete renderBuffer; | 926 | delete renderBuffer; |
4121 | 911 | renderBuffer = NULL; | 927 | renderBuffer = NULL; |
4122 | 912 | } | 928 | } |
4123 | 913 | 929 | ||
4124 | === modified file 'src/core/StelApp.hpp' | |||
4125 | --- src/core/StelApp.hpp 2016-12-18 22:26:48 +0000 | |||
4126 | +++ src/core/StelApp.hpp 2017-01-12 21:08:38 +0000 | |||
4127 | @@ -30,9 +30,11 @@ | |||
4128 | 30 | class StelObjectMgr; | 30 | class StelObjectMgr; |
4129 | 31 | class StelLocaleMgr; | 31 | class StelLocaleMgr; |
4130 | 32 | class StelModuleMgr; | 32 | class StelModuleMgr; |
4131 | 33 | class StelMainView; | ||
4132 | 33 | class StelSkyCultureMgr; | 34 | class StelSkyCultureMgr; |
4133 | 34 | class StelViewportEffect; | 35 | class StelViewportEffect; |
4134 | 35 | class QOpenGLFramebufferObject; | 36 | class QOpenGLFramebufferObject; |
4135 | 37 | class QOpenGLFunctions; | ||
4136 | 36 | class QSettings; | 38 | class QSettings; |
4137 | 37 | class QNetworkAccessManager; | 39 | class QNetworkAccessManager; |
4138 | 38 | class QNetworkReply; | 40 | class QNetworkReply; |
4139 | @@ -70,14 +72,14 @@ | |||
4140 | 70 | 72 | ||
4141 | 71 | public: | 73 | public: |
4142 | 72 | friend class StelAppGraphicsWidget; | 74 | friend class StelAppGraphicsWidget; |
4144 | 73 | friend class StelSkyItem; | 75 | friend class StelRootItem; |
4145 | 74 | 76 | ||
4146 | 75 | //! Create and initialize the main Stellarium application. | 77 | //! Create and initialize the main Stellarium application. |
4147 | 76 | //! @param parent the QObject parent | 78 | //! @param parent the QObject parent |
4148 | 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, |
4149 | 78 | //! it is therefor possible to specify either just a file name or path within the | 80 | //! it is therefor possible to specify either just a file name or path within the |
4150 | 79 | //! search path, or use a full path or even a relative path to an existing file | 81 | //! search path, or use a full path or even a relative path to an existing file |
4152 | 80 | StelApp(QObject* parent=NULL); | 82 | StelApp(StelMainView* parent); |
4153 | 81 | 83 | ||
4154 | 82 | //! Deinitialize and destroy the main Stellarium application. | 84 | //! Deinitialize and destroy the main Stellarium application. |
4155 | 83 | virtual ~StelApp(); | 85 | virtual ~StelApp(); |
4156 | @@ -160,9 +162,6 @@ | |||
4157 | 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. |
4158 | 161 | void draw(); | 163 | void draw(); |
4159 | 162 | 164 | ||
4160 | 163 | //! Call this when the size of the GL window has changed. | ||
4161 | 164 | void glWindowHasBeenResized(float x, float y, float w, float h); | ||
4162 | 165 | |||
4163 | 166 | //! Get the ratio between real device pixel and "Device Independent Pixel". | 165 | //! Get the ratio between real device pixel and "Device Independent Pixel". |
4164 | 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. |
4165 | 168 | float getDevicePixelsPerPixel() const {return devicePixelsPerPixel;} | 167 | float getDevicePixelsPerPixel() const {return devicePixelsPerPixel;} |
4166 | @@ -212,6 +211,8 @@ | |||
4167 | 212 | /////////////////////////////////////////////////////////////////////////// | 211 | /////////////////////////////////////////////////////////////////////////// |
4168 | 213 | // Scriptable methods | 212 | // Scriptable methods |
4169 | 214 | public slots: | 213 | public slots: |
4170 | 214 | //! Call this when the size of the GL window has changed. | ||
4171 | 215 | void glWindowHasBeenResized(const QRectF &rect); | ||
4172 | 215 | 216 | ||
4173 | 216 | //! Set flag for activating night vision mode. | 217 | //! Set flag for activating night vision mode. |
4174 | 217 | void setVisionModeNight(bool); | 218 | void setVisionModeNight(bool); |
4175 | @@ -240,6 +241,17 @@ | |||
4176 | 240 | //! @return the FPS averaged on the last second | 241 | //! @return the FPS averaged on the last second |
4177 | 241 | float getFps() const {return fps;} | 242 | float getFps() const {return fps;} |
4178 | 242 | 243 | ||
4179 | 244 | //! Returns the default FBO handle, to be used when StelModule instances want to release their own FBOs. | ||
4180 | 245 | //! Note that this is usually not the same as QOpenGLContext::defaultFramebufferObject(), | ||
4181 | 246 | //! so use this call instead of the Qt version! | ||
4182 | 247 | //! Valid through a StelModule::draw() call, do not use elsewhere. | ||
4183 | 248 | quint32 getDefaultFBO() const { return currentFbo; } | ||
4184 | 249 | |||
4185 | 250 | //! Makes sure the correct GL context used for main drawing is made current. | ||
4186 | 251 | //! This is always the case during init() and draw() calls, but if OpenGL access is required elsewhere, | ||
4187 | 252 | //! this MUST be called before using any GL functions. | ||
4188 | 253 | void ensureGLContextCurrent(); | ||
4189 | 254 | |||
4190 | 243 | //! Return the time since when stellarium is running in second. | 255 | //! Return the time since when stellarium is running in second. |
4191 | 244 | static double getTotalRunTime(); | 256 | static double getTotalRunTime(); |
4192 | 245 | 257 | ||
4193 | @@ -263,7 +275,6 @@ | |||
4194 | 263 | void progressBarRemoved(const StelProgressController*); | 275 | void progressBarRemoved(const StelProgressController*); |
4195 | 264 | //! Called just before we exit Qt mainloop. | 276 | //! Called just before we exit Qt mainloop. |
4196 | 265 | void aboutToQuit(); | 277 | void aboutToQuit(); |
4197 | 266 | |||
4198 | 267 | private: | 278 | private: |
4199 | 268 | 279 | ||
4200 | 269 | //! Handle mouse clics. | 280 | //! Handle mouse clics. |
4201 | @@ -271,7 +282,7 @@ | |||
4202 | 271 | //! Handle mouse wheel. | 282 | //! Handle mouse wheel. |
4203 | 272 | void handleWheel(class QWheelEvent* event); | 283 | void handleWheel(class QWheelEvent* event); |
4204 | 273 | //! Handle mouse move. | 284 | //! Handle mouse move. |
4206 | 274 | void handleMove(float x, float y, Qt::MouseButtons b); | 285 | bool handleMove(float x, float y, Qt::MouseButtons b); |
4207 | 275 | //! Handle key press and release. | 286 | //! Handle key press and release. |
4208 | 276 | void handleKeys(class QKeyEvent* event); | 287 | void handleKeys(class QKeyEvent* event); |
4209 | 277 | //! Handle pinch on multi touch devices. | 288 | //! Handle pinch on multi touch devices. |
4210 | @@ -281,11 +292,14 @@ | |||
4211 | 281 | void prepareRenderBuffer(); | 292 | void prepareRenderBuffer(); |
4212 | 282 | //! Used internally to set the viewport effects. | 293 | //! Used internally to set the viewport effects. |
4213 | 283 | //! @param drawFbo the OpenGL fbo we need to render into. | 294 | //! @param drawFbo the OpenGL fbo we need to render into. |
4215 | 284 | void applyRenderBuffer(int drawFbo=0); | 295 | void applyRenderBuffer(quint32 drawFbo=0); |
4216 | 285 | 296 | ||
4217 | 286 | // The StelApp singleton | 297 | // The StelApp singleton |
4218 | 287 | static StelApp* singleton; | 298 | static StelApp* singleton; |
4219 | 288 | 299 | ||
4220 | 300 | //! The main window which is the parent of this object | ||
4221 | 301 | StelMainView* mainWin; | ||
4222 | 302 | |||
4223 | 289 | // The associated StelCore instance | 303 | // The associated StelCore instance |
4224 | 290 | StelCore* core; | 304 | StelCore* core; |
4225 | 291 | 305 | ||
4226 | @@ -354,7 +368,7 @@ | |||
4227 | 354 | 368 | ||
4228 | 355 | float fps; | 369 | float fps; |
4229 | 356 | int frame; | 370 | int frame; |
4231 | 357 | double timefr, timeBase; // Used for fps counter | 371 | double frameTimeAccum; // Used for fps counter |
4232 | 358 | 372 | ||
4233 | 359 | //! Define whether we are in night vision mode | 373 | //! Define whether we are in night vision mode |
4234 | 360 | bool flagNightVision; | 374 | bool flagNightVision; |
4235 | @@ -388,8 +402,8 @@ | |||
4236 | 388 | 402 | ||
4237 | 389 | // Framebuffer object used for viewport effects. | 403 | // Framebuffer object used for viewport effects. |
4238 | 390 | QOpenGLFramebufferObject* renderBuffer; | 404 | QOpenGLFramebufferObject* renderBuffer; |
4239 | 391 | |||
4240 | 392 | StelViewportEffect* viewportEffect; | 405 | StelViewportEffect* viewportEffect; |
4241 | 406 | QOpenGLFunctions* gl; | ||
4242 | 393 | 407 | ||
4243 | 394 | bool flagShowDecimalDegrees; | 408 | bool flagShowDecimalDegrees; |
4244 | 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) |
4245 | @@ -398,6 +412,9 @@ | |||
4246 | 398 | SpoutSender* spoutSender; | 412 | SpoutSender* spoutSender; |
4247 | 399 | #endif | 413 | #endif |
4248 | 400 | 414 | ||
4249 | 415 | // The current main FBO/render target handle, without requiring GL queries. Valid through a draw() call | ||
4250 | 416 | quint32 currentFbo; | ||
4251 | 417 | |||
4252 | 401 | }; | 418 | }; |
4253 | 402 | 419 | ||
4254 | 403 | #endif // _STELAPP_HPP_ | 420 | #endif // _STELAPP_HPP_ |
4255 | 404 | 421 | ||
4256 | === modified file 'src/core/StelCore.cpp' | |||
4257 | --- src/core/StelCore.cpp 2017-01-06 13:26:03 +0000 | |||
4258 | +++ src/core/StelCore.cpp 2017-01-12 21:08:38 +0000 | |||
4259 | @@ -244,6 +244,9 @@ | |||
4260 | 244 | setCurrentProjectionTypeKey(getDefaultProjectionTypeKey()); | 244 | setCurrentProjectionTypeKey(getDefaultProjectionTypeKey()); |
4261 | 245 | updateMaximumFov(); | 245 | updateMaximumFov(); |
4262 | 246 | 246 | ||
4263 | 247 | // activate DE430/431 | ||
4264 | 248 | initEphemeridesFunctions(); | ||
4265 | 249 | |||
4266 | 247 | // Register all the core actions. | 250 | // Register all the core actions. |
4267 | 248 | QString timeGroup = N_("Date and Time"); | 251 | QString timeGroup = N_("Date and Time"); |
4268 | 249 | QString movementGroup = N_("Movement and Selection"); | 252 | QString movementGroup = N_("Movement and Selection"); |
4269 | @@ -503,10 +506,6 @@ | |||
4270 | 503 | currentProjectorParams.zFar = 500.; | 506 | currentProjectorParams.zFar = 500.; |
4271 | 504 | 507 | ||
4272 | 505 | skyDrawer->preDraw(); | 508 | skyDrawer->preDraw(); |
4273 | 506 | |||
4274 | 507 | // Clear areas not redrawn by main viewport (i.e. fisheye square viewport) | ||
4275 | 508 | glClearColor(0,0,0,0); | ||
4276 | 509 | glClear(GL_COLOR_BUFFER_BIT); | ||
4277 | 510 | } | 509 | } |
4278 | 511 | 510 | ||
4279 | 512 | 511 | ||
4280 | 513 | 512 | ||
4281 | === modified file 'src/core/StelOpenGL.cpp' | |||
4282 | --- src/core/StelOpenGL.cpp 2014-06-11 15:48:31 +0000 | |||
4283 | +++ src/core/StelOpenGL.cpp 2017-01-12 21:08:38 +0000 | |||
4284 | @@ -16,10 +16,12 @@ | |||
4285 | 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. |
4286 | 17 | */ | 17 | */ |
4287 | 18 | 18 | ||
4288 | 19 | #include <cstdio> | ||
4289 | 20 | #include "StelOpenGL.hpp" | 19 | #include "StelOpenGL.hpp" |
4292 | 21 | 20 | #include <QDebug> | |
4293 | 22 | const char* getGLErrorText(int code) { | 21 | |
4294 | 22 | QOpenGLContext* StelOpenGL::mainContext = NULL; | ||
4295 | 23 | |||
4296 | 24 | const char* StelOpenGL::getGLErrorText(GLenum code) { | ||
4297 | 23 | switch (code) { | 25 | switch (code) { |
4298 | 24 | case GL_INVALID_ENUM: | 26 | case GL_INVALID_ENUM: |
4299 | 25 | return "GL_INVALID_ENUM"; | 27 | return "GL_INVALID_ENUM"; |
4300 | @@ -32,20 +34,18 @@ | |||
4301 | 32 | case GL_OUT_OF_MEMORY: | 34 | case GL_OUT_OF_MEMORY: |
4302 | 33 | return "GL_OUT_OF_MEMORY"; | 35 | return "GL_OUT_OF_MEMORY"; |
4303 | 34 | default: | 36 | default: |
4305 | 35 | return "undefined error"; | 37 | return "unknown GL error type"; |
4306 | 36 | } | 38 | } |
4307 | 37 | } | 39 | } |
4308 | 38 | 40 | ||
4310 | 39 | int checkGLErrors(const char *file, int line) | 41 | int StelOpenGL::checkGLErrors(const char *file, int line) |
4311 | 40 | { | 42 | { |
4312 | 41 | int errors = 0; | 43 | int errors = 0; |
4314 | 42 | while (true) | 44 | for(GLenum x; (x=mainContext->functions()->glGetError())!=GL_NO_ERROR; ) |
4315 | 43 | { | 45 | { |
4322 | 44 | GLenum x = glGetError(); | 46 | ++errors; |
4323 | 45 | if (x == GL_NO_ERROR) | 47 | qCritical("%s:%d: OpenGL error: %d (%s)\n", |
4324 | 46 | return errors; | 48 | file, line, x, getGLErrorText(x)); |
4319 | 47 | printf("%s:%d: OpenGL error: %d (%s)\n", | ||
4320 | 48 | file, line, x, getGLErrorText(x)); | ||
4321 | 49 | errors++; | ||
4325 | 50 | } | 49 | } |
4326 | 50 | return errors; | ||
4327 | 51 | } | 51 | } |
4328 | 52 | 52 | ||
4329 | === modified file 'src/core/StelOpenGL.hpp' | |||
4330 | --- src/core/StelOpenGL.hpp 2016-12-10 10:33:35 +0000 | |||
4331 | +++ src/core/StelOpenGL.hpp 2017-01-12 21:08:38 +0000 | |||
4332 | @@ -1,6 +1,7 @@ | |||
4333 | 1 | /* | 1 | /* |
4334 | 2 | * Stellarium | 2 | * Stellarium |
4335 | 3 | * Copyright (C) 2014 Fabien Chereau | 3 | * Copyright (C) 2014 Fabien Chereau |
4336 | 4 | * Copyright (C) 2016 Florian Schaukowitsch | ||
4337 | 4 | * | 5 | * |
4338 | 5 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
4339 | 6 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
4340 | @@ -20,185 +21,29 @@ | |||
4341 | 20 | #ifndef _STELOPENGL_HPP_ | 21 | #ifndef _STELOPENGL_HPP_ |
4342 | 21 | #define _STELOPENGL_HPP_ | 22 | #define _STELOPENGL_HPP_ |
4343 | 22 | 23 | ||
4344 | 23 | #define GL_GLEXT_PROTOTYPES | ||
4345 | 24 | #include <qopengl.h> | ||
4346 | 25 | |||
4347 | 26 | #include <QOpenGLFunctions> | 24 | #include <QOpenGLFunctions> |
4348 | 27 | 25 | ||
4496 | 28 | // On windows without ANGLE support, we should not directly call some | 26 | #ifndef QT_NO_DEBUG |
4350 | 29 | // of the OpenGL functions, instead we have to use QOpenGLFunctions. | ||
4351 | 30 | // | ||
4352 | 31 | // Here we replace the functions with a macro that will invoke the proper | ||
4353 | 32 | // calls. | ||
4354 | 33 | #if defined(Q_OS_WIN) && !defined(Q_NO_OPENGL) | ||
4355 | 34 | # define GLFUNC_(x) QOpenGLContext::currentContext()->functions()->x | ||
4356 | 35 | #else | ||
4357 | 36 | # define GLFUNC_(x) x | ||
4358 | 37 | #endif | ||
4359 | 38 | |||
4360 | 39 | #define glActiveTexture(...) GLFUNC_(glActiveTexture(__VA_ARGS__)) | ||
4361 | 40 | #define glAttachShader(...) GLFUNC_(glAttachShader(__VA_ARGS__)) | ||
4362 | 41 | #define glBindAttribLocation(...) GLFUNC_(glBindAttribLocation(__VA_ARGS__)) | ||
4363 | 42 | #define glBindBuffer(...) GLFUNC_(glBindBuffer(__VA_ARGS__)) | ||
4364 | 43 | #define glBindFramebuffer(...) GLFUNC_(glBindFramebuffer(__VA_ARGS__)) | ||
4365 | 44 | #define glBindRenderbuffer(...) GLFUNC_(glBindRenderbuffer(__VA_ARGS__)) | ||
4366 | 45 | #define glBlendColor(...) GLFUNC_(glBlendColor(__VA_ARGS__)) | ||
4367 | 46 | #define glBlendEquation(...) GLFUNC_(glBlendEquation(__VA_ARGS__)) | ||
4368 | 47 | #define glBlendEquationSeparate(...) GLFUNC_(glBlendEquationSeparate(__VA_ARGS__)) | ||
4369 | 48 | #define glBlendFuncSeparate(...) GLFUNC_(glBlendFuncSeparate(__VA_ARGS__)) | ||
4370 | 49 | #define glBufferData(...) GLFUNC_(glBufferData(__VA_ARGS__)) | ||
4371 | 50 | #define glBufferSubData(...) GLFUNC_(glBufferSubData(__VA_ARGS__)) | ||
4372 | 51 | #define glCheckFramebufferStatus(...) GLFUNC_(glCheckFramebufferStatus(__VA_ARGS__)) | ||
4373 | 52 | #define glClearDepthf(...) GLFUNC_(glClearDepthf(__VA_ARGS__)) | ||
4374 | 53 | #define glCompileShader(...) GLFUNC_(glCompileShader(__VA_ARGS__)) | ||
4375 | 54 | #define glCompressedTexImage2D(...) GLFUNC_(glCompressedTexImage2D(__VA_ARGS__)) | ||
4376 | 55 | #define glCompressedTexSubImage2D(...) GLFUNC_(glCompressedTexSubImage2D(__VA_ARGS__)) | ||
4377 | 56 | #define glCopyTexSubImage2D(...) GLFUNC_(glCopyTexSubImage2D(__VA_ARGS__)) // new for spout | ||
4378 | 57 | #define glCreateProgram(...) GLFUNC_(glCreateProgram(__VA_ARGS__)) | ||
4379 | 58 | #define glCreateShader(...) GLFUNC_(glCreateShader(__VA_ARGS__)) | ||
4380 | 59 | #define glDeleteBuffers(...) GLFUNC_(glDeleteBuffers(__VA_ARGS__)) | ||
4381 | 60 | #define glDeleteFramebuffers(...) GLFUNC_(glDeleteFramebuffers(__VA_ARGS__)) | ||
4382 | 61 | #define glDeleteProgram(...) GLFUNC_(glDeleteProgram(__VA_ARGS__)) | ||
4383 | 62 | #define glDeleteRenderbuffers(...) GLFUNC_(glDeleteRenderbuffers(__VA_ARGS__)) | ||
4384 | 63 | #define glDeleteShader(...) GLFUNC_(glDeleteShader(__VA_ARGS__)) | ||
4385 | 64 | #define glDepthRangef(...) GLFUNC_(glDepthRangef(__VA_ARGS__)) | ||
4386 | 65 | #define glDetachShader(...) GLFUNC_(glDetachShader(__VA_ARGS__)) | ||
4387 | 66 | #define glDisableVertexAttribArray(...) GLFUNC_(glDisableVertexAttribArray(__VA_ARGS__)) | ||
4388 | 67 | #define glEnableVertexAttribArray(...) GLFUNC_(glEnableVertexAttribArray(__VA_ARGS__)) | ||
4389 | 68 | #define glFramebufferRenderbuffer(...) GLFUNC_(glFramebufferRenderbuffer(__VA_ARGS__)) | ||
4390 | 69 | #define glFramebufferTexture2D(...) GLFUNC_(glFramebufferTexture2D(__VA_ARGS__)) | ||
4391 | 70 | #define glGenBuffers(...) GLFUNC_(glGenBuffers(__VA_ARGS__)) | ||
4392 | 71 | #define glGenerateMipmap(...) GLFUNC_(glGenerateMipmap(__VA_ARGS__)) | ||
4393 | 72 | #define glGenFramebuffers(...) GLFUNC_(glGenFramebuffers(__VA_ARGS__)) | ||
4394 | 73 | #define glGenRenderbuffers(...) GLFUNC_(glGenRenderbuffers(__VA_ARGS__)) | ||
4395 | 74 | #define glGetActiveAttrib(...) GLFUNC_(glGetActiveAttrib(__VA_ARGS__)) | ||
4396 | 75 | #define glGetActiveUniform(...) GLFUNC_(glGetActiveUniform(__VA_ARGS__)) | ||
4397 | 76 | #define glGetAttachedShaders(...) GLFUNC_(glGetAttachedShaders(__VA_ARGS__)) | ||
4398 | 77 | #define glGetAttribLocation(...) GLFUNC_(glGetAttribLocation(__VA_ARGS__)) | ||
4399 | 78 | #define glGetBufferParameteriv(...) GLFUNC_(glGetBufferParameteriv(__VA_ARGS__)) | ||
4400 | 79 | #define glGetFramebufferAttachmentParameteriv(...) GLFUNC_(glGetFramebufferAttachmentParameteriv(__VA_ARGS__)) | ||
4401 | 80 | #define glGetProgramiv(...) GLFUNC_(glGetProgramiv(__VA_ARGS__)) | ||
4402 | 81 | #define glGetProgramInfoLog(...) GLFUNC_(glGetProgramInfoLog(__VA_ARGS__)) | ||
4403 | 82 | #define glGetRenderbufferParameteriv(...) GLFUNC_(glGetRenderbufferParameteriv(__VA_ARGS__)) | ||
4404 | 83 | #define glGetShaderiv(...) GLFUNC_(glGetShaderiv(__VA_ARGS__)) | ||
4405 | 84 | #define glGetShaderInfoLog(...) GLFUNC_(glGetShaderInfoLog(__VA_ARGS__)) | ||
4406 | 85 | #define glGetShaderPrecisionFormat(...) GLFUNC_(glGetShaderPrecisionFormat(__VA_ARGS__)) | ||
4407 | 86 | #define glGetShaderSource(...) GLFUNC_(glGetShaderSource(__VA_ARGS__)) | ||
4408 | 87 | #define glGetUniformfv(...) GLFUNC_(glGetUniformfv(__VA_ARGS__)) | ||
4409 | 88 | #define glGetUniformiv(...) GLFUNC_(glGetUniformiv(__VA_ARGS__)) | ||
4410 | 89 | #define glGetUniformLocation(...) GLFUNC_(glGetUniformLocation(__VA_ARGS__)) | ||
4411 | 90 | #define glGetVertexAttribfv(...) GLFUNC_(glGetVertexAttribfv(__VA_ARGS__)) | ||
4412 | 91 | #define glGetVertexAttribiv(...) GLFUNC_(glGetVertexAttribiv(__VA_ARGS__)) | ||
4413 | 92 | #define glGetVertexAttribPointerv(...) GLFUNC_(glGetVertexAttribPointerv(__VA_ARGS__)) | ||
4414 | 93 | #define glIsBuffer(...) GLFUNC_(glIsBuffer(__VA_ARGS__)) | ||
4415 | 94 | #define glIsFramebuffer(...) GLFUNC_(glIsFramebuffer(__VA_ARGS__)) | ||
4416 | 95 | #define glIsProgram(...) GLFUNC_(glIsProgram(__VA_ARGS__)) | ||
4417 | 96 | #define glIsRenderbuffer(...) GLFUNC_(glIsRenderbuffer(__VA_ARGS__)) | ||
4418 | 97 | #define glIsShader(...) GLFUNC_(glIsShader(__VA_ARGS__)) | ||
4419 | 98 | #define glLinkProgram(...) GLFUNC_(glLinkProgram(__VA_ARGS__)) | ||
4420 | 99 | #define glProgramParameteri(...) GLFUNC_(glProgramParameteri(__VA_ARGS__)) // GZ TRIAL | ||
4421 | 100 | #define glProgramParameteriEXT(...) GLFUNC_(glProgramParameteriEXT(__VA_ARGS__)) // GZ TRIAL | ||
4422 | 101 | #define glReleaseShaderCompiler(...) GLFUNC_(glReleaseShaderCompiler(__VA_ARGS__)) | ||
4423 | 102 | #define glRenderbufferStorage(...) GLFUNC_(glRenderbufferStorage(__VA_ARGS__)) | ||
4424 | 103 | #define glSampleCoverage(...) GLFUNC_(glSampleCoverage(__VA_ARGS__)) | ||
4425 | 104 | #define glShaderBinary(...) GLFUNC_(glShaderBinary(__VA_ARGS__)) | ||
4426 | 105 | #define glShaderSource(...) GLFUNC_(glShaderSource(__VA_ARGS__)) | ||
4427 | 106 | #define glStencilFuncSeparate(...) GLFUNC_(glStencilFuncSeparate(__VA_ARGS__)) | ||
4428 | 107 | #define glStencilMaskSeparate(...) GLFUNC_(glStencilMaskSeparate(__VA_ARGS__)) | ||
4429 | 108 | #define glStencilOpSeparate(...) GLFUNC_(glStencilOpSeparate(__VA_ARGS__)) | ||
4430 | 109 | #define glUniform1f(...) GLFUNC_(glUniform1f(__VA_ARGS__)) | ||
4431 | 110 | #define glUniform1fv(...) GLFUNC_(glUniform1fv(__VA_ARGS__)) | ||
4432 | 111 | #define glUniform1i(...) GLFUNC_(glUniform1i(__VA_ARGS__)) | ||
4433 | 112 | #define glUniform1iv(...) GLFUNC_(glUniform1iv(__VA_ARGS__)) | ||
4434 | 113 | #define glUniform2f(...) GLFUNC_(glUniform2f(__VA_ARGS__)) | ||
4435 | 114 | #define glUniform2fv(...) GLFUNC_(glUniform2fv(__VA_ARGS__)) | ||
4436 | 115 | #define glUniform2i(...) GLFUNC_(glUniform2i(__VA_ARGS__)) | ||
4437 | 116 | #define glUniform2iv(...) GLFUNC_(glUniform2iv(__VA_ARGS__)) | ||
4438 | 117 | #define glUniform3f(...) GLFUNC_(glUniform3f(__VA_ARGS__)) | ||
4439 | 118 | #define glUniform3fv(...) GLFUNC_(glUniform3fv(__VA_ARGS__)) | ||
4440 | 119 | #define glUniform3i(...) GLFUNC_(glUniform3i(__VA_ARGS__)) | ||
4441 | 120 | #define glUniform3iv(...) GLFUNC_(glUniform3iv(__VA_ARGS__)) | ||
4442 | 121 | #define glUniform4f(...) GLFUNC_(glUniform4f(__VA_ARGS__)) | ||
4443 | 122 | #define glUniform4fv(...) GLFUNC_(glUniform4fv(__VA_ARGS__)) | ||
4444 | 123 | #define glUniform4i(...) GLFUNC_(glUniform4i(__VA_ARGS__)) | ||
4445 | 124 | #define glUniform4iv(...) GLFUNC_(glUniform4iv(__VA_ARGS__)) | ||
4446 | 125 | #define glUniformMatrix2fv(...) GLFUNC_(glUniformMatrix2fv(__VA_ARGS__)) | ||
4447 | 126 | #define glUniformMatrix3fv(...) GLFUNC_(glUniformMatrix3fv(__VA_ARGS__)) | ||
4448 | 127 | #define glUniformMatrix4fv(...) GLFUNC_(glUniformMatrix4fv(__VA_ARGS__)) | ||
4449 | 128 | #define glUseProgram(...) GLFUNC_(glUseProgram(__VA_ARGS__)) | ||
4450 | 129 | #define glValidateProgram(...) GLFUNC_(glValidateProgram(__VA_ARGS__)) | ||
4451 | 130 | #define glVertexAttrib1f(...) GLFUNC_(glVertexAttrib1f(__VA_ARGS__)) | ||
4452 | 131 | #define glVertexAttrib1fv(...) GLFUNC_(glVertexAttrib1fv(__VA_ARGS__)) | ||
4453 | 132 | #define glVertexAttrib2f(...) GLFUNC_(glVertexAttrib2f(__VA_ARGS__)) | ||
4454 | 133 | #define glVertexAttrib2fv(...) GLFUNC_(glVertexAttrib2fv(__VA_ARGS__)) | ||
4455 | 134 | #define glVertexAttrib3f(...) GLFUNC_(glVertexAttrib3f(__VA_ARGS__)) | ||
4456 | 135 | #define glVertexAttrib3fv(...) GLFUNC_(glVertexAttrib3fv(__VA_ARGS__)) | ||
4457 | 136 | #define glVertexAttrib4f(...) GLFUNC_(glVertexAttrib4f(__VA_ARGS__)) | ||
4458 | 137 | #define glVertexAttrib4fv(...) GLFUNC_(glVertexAttrib4fv(__VA_ARGS__)) | ||
4459 | 138 | #define glVertexAttribPointer(...) GLFUNC_(glVertexAttribPointer(__VA_ARGS__)) | ||
4460 | 139 | |||
4461 | 140 | #if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) | ||
4462 | 141 | #define glGetString(...) GLFUNC_(glGetString(__VA_ARGS__)) | ||
4463 | 142 | #endif | ||
4464 | 143 | |||
4465 | 144 | #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) | ||
4466 | 145 | #define glBindTexture(...) GLFUNC_(glBindTexture(__VA_ARGS__)) | ||
4467 | 146 | #define glBlendFunc(...) GLFUNC_(glBlendFunc(__VA_ARGS__)) | ||
4468 | 147 | #define glClear(...) GLFUNC_(glClear(__VA_ARGS__)) | ||
4469 | 148 | #define glClearColor(...) GLFUNC_(glClearColor(__VA_ARGS__)) | ||
4470 | 149 | #define glCullFace(...) GLFUNC_(glCullFace(__VA_ARGS__)) | ||
4471 | 150 | #define glDeleteTextures(...) GLFUNC_(glDeleteTextures(__VA_ARGS__)) | ||
4472 | 151 | #define glDepthMask(...) GLFUNC_(glDepthMask(__VA_ARGS__)) | ||
4473 | 152 | #define glDisable(...) GLFUNC_(glDisable(__VA_ARGS__)) | ||
4474 | 153 | #define glDrawArrays(...) GLFUNC_(glDrawArrays(__VA_ARGS__)) | ||
4475 | 154 | #define glDrawElements(...) GLFUNC_(glDrawElements(__VA_ARGS__)) | ||
4476 | 155 | #define glEnable(...) GLFUNC_(glEnable(__VA_ARGS__)) | ||
4477 | 156 | #define glGenTextures(...) GLFUNC_(glGenTextures(__VA_ARGS__)) | ||
4478 | 157 | #define glGetError(...) GLFUNC_(glGetError(__VA_ARGS__)) | ||
4479 | 158 | #define glGetIntegerv(...) GLFUNC_(glGetIntegerv(__VA_ARGS__)) | ||
4480 | 159 | #define glFrontFace(...) GLFUNC_(glFrontFace(__VA_ARGS__)) | ||
4481 | 160 | #define glIsEnabled(...) GLFUNC_(glIsEnabled(__VA_ARGS__)) | ||
4482 | 161 | #define glIsTexture(...) GLFUNC_(glIsTexture(__VA_ARGS__)) | ||
4483 | 162 | #define glLineWidth(...) GLFUNC_(glLineWidth(__VA_ARGS__)) | ||
4484 | 163 | #define glPixelStorei(...) GLFUNC_(glPixelStorei(__VA_ARGS__)) | ||
4485 | 164 | #define glPolygonOffset(...) GLFUNC_(glPolygonOffset(__VA_ARGS__)) | ||
4486 | 165 | #define glStencilMask(...) GLFUNC_(glStencilMask(__VA_ARGS__)) | ||
4487 | 166 | #define glTexImage2D(...) GLFUNC_(glTexImage2D(__VA_ARGS__)) | ||
4488 | 167 | #define glTexParameterf(...) GLFUNC_(glTexParameterf(__VA_ARGS__)) | ||
4489 | 168 | #define glTexParameterfv(...) GLFUNC_(glTexParameterfv(__VA_ARGS__)) | ||
4490 | 169 | #define glTexParameteri(...) GLFUNC_(glTexParameteri(__VA_ARGS__)) | ||
4491 | 170 | #define glTexParameteriv(...) GLFUNC_(glTexParameteriv(__VA_ARGS__)) | ||
4492 | 171 | #define glViewport(...) GLFUNC_(glViewport(__VA_ARGS__)) | ||
4493 | 172 | #endif | ||
4494 | 173 | |||
4495 | 174 | #ifndef NDEBUG | ||
4497 | 175 | # define GL(line) do { \ | 27 | # define GL(line) do { \ |
4498 | 28 | /*for debugging, we make sure we use our main context*/\ | ||
4499 | 29 | Q_ASSERT(StelOpenGL::mainContext == QOpenGLContext::currentContext());\ | ||
4500 | 176 | line;\ | 30 | line;\ |
4503 | 177 | if (checkGLErrors(__FILE__, __LINE__))\ | 31 | Q_ASSERT_X(!StelOpenGL::checkGLErrors(__FILE__, __LINE__), "GL macro", "OpenGL errors encountered");\ |
4502 | 178 | exit(-1);\ | ||
4504 | 179 | } while(0) | 32 | } while(0) |
4505 | 180 | #else | 33 | #else |
4506 | 181 | # define GL(line) line | 34 | # define GL(line) line |
4507 | 182 | #endif | 35 | #endif |
4508 | 183 | 36 | ||
4528 | 184 | // In ANGLE and other OpenGL ES systems, GL_LINE_SMOOTH is undefined. | 37 | //! Namespace containing some OpenGL helpers |
4529 | 185 | // We can define it here to not break compilation, but must test for real OpenGL context before calling. | 38 | namespace StelOpenGL |
4530 | 186 | # ifndef GL_LINE_SMOOTH | 39 | { |
4531 | 187 | # define GL_LINE_SMOOTH 0x0B20 | 40 | //! The main context as created by the StelMainView (only used for debugging) |
4532 | 188 | # endif | 41 | extern QOpenGLContext* mainContext; |
4533 | 189 | 42 | ||
4534 | 190 | const char* getGLErrorText(int code); | 43 | //! Converts a GLenum from glGetError to a string |
4535 | 191 | int checkGLErrors(const char *file, int line); | 44 | const char* getGLErrorText(GLenum code); |
4536 | 192 | 45 | //! Retrieves and prints all current OpenGL errors to console (glGetError in a loop) | |
4537 | 193 | // To build on arm platforms we need to re-introduce the Qt 5.4 removed | 46 | int checkGLErrors(const char *file, int line); |
4538 | 194 | // typedefs and defines of GLdouble/GL_DOUBLE, which are not present in GLES | 47 | } |
4520 | 195 | #if defined(QT_OPENGL_ES_2) | ||
4521 | 196 | # ifndef GL_DOUBLE | ||
4522 | 197 | # define GL_DOUBLE GL_FLOAT | ||
4523 | 198 | # endif | ||
4524 | 199 | # ifndef GLdouble | ||
4525 | 200 | typedef double GLdouble; | ||
4526 | 201 | # endif | ||
4527 | 202 | #endif | ||
4539 | 203 | 48 | ||
4540 | 204 | #endif // _STELOPENGL_HPP_ | 49 | #endif // _STELOPENGL_HPP_ |
4541 | 205 | 50 | ||
4542 | === modified file 'src/core/StelPainter.cpp' | |||
4543 | --- src/core/StelPainter.cpp 2017-01-06 16:52:05 +0000 | |||
4544 | +++ src/core/StelPainter.cpp 2017-01-12 21:08:38 +0000 | |||
4545 | @@ -55,26 +55,50 @@ | |||
4546 | 55 | StelPainter::BasicShaderVars StelPainter::colorShaderVars; | 55 | StelPainter::BasicShaderVars StelPainter::colorShaderVars; |
4547 | 56 | StelPainter::TexturesColorShaderVars StelPainter::texturesColorShaderVars; | 56 | StelPainter::TexturesColorShaderVars StelPainter::texturesColorShaderVars; |
4548 | 57 | 57 | ||
4569 | 58 | StelPainter::GLState::GLState() | 58 | StelPainter::GLState::GLState(QOpenGLFunctions* gl) |
4570 | 59 | { | 59 | : blend(false), |
4571 | 60 | blend = glIsEnabled(GL_BLEND); | 60 | blendSrc(GL_SRC_ALPHA), blendDst(GL_ONE_MINUS_SRC_ALPHA), |
4572 | 61 | glGetIntegerv(GL_BLEND_SRC_RGB, &blendSrcRGB); | 61 | depthTest(false), |
4573 | 62 | glGetIntegerv(GL_BLEND_DST_RGB, &blendDstRGB); | 62 | depthMask(false), |
4574 | 63 | glGetIntegerv(GL_BLEND_SRC_ALPHA, &blendSrcAlpha); | 63 | cullFace(false), |
4575 | 64 | glGetIntegerv(GL_BLEND_DST_ALPHA, &blendDstAlpha); | 64 | lineSmooth(false), |
4576 | 65 | } | 65 | lineWidth(1.0f), |
4577 | 66 | 66 | gl(gl) | |
4578 | 67 | StelPainter::GLState::~GLState() | 67 | { |
4579 | 68 | { | 68 | |
4580 | 69 | if (blend) | 69 | } |
4581 | 70 | { | 70 | |
4582 | 71 | glEnable(GL_BLEND); | 71 | void StelPainter::GLState::apply() |
4583 | 72 | glBlendFuncSeparate(blendSrcRGB, blendDstRGB, blendSrcAlpha, blendDstAlpha); | 72 | { |
4584 | 73 | } | 73 | if(blend) |
4585 | 74 | else | 74 | gl->glEnable(GL_BLEND); |
4586 | 75 | { | 75 | else |
4587 | 76 | glDisable(GL_BLEND); | 76 | gl->glDisable(GL_BLEND); |
4588 | 77 | } | 77 | gl->glBlendFunc(blendSrc,blendDst); |
4589 | 78 | if(depthTest) | ||
4590 | 79 | gl->glEnable(GL_DEPTH_TEST); | ||
4591 | 80 | else | ||
4592 | 81 | gl->glDisable(GL_DEPTH_TEST); | ||
4593 | 82 | gl->glDepthMask(depthMask); | ||
4594 | 83 | if(cullFace) | ||
4595 | 84 | gl->glEnable(GL_CULL_FACE); | ||
4596 | 85 | else | ||
4597 | 86 | gl->glDisable(GL_CULL_FACE); | ||
4598 | 87 | #ifdef GL_LINE_SMOOTH | ||
4599 | 88 | if(!QOpenGLContext::currentContext()->isOpenGLES()) | ||
4600 | 89 | { | ||
4601 | 90 | if (lineSmooth) | ||
4602 | 91 | gl->glEnable(GL_LINE_SMOOTH); | ||
4603 | 92 | else | ||
4604 | 93 | gl->glDisable(GL_LINE_SMOOTH); | ||
4605 | 94 | } | ||
4606 | 95 | #endif | ||
4607 | 96 | } | ||
4608 | 97 | |||
4609 | 98 | void StelPainter::GLState::reset() | ||
4610 | 99 | { | ||
4611 | 100 | *this = GLState(gl); | ||
4612 | 101 | apply(); | ||
4613 | 78 | } | 102 | } |
4614 | 79 | 103 | ||
4615 | 80 | bool StelPainter::linkProg(QOpenGLShaderProgram* prog, const QString& name) | 104 | bool StelPainter::linkProg(QOpenGLShaderProgram* prog, const QString& name) |
4616 | @@ -85,7 +109,7 @@ | |||
4617 | 85 | return ret; | 109 | return ret; |
4618 | 86 | } | 110 | } |
4619 | 87 | 111 | ||
4621 | 88 | StelPainter::StelPainter(const StelProjectorP& proj) : prj(proj) | 112 | StelPainter::StelPainter(const StelProjectorP& proj) : QOpenGLFunctions(QOpenGLContext::currentContext()), glState(this) |
4622 | 89 | { | 113 | { |
4623 | 90 | Q_ASSERT(proj); | 114 | Q_ASSERT(proj); |
4624 | 91 | 115 | ||
4625 | @@ -106,13 +130,10 @@ | |||
4626 | 106 | } | 130 | } |
4627 | 107 | #endif | 131 | #endif |
4628 | 108 | 132 | ||
4631 | 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? |
4630 | 110 | glDisable(GL_CULL_FACE); | ||
4632 | 111 | // Fix some problem when using Qt OpenGL2 engine | 134 | // Fix some problem when using Qt OpenGL2 engine |
4633 | 112 | glStencilMask(0x11111111); | 135 | glStencilMask(0x11111111); |
4637 | 113 | // Deactivate drawing in depth buffer by default | 136 | glState.apply(); //apply default OpenGL state |
4635 | 114 | glDepthMask(GL_FALSE); | ||
4636 | 115 | enableTexture2d(false); | ||
4638 | 116 | setProjector(proj); | 137 | setProjector(proj); |
4639 | 117 | } | 138 | } |
4640 | 118 | 139 | ||
4641 | @@ -126,6 +147,9 @@ | |||
4642 | 126 | 147 | ||
4643 | 127 | StelPainter::~StelPainter() | 148 | StelPainter::~StelPainter() |
4644 | 128 | { | 149 | { |
4645 | 150 | //reset opengl state | ||
4646 | 151 | glState.reset(); | ||
4647 | 152 | |||
4648 | 129 | #ifndef NDEBUG | 153 | #ifndef NDEBUG |
4649 | 130 | GLenum er = glGetError(); | 154 | GLenum er = glGetError(); |
4650 | 131 | if (er!=GL_NO_ERROR) | 155 | if (er!=GL_NO_ERROR) |
4651 | @@ -160,6 +184,87 @@ | |||
4652 | 160 | return QFontMetrics(currentFont); | 184 | return QFontMetrics(currentFont); |
4653 | 161 | } | 185 | } |
4654 | 162 | 186 | ||
4655 | 187 | void StelPainter::setBlending(bool enableBlending, GLenum blendSrc, GLenum blendDst) | ||
4656 | 188 | { | ||
4657 | 189 | if(enableBlending != glState.blend) | ||
4658 | 190 | { | ||
4659 | 191 | glState.blend = enableBlending; | ||
4660 | 192 | if(enableBlending) | ||
4661 | 193 | glEnable(GL_BLEND); | ||
4662 | 194 | else | ||
4663 | 195 | glDisable(GL_BLEND); | ||
4664 | 196 | } | ||
4665 | 197 | if(enableBlending) | ||
4666 | 198 | { | ||
4667 | 199 | if(blendSrc!=glState.blendSrc||blendDst!=glState.blendDst) | ||
4668 | 200 | { | ||
4669 | 201 | glState.blendSrc = blendSrc; | ||
4670 | 202 | glState.blendDst = blendDst; | ||
4671 | 203 | glBlendFunc(blendSrc,blendDst); | ||
4672 | 204 | } | ||
4673 | 205 | } | ||
4674 | 206 | } | ||
4675 | 207 | |||
4676 | 208 | void StelPainter::setDepthTest(bool enable) | ||
4677 | 209 | { | ||
4678 | 210 | if(glState.depthTest != enable) | ||
4679 | 211 | { | ||
4680 | 212 | glState.depthTest = enable; | ||
4681 | 213 | if(enable) | ||
4682 | 214 | glEnable(GL_DEPTH_TEST); | ||
4683 | 215 | else | ||
4684 | 216 | glDisable(GL_DEPTH_TEST); | ||
4685 | 217 | } | ||
4686 | 218 | } | ||
4687 | 219 | |||
4688 | 220 | void StelPainter::setDepthMask(bool enable) | ||
4689 | 221 | { | ||
4690 | 222 | if(glState.depthMask != enable) | ||
4691 | 223 | { | ||
4692 | 224 | glState.depthMask = enable; | ||
4693 | 225 | if(enable) | ||
4694 | 226 | glDepthMask(GL_TRUE); | ||
4695 | 227 | else | ||
4696 | 228 | glDepthMask(GL_FALSE); | ||
4697 | 229 | } | ||
4698 | 230 | } | ||
4699 | 231 | |||
4700 | 232 | void StelPainter::setCullFace(bool enable) | ||
4701 | 233 | { | ||
4702 | 234 | if(glState.cullFace!=enable) | ||
4703 | 235 | { | ||
4704 | 236 | glState.cullFace = enable; | ||
4705 | 237 | if(enable) | ||
4706 | 238 | glEnable(GL_CULL_FACE); | ||
4707 | 239 | else | ||
4708 | 240 | glDisable(GL_CULL_FACE); | ||
4709 | 241 | } | ||
4710 | 242 | } | ||
4711 | 243 | |||
4712 | 244 | void StelPainter::setLineSmooth(bool enable) | ||
4713 | 245 | { | ||
4714 | 246 | #ifdef GL_LINE_SMOOTH | ||
4715 | 247 | if (!QOpenGLContext::currentContext()->isOpenGLES() && enable!=glState.lineSmooth) | ||
4716 | 248 | { | ||
4717 | 249 | glState.lineSmooth = enable; | ||
4718 | 250 | if(enable) | ||
4719 | 251 | glEnable(GL_LINE_SMOOTH); | ||
4720 | 252 | else | ||
4721 | 253 | glDisable(GL_LINE_SMOOTH); | ||
4722 | 254 | } | ||
4723 | 255 | #else | ||
4724 | 256 | Q_UNUSED(enable); //noop | ||
4725 | 257 | #endif | ||
4726 | 258 | } | ||
4727 | 259 | |||
4728 | 260 | void StelPainter::setLineWidth(float width) | ||
4729 | 261 | { | ||
4730 | 262 | if(glState.lineWidth != width) | ||
4731 | 263 | { | ||
4732 | 264 | glState.lineWidth = width; | ||
4733 | 265 | glLineWidth(width); | ||
4734 | 266 | } | ||
4735 | 267 | } | ||
4736 | 163 | 268 | ||
4737 | 164 | /////////////////////////////////////////////////////////////////////////// | 269 | /////////////////////////////////////////////////////////////////////////// |
4738 | 165 | // Standard methods for drawing primitives | 270 | // Standard methods for drawing primitives |
4739 | @@ -170,6 +275,7 @@ | |||
4740 | 170 | if (prj->maskType != StelProjector::MaskDisk) | 275 | if (prj->maskType != StelProjector::MaskDisk) |
4741 | 171 | return; | 276 | return; |
4742 | 172 | 277 | ||
4743 | 278 | bool oldBlendState = glState.blend; | ||
4744 | 173 | glDisable(GL_BLEND); | 279 | glDisable(GL_BLEND); |
4745 | 174 | setColor(0.f,0.f,0.f); | 280 | setColor(0.f,0.f,0.f); |
4746 | 175 | 281 | ||
4747 | @@ -219,6 +325,8 @@ | |||
4748 | 219 | } | 325 | } |
4749 | 220 | drawFromArray(TriangleStrip, (slices+1)*2, 0, false); | 326 | drawFromArray(TriangleStrip, (slices+1)*2, 0, false); |
4750 | 221 | enableClientStates(false); | 327 | enableClientStates(false); |
4751 | 328 | if(oldBlendState) | ||
4752 | 329 | glEnable(GL_BLEND); | ||
4753 | 222 | } | 330 | } |
4754 | 223 | 331 | ||
4755 | 224 | void StelPainter::computeFanDisk(float radius, int innerFanSlices, int level, QVector<double>& vertexArr, QVector<float>& texCoordArr) | 332 | void StelPainter::computeFanDisk(float radius, int innerFanSlices, int level, QVector<double>& vertexArr, QVector<float>& texCoordArr) |
4756 | @@ -530,7 +638,6 @@ | |||
4757 | 530 | 638 | ||
4758 | 531 | void StelPainter::drawText(float x, float y, const QString& str, float angleDeg, float xshift, float yshift, bool noGravity) | 639 | void StelPainter::drawText(float x, float y, const QString& str, float angleDeg, float xshift, float yshift, bool noGravity) |
4759 | 532 | { | 640 | { |
4760 | 533 | //StelPainter::GLState state; // Will restore the opengl state at the end of the function. | ||
4761 | 534 | if (prj->gravityLabels && !noGravity) | 641 | if (prj->gravityLabels && !noGravity) |
4762 | 535 | { | 642 | { |
4763 | 536 | drawTextGravity180(x, y, str, xshift, yshift); | 643 | drawTextGravity180(x, y, str, xshift, yshift); |
4764 | @@ -545,7 +652,6 @@ | |||
4765 | 545 | angleDeg += prj->defaultAngleForGravityText; | 652 | angleDeg += prj->defaultAngleForGravityText; |
4766 | 546 | tex->texture->bind(); | 653 | tex->texture->bind(); |
4767 | 547 | 654 | ||
4768 | 548 | enableTexture2d(true); | ||
4769 | 549 | static float vertexData[8]; | 655 | static float vertexData[8]; |
4770 | 550 | // compute the vertex coordinates applying the translation and the rotation | 656 | // compute the vertex coordinates applying the translation and the rotation |
4771 | 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.}; |
4772 | @@ -579,11 +685,15 @@ | |||
4773 | 579 | texCoords[i*2+1] = tex->getTexSize().height() * (1 - i / 2); | 685 | texCoords[i*2+1] = tex->getTexSize().height() * (1 - i / 2); |
4774 | 580 | } | 686 | } |
4775 | 581 | setTexCoordPointer(2, GL_FLOAT, texCoords); | 687 | setTexCoordPointer(2, GL_FLOAT, texCoords); |
4778 | 582 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 688 | |
4779 | 583 | glEnable(GL_BLEND); | 689 | //text drawing requires blending, but we reset GL state afterwards if necessary |
4780 | 690 | bool oldBlending = glState.blend; | ||
4781 | 691 | GLenum oldSrc = glState.blendSrc, oldDst = glState.blendDst; | ||
4782 | 692 | setBlending(true); | ||
4783 | 584 | enableClientStates(true, true); | 693 | enableClientStates(true, true); |
4784 | 585 | setVertexPointer(2, GL_FLOAT, vertexData); | 694 | setVertexPointer(2, GL_FLOAT, vertexData); |
4785 | 586 | drawFromArray(TriangleStrip, 4, 0, false); | 695 | drawFromArray(TriangleStrip, 4, 0, false); |
4786 | 696 | setBlending(oldBlending, oldSrc, oldDst); | ||
4787 | 587 | enableClientStates(false, false); | 697 | enableClientStates(false, false); |
4788 | 588 | tex->texture->release(); | 698 | tex->texture->release(); |
4789 | 589 | delete[] texCoords; | 699 | delete[] texCoords; |
4790 | @@ -598,7 +708,6 @@ | |||
4791 | 598 | // painter.setFont(currentFont); | 708 | // painter.setFont(currentFont); |
4792 | 599 | 709 | ||
4793 | 600 | QPainter painter(&device); | 710 | QPainter painter(&device); |
4794 | 601 | painter.beginNativePainting(); | ||
4795 | 602 | 711 | ||
4796 | 603 | QFont tmpFont = currentFont; | 712 | QFont tmpFont = currentFont; |
4797 | 604 | tmpFont.setPixelSize(currentFont.pixelSize()*prj->getDevicePixelsPerPixel()*StelApp::getInstance().getGlobalScalingRatio()); | 713 | tmpFont.setPixelSize(currentFont.pixelSize()*prj->getDevicePixelsPerPixel()*StelApp::getInstance().getGlobalScalingRatio()); |
4798 | @@ -629,7 +738,11 @@ | |||
4799 | 629 | painter.drawText(x+xshift, y+yshift, str); | 738 | painter.drawText(x+xshift, y+yshift, str); |
4800 | 630 | } | 739 | } |
4801 | 631 | 740 | ||
4803 | 632 | painter.endNativePainting(); | 741 | //important to call this before GL state restore |
4804 | 742 | painter.end(); | ||
4805 | 743 | |||
4806 | 744 | //QPainter messes up some GL state, begin/endNativePainting or save/restore does not help | ||
4807 | 745 | glState.apply(); | ||
4808 | 633 | } | 746 | } |
4809 | 634 | } | 747 | } |
4810 | 635 | 748 | ||
4811 | @@ -1462,6 +1575,8 @@ | |||
4812 | 1462 | if (!prj->getBoundingCap().intersects(poly->getBoundingCap())) | 1575 | if (!prj->getBoundingCap().intersects(poly->getBoundingCap())) |
4813 | 1463 | return; | 1576 | return; |
4814 | 1464 | 1577 | ||
4815 | 1578 | bool oldCullFace = glState.cullFace; | ||
4816 | 1579 | |||
4817 | 1465 | switch (drawMode) | 1580 | switch (drawMode) |
4818 | 1466 | { | 1581 | { |
4819 | 1467 | case SphericalPolygonDrawModeBoundary: | 1582 | case SphericalPolygonDrawModeBoundary: |
4820 | @@ -1473,7 +1588,7 @@ | |||
4821 | 1473 | case SphericalPolygonDrawModeFill: | 1588 | case SphericalPolygonDrawModeFill: |
4822 | 1474 | case SphericalPolygonDrawModeTextureFill: | 1589 | case SphericalPolygonDrawModeTextureFill: |
4823 | 1475 | case SphericalPolygonDrawModeTextureFillColormodulated: | 1590 | case SphericalPolygonDrawModeTextureFillColormodulated: |
4825 | 1476 | glEnable(GL_CULL_FACE); | 1591 | setCullFace(true); |
4826 | 1477 | // The polygon is already tesselated as triangles | 1592 | // The polygon is already tesselated as triangles |
4827 | 1478 | if (doSubDivise || prj->intersectViewportDiscontinuity(poly->getBoundingCap())) | 1593 | if (doSubDivise || prj->intersectViewportDiscontinuity(poly->getBoundingCap())) |
4828 | 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) |
4829 | @@ -1481,7 +1596,7 @@ | |||
4830 | 1481 | else | 1596 | else |
4831 | 1482 | drawStelVertexArray(poly->getFillVertexArray(), false); | 1597 | drawStelVertexArray(poly->getFillVertexArray(), false); |
4832 | 1483 | 1598 | ||
4834 | 1484 | glDisable(GL_CULL_FACE); | 1599 | setCullFace(oldCullFace); |
4835 | 1485 | break; | 1600 | break; |
4836 | 1486 | default: | 1601 | default: |
4837 | 1487 | Q_ASSERT(0); | 1602 | Q_ASSERT(0); |
4838 | @@ -1822,11 +1937,6 @@ | |||
4839 | 1822 | glCullFace(GL_BACK); | 1937 | glCullFace(GL_BACK); |
4840 | 1823 | } | 1938 | } |
4841 | 1824 | 1939 | ||
4842 | 1825 | void StelPainter::enableTexture2d(bool b) | ||
4843 | 1826 | { | ||
4844 | 1827 | texture2dEnabled = b; | ||
4845 | 1828 | } | ||
4846 | 1829 | |||
4847 | 1830 | void StelPainter::initGLShaders() | 1940 | void StelPainter::initGLShaders() |
4848 | 1831 | { | 1941 | { |
4849 | 1832 | qDebug() << "Initializing basic GL shaders... "; | 1942 | qDebug() << "Initializing basic GL shaders... "; |
4850 | 1833 | 1943 | ||
4851 | === modified file 'src/core/StelPainter.hpp' | |||
4852 | --- src/core/StelPainter.hpp 2016-05-01 05:52:39 +0000 | |||
4853 | +++ src/core/StelPainter.hpp 2017-01-12 21:08:38 +0000 | |||
4854 | @@ -1,4 +1,4 @@ | |||
4856 | 1 | /* | 1 | /* |
4857 | 2 | * Stellarium | 2 | * Stellarium |
4858 | 3 | * Copyright (C) 2008 Fabien Chereau | 3 | * Copyright (C) 2008 Fabien Chereau |
4859 | 4 | * | 4 | * |
4860 | @@ -37,7 +37,7 @@ | |||
4861 | 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. |
4862 | 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. |
4863 | 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. |
4865 | 40 | class StelPainter | 40 | class StelPainter : protected QOpenGLFunctions |
4866 | 41 | { | 41 | { |
4867 | 42 | public: | 42 | public: |
4868 | 43 | friend class VertexArrayProjector; | 43 | friend class VertexArrayProjector; |
4869 | @@ -66,6 +66,11 @@ | |||
4870 | 66 | explicit StelPainter(const StelProjectorP& prj); | 66 | explicit StelPainter(const StelProjectorP& prj); |
4871 | 67 | ~StelPainter(); | 67 | ~StelPainter(); |
4872 | 68 | 68 | ||
4873 | 69 | //! Returns a QOpenGLFunctions object suitable for drawing directly with OpenGL while this StelPainter is active. | ||
4874 | 70 | //! This is recommended to be used instead of QOpenGLContext::currentContext()->functions() when a StelPainter is available, | ||
4875 | 71 | //! and you only need to call a few GL functions directly. | ||
4876 | 72 | inline QOpenGLFunctions* glFuncs() { return this; } | ||
4877 | 73 | |||
4878 | 69 | //! Return the instance of projector associated to this painter | 74 | //! Return the instance of projector associated to this painter |
4879 | 70 | const StelProjectorP& getProjector() const {return prj;} | 75 | const StelProjectorP& getProjector() const {return prj;} |
4880 | 71 | void setProjector(const StelProjectorP& p); | 76 | void setProjector(const StelProjectorP& p); |
4881 | @@ -227,6 +232,25 @@ | |||
4882 | 227 | //! Get the font metrics for the current font. | 232 | //! Get the font metrics for the current font. |
4883 | 228 | QFontMetrics getFontMetrics() const; | 233 | QFontMetrics getFontMetrics() const; |
4884 | 229 | 234 | ||
4885 | 235 | //! Enable OpenGL blending. By default, blending is disabled. | ||
4886 | 236 | //! The additional parameters specify the blending mode, the default parameters are suitable for | ||
4887 | 237 | //! "normal" blending operations that you want in most cases. Blending will be automatically disabled when | ||
4888 | 238 | //! the StelPainter is destroyed. | ||
4889 | 239 | void setBlending(bool enableBlending, GLenum blendSrc = GL_SRC_ALPHA, GLenum blendDst = GL_ONE_MINUS_SRC_ALPHA); | ||
4890 | 240 | |||
4891 | 241 | void setDepthTest(bool enable); | ||
4892 | 242 | |||
4893 | 243 | void setDepthMask(bool enable); | ||
4894 | 244 | |||
4895 | 245 | //! Set the OpenGL GL_CULL_FACE state, by default face culling is disabled | ||
4896 | 246 | void setCullFace(bool enable); | ||
4897 | 247 | |||
4898 | 248 | //! Enables/disables line smoothing. By default, smoothing is disabled. | ||
4899 | 249 | void setLineSmooth(bool enable); | ||
4900 | 250 | |||
4901 | 251 | //! Sets the line width. Default is 1.0f. | ||
4902 | 252 | void setLineWidth(float width); | ||
4903 | 253 | |||
4904 | 230 | //! Create the OpenGL shaders programs used by the StelPainter. | 254 | //! Create the OpenGL shaders programs used by the StelPainter. |
4905 | 231 | //! This method needs to be called once at init. | 255 | //! This method needs to be called once at init. |
4906 | 232 | static void initGLShaders(); | 256 | static void initGLShaders(); |
4907 | @@ -235,9 +259,6 @@ | |||
4908 | 235 | //! This method needs to be called once before exit. | 259 | //! This method needs to be called once before exit. |
4909 | 236 | static void deinitGLShaders(); | 260 | static void deinitGLShaders(); |
4910 | 237 | 261 | ||
4911 | 238 | //! Set whether texturing is enabled. | ||
4912 | 239 | void enableTexture2d(bool b); | ||
4913 | 240 | |||
4914 | 241 | // Thoses methods should eventually be replaced by a single setVertexArray | 262 | // Thoses methods should eventually be replaced by a single setVertexArray |
4915 | 242 | //! use instead of glVertexPointer | 263 | //! use instead of glVertexPointer |
4916 | 243 | void setVertexPointer(int size, int type, const void* pointer) { | 264 | void setVertexPointer(int size, int type, const void* pointer) { |
4917 | @@ -262,7 +283,7 @@ | |||
4918 | 262 | normalArray.size = 3; normalArray.type = type; normalArray.pointer = pointer; | 283 | normalArray.size = 3; normalArray.type = type; normalArray.pointer = pointer; |
4919 | 263 | } | 284 | } |
4920 | 264 | 285 | ||
4922 | 265 | //! use instead of glEnableClient | 286 | //! Simulates glEnableClientState, basically you describe what data the ::drawFromArray call has available |
4923 | 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); |
4924 | 267 | 288 | ||
4925 | 268 | //! convenience method that enable and set all the given arrays. | 289 | //! convenience method that enable and set all the given arrays. |
4926 | @@ -290,17 +311,27 @@ | |||
4927 | 290 | friend class StelTextureMgr; | 311 | friend class StelTextureMgr; |
4928 | 291 | friend class StelTexture; | 312 | friend class StelTexture; |
4929 | 292 | 313 | ||
4933 | 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 |
4934 | 294 | //! to use it we just need to instanciate it at the beginning of a method that might change the state. | 315 | struct GLState |
4932 | 295 | class GLState | ||
4935 | 296 | { | 316 | { |
4939 | 297 | public: | 317 | GLState(QOpenGLFunctions *gl); |
4940 | 298 | GLState(); | 318 | |
4941 | 299 | ~GLState(); | 319 | bool blend; |
4942 | 320 | GLenum blendSrc, blendDst; | ||
4943 | 321 | bool depthTest; | ||
4944 | 322 | bool depthMask; | ||
4945 | 323 | bool cullFace; | ||
4946 | 324 | bool lineSmooth; | ||
4947 | 325 | GLfloat lineWidth; | ||
4948 | 326 | |||
4949 | 327 | //! Applies the values stored here to set the GL state | ||
4950 | 328 | void apply(); | ||
4951 | 329 | //! Resets the state to the default values (like a GLState was newly constructed) | ||
4952 | 330 | //! and calls apply() | ||
4953 | 331 | void reset(); | ||
4954 | 300 | private: | 332 | private: |
4958 | 301 | bool blend; | 333 | QOpenGLFunctions* gl; |
4959 | 302 | int blendSrcRGB, blendDstRGB, blendSrcAlpha, blendDstAlpha; | 334 | } glState; |
4957 | 303 | }; | ||
4960 | 304 | 335 | ||
4961 | 305 | // From text-use-opengl-buffer | 336 | // From text-use-opengl-buffer |
4962 | 306 | static QCache<QByteArray, struct StringTexture> texCache; | 337 | static QCache<QByteArray, struct StringTexture> texCache; |
4963 | @@ -352,7 +383,6 @@ | |||
4964 | 352 | QFont currentFont; | 383 | QFont currentFont; |
4965 | 353 | 384 | ||
4966 | 354 | Vec4f currentColor; | 385 | Vec4f currentColor; |
4967 | 355 | bool texture2dEnabled; | ||
4968 | 356 | 386 | ||
4969 | 357 | static QOpenGLShaderProgram* basicShaderProgram; | 387 | static QOpenGLShaderProgram* basicShaderProgram; |
4970 | 358 | struct BasicShaderVars { | 388 | struct BasicShaderVars { |
4971 | 359 | 389 | ||
4972 | === modified file 'src/core/StelSkyDrawer.cpp' | |||
4973 | --- src/core/StelSkyDrawer.cpp 2017-01-06 02:19:00 +0000 | |||
4974 | +++ src/core/StelSkyDrawer.cpp 2017-01-12 21:08:38 +0000 | |||
4975 | @@ -17,12 +17,6 @@ | |||
4976 | 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. |
4977 | 18 | */ | 18 | */ |
4978 | 19 | 19 | ||
4979 | 20 | #ifndef GL_POINT_SPRITE | ||
4980 | 21 | #define GL_POINT_SPRITE 0x8861 | ||
4981 | 22 | #endif | ||
4982 | 23 | #ifndef GL_VERTEX_PROGRAM_POINT_SIZE | ||
4983 | 24 | #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 | ||
4984 | 25 | #endif | ||
4985 | 26 | 20 | ||
4986 | 27 | #include "StelSkyDrawer.hpp" | 21 | #include "StelSkyDrawer.hpp" |
4987 | 28 | #include "StelProjector.hpp" | 22 | #include "StelProjector.hpp" |
4988 | @@ -156,6 +150,8 @@ | |||
4989 | 156 | // Init parameters from config file | 150 | // Init parameters from config file |
4990 | 157 | void StelSkyDrawer::init() | 151 | void StelSkyDrawer::init() |
4991 | 158 | { | 152 | { |
4992 | 153 | initializeOpenGLFunctions(); | ||
4993 | 154 | |||
4994 | 159 | // Load star texture no mipmap: | 155 | // Load star texture no mipmap: |
4995 | 160 | texHalo = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/star16x16.png"); | 156 | texHalo = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/star16x16.png"); |
4996 | 161 | texBigHalo = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/haloLune.png"); | 157 | texBigHalo = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/haloLune.png"); |
4997 | @@ -382,9 +378,7 @@ | |||
4998 | 382 | 378 | ||
4999 | 383 | // Blending is really important. Otherwise faint stars in the vicinity of | 379 | // Blending is really important. Otherwise faint stars in the vicinity of |
5000 | 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. |
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.