It is currently Mon, 24-09-18, 2:24 GMT

All times are UTC




Post new topic Reply to topic  [ 65 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: QT5
PostPosted: Fri, 28-11-14, 16:31 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
OK. This is as far as I'm gonna take this.
First some context.
I'm now using Visual Studio C++ Express 2013 with Qt5.3.2.
This should also work with the Visual Studio C++ Express 2010 but I haven't tested it. I will need to install another qt5.3.2 for that compiler. I cleaned out those versions when I had trouble reinstalling Visual Studio C++ Express 2010.

The following patch is a minimal fix. It virtually uses a splash screen. The splash screen is being executed by splash.show(); and splash.finish(&mainWindow); but there doesn't have to be a splash.png in the build directory for it to work. The program starts, doesn't show a splash screen and goes on running normally if there is no splash.png. If someone wants to create a splash.png then it will work cause I tested it with Celestia's splash.png. It needs to be placed in the build directory where the Cosmographia.exe is located.

This minimal fix does not include the code I used to create the opengl info window which I posted an image of above. This is something I'm playing with. Out of respect for Chris, I'm just posting the minimal fixes needed to compile it 0n msvc 2013, fix a couple of the menu items, and to stop it from crashing. So here is the patch.
I removed this patch. Although it worked it was not the final solution. I'll post that in a post that follows.
cartrite


Last edited by cartrite on Sun, 30-11-14, 15:27 GMT, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Fri, 28-11-14, 16:56 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4577
Location: Hamburg, Germany
Hi Steve,

many thanks for the hard work. I'll try your patch later today also with Linux (openSuSE 13.1).

Fridger

_________________
Image


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Fri, 28-11-14, 22:24 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
Your Welcome Fridger,
Hopefully this works on Linux too.
I'm still sure there is a better way though.
But I've learned a few things while dealing with this. I also came up with many questions. The job now is to find the answers to those questions. ;)
Two questions that I dare to ask and will not be able to find out through experience, Did the original even code work on a Mac? If so, why?
Have a good one.
cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sat, 29-11-14, 9:41 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4577
Location: Hamburg, Germany
Steve,

I implemented your patch into Cosmographia, r824, for openSuSE 13.1. The code builds and runs fine, but the splash.png (from Celestia) is NOT displayed. It was placed in the same dir as the executable Cosmographia program.

Instead of your three "glInfo" lines in the previous patch (Cosmographia.cpp), you might just do this 1-liner:
QMessageBox::warning(this, "Info: ", "This is a temporary fix.<br>\nClose to continue");

Anyway, without such a QMessageBox insert, the program crashes with a runtime error...

Sorry, I don't have enough spare time to debug these issues further.

Fridger
PS:
Quote:
Did the original even code work on a Mac? If so, why?
Have a good one.

ChrisL develops on a Mac since a long time!

_________________
Image


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sat, 29-11-14, 14:12 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
t00fri wrote:
Steve,

I implemented your patch into Cosmographia, r824, for openSuSE 13.1. The code builds and runs fine, but the splash.png (from Celestia) is NOT displayed. It was placed in the same dir as the executable Cosmographia program.
EDIT: I started the program without fullscreen. The splash screen was displayed UNDER the main window. So that could be why you didn't see it. If you start the program and set it to fullscreen and then exit. it will start up the next time in full screen and the splash should be visible. /EDIT: That's weird. It is displayed with windows. Maybe it is displayed under the main window. When the windows version starts the main window is black and the splash appears in the middle of a full screen. It then disappears and the program starts. If the splash displays before the main window, it still crashes.
t00fri wrote:
Instead of your three "glInfo" lines in the previous patch (Cosmographia.cpp), you might just do this 1-liner:
QMessageBox::warning(this, "Info: ", "This is a temporary fix.<br>\nClose to continue");

Anyway, without such a QMessageBox insert, the program crashes with a runtime error...
That's more elegant. But I like the splash screen approach better. Even if it doesn't work, it still gets the program to stop crashing. That's the only reason it was used anyhow.
t00fri wrote:
Sorry, I don't have enough spare time to debug these issues further.

I'm out of time myself. I'll still play with it from time to time. Maybe I'll come up with something better.
t00fri wrote:
Fridger
PS:
Quote:
Did the original even code work on a Mac? If so, why?
Have a good one.

ChrisL develops on a Mac since a long time!

This has haunted my way of debugging this. I always assumed it worked on a Mac. So most of the time I spent on this was looking for something that is Mac specific that also needs to be done for linux and windows.

cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sat, 29-11-14, 15:35 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4577
Location: Hamburg, Germany
Steve,

since I coded a neat splash screen setting quite some time ago for celestia.Sci, I know how to do a complete splash environment in an elegant and stable way, according to the Qt4 rules. Unfortunately, for now at least, I have no time left for coding the stuff properly in case of Cosmographia. The latter is not my "glass of beer" anyway...;-)

Actually, the start-up loading time seems too short for showing a splash at least with my machine. Just about a couple of seconds ... It's certainly a better approach to understand that crash and leave the splash alone.

Cheers,
Fridger

_________________
Image


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sat, 29-11-14, 17:49 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
I agree that there is a better way. And I'm still looking for the real cause of it crashing. Just don't got the time right now. Experimenting with the splash code that I used tells me that something is going wrong during the main window setup. It seems to disable OpenGL. If the splash code goes before the main window setup, it still crashes. If it goes after the main window setup it runs but doesn't the splash doesn't display.
cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sun, 30-11-14, 5:55 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
Well I think I finally found the crash problem. I was moving the messagebox around Cosmographia.cpp and located the exact line where the messagebox had to follow. It was this line. (m_view3d->initializeDeclarativeUi("qml/main.qml");) That got me looking at documentation for qml. There are a lot of changes that need to be made. New headers to put in. Headers to take out. Names to change etc. Can't see me doing this any time soon. Here are the pages I was looking at.
http://qt-project.org/doc/qt-5/qtquick-porting-qt5.html
http://qt-project.org/doc/qt-5/qtqml-releasenotes.html
cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sun, 30-11-14, 15:40 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
Well, I lucked out. After reading those pages from in my last post, I noticed that the old way of doing qml is still supported. So on finding a good spot for creating a gl context, I created a context with the defaiult format and plugged it in. Then I was able to use glewInit to get it to work. I'm sure there is a more elegant way but with my limited experience with OpenGL and C++, this is the best I can come with.
I removed patches that I posted before to limit confusion. So here it is, hopefully it works with linux too. It does work with qt5.3.2 and Visual Studio 2013.
I had to remove this cause the atmospheres were not working.

Now, for a BEER. ;) Holding off on the beer for now. :(
PS, I'm not sure if the messagebox will kick start the program if glewInit returns NULL. But it was with the other patches.
cartrite


Last edited by cartrite on Sun, 30-11-14, 17:03 GMT, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sun, 30-11-14, 16:56 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4577
Location: Hamburg, Germany
Steve,

good work!
Now things work fine also for openSuSE 13.1! With the splash code retained, the splash.png was even shown now for a fraction of a second ;-). But I deleted it, since the whole loading time is barely 2 seconds.

Enjoy your beer ;-)

Fridger

PS: I also used Qt 5.3.2 from the Qt site and the latest gcc 4.8.1.

_________________
Image


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sun, 30-11-14, 17:01 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
t00fri wrote:
Steve,

good work!
Now things work fine also for openSuSE 13.1! With the splash code retained, the splash.png was even shown now for a fraction of a second ;-). But I deleted it, since the whole loading time is barely 2 seconds.

Enjoy your beer ;-)

Fridger

PS: I also used Qt 5.3.2 from the Qt site and the latest gcc 4.8.1.


I got too far ahead of myself. I was so happy to see it not crash, I didn't check too see if everything was working. I get warnings that glsl 1.2 is getting used. No atmospheres. Need to work on this some more. I gonna remove that patch I just posted.
Holding off on the beer for now. :(
cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sun, 30-11-14, 17:26 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4577
Location: Hamburg, Germany
cartrite wrote:
t00fri wrote:
Steve,

good work!
Now things work fine also for openSuSE 13.1! With the splash code retained, the splash.png was even shown now for a fraction of a second ;-). But I deleted it, since the whole loading time is barely 2 seconds.

Enjoy your beer ;-)

Fridger

PS: I also used Qt 5.3.2 from the Qt site and the latest gcc 4.8.1.


I got too far ahead of myself. I was so happy to see it not crash, I didn't check too see if everything was working. I get warnings that glsl 1.2 is getting used. No atmospheres. Need to work on this some more. I gonna remove that patch I just posted.
Holding off on the beer for now. :(
cartrite


Here, the glsl 1.2. shader code seems to works fine, doesn't generate a warning and the atmospheres are properly rendered. Earth is a black disk initially and needs to have the texture loaded by hand. Then the atmosphere is also rendered.

Yet in the Setup/add-ons panel, NO file paths are found, which generates a corresponding warning if you switch any of the add-ons from OFF to ON state.

Fridger

_________________
Image


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sun, 30-11-14, 18:11 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
I didn't try to load the atmosphere texture by hand. That may have worked. I found the code works and earth's atmosphere is loaded automatically now. It seems the placement of the code was in a bad place. I moved it to main.cpp and now everything works fine. Also, apparently, some of the lines were not needed so I eliminated them.
Code:
Index: cosmographia.pro
===================================================================
--- cosmographia.pro   (revision 824)
+++ cosmographia.pro   (working copy)
@@ -8,6 +8,8 @@
 QT += opengl
 QT += network
 QT += declarative
+QT += widgets
+QT += gui
 
 
 #### App sources ####
Index: src/main/Cosmographia.cpp
===================================================================
--- src/main/Cosmographia.cpp   (revision 824)
+++ src/main/Cosmographia.cpp   (working copy)
@@ -14,7 +14,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include <QtGui>
+#include <QtWidgets>
 
 #include "UniverseView.h"
 #include "GalleryView.h"
@@ -216,7 +216,7 @@
     multipleTimeAction->setData(int(UniverseView::TimeDisplay_Multiple));
     timeDisplayMenu->addAction(multipleTimeAction);
     timeMenu->addMenu(timeDisplayMenu);
-    connect(timeDisplayGroup, SIGNAL(selected(QAction*)), this, SLOT(setTimeDisplay(QAction*)));
+    connect(timeDisplayGroup, SIGNAL(triggered(QAction *)), this, SLOT(setTimeDisplay(QAction*)));
 
     timeMenu->addSeparator();
     QAction* pauseAction = new QAction("&Pause", this);
@@ -448,8 +448,8 @@
     connect(sunGlareAction,         SIGNAL(triggered(bool)), m_view3d, SLOT(setSunGlare(bool)));
     connect(reflectionsAction,      SIGNAL(triggered(bool)), m_view3d, SLOT(setReflections(bool)));
     connect(milkyWayAction,         SIGNAL(triggered(bool)), m_view3d, SLOT(setMilkyWayVisible(bool)));
-    connect(starStyleGroup,         SIGNAL(selected(QAction*)), this, SLOT(setStarStyle(QAction*)));
-    connect(stereoModeGroup,        SIGNAL(selected(QAction*)), this, SLOT(setStereoMode(QAction*)));
+    connect(starStyleGroup,         SIGNAL(triggered(QAction *)), this, SLOT(setStarStyle(QAction*)));
+    connect(stereoModeGroup,        SIGNAL(triggered(QAction *)), this, SLOT(setStereoMode(QAction*)));
 
     /*** Help menu ***/
     QMenu* helpMenu = new QMenu("Help", this);
@@ -733,8 +733,8 @@
     // Set up the texture loader
     m_loader->setTextureLoader(dynamic_cast<PathRelativeTextureLoader*>(m_view3d->textureLoader()));
 
-    loadCatalogFile("solarsys.json");
-    loadCatalogFile("start-viewpoints.json");
+//    loadCatalogFile("solarsys.json");
+//    loadCatalogFile("start-viewpoints.json");
 
     loadGallery("gallery/gallery.json");
 
Index: src/main/main.cpp
===================================================================
--- src/main/main.cpp   (revision 824)
+++ src/main/main.cpp   (working copy)
@@ -14,6 +14,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+//#include <QMessageBox>
 #include <QApplication>
 #include <QDir>
 #include <QMessageBox>
@@ -109,6 +110,7 @@
     }
 
     Cosmographia mainWindow;
+//    QMessageBox::warning(NULL, "GL Info", "GL had a problem initializing.<br>\nShould be OK now.<br>\nClick OK to continue.");
     mainWindow.initialize();
     mainWindow.show();
 
Index: src/main/UniverseView.cpp
===================================================================
--- src/main/UniverseView.cpp   (revision 824)
+++ src/main/UniverseView.cpp   (working copy)
@@ -18,7 +18,6 @@
 
 #include <cmath>
 
-#include <QGLWidget>
 
 #include <vesta/OGLHeaders.h>
 #include "UniverseView.h"
@@ -88,6 +87,7 @@
 
 #include <Eigen/LU>
 
+#include <QGLWidget>
 #include <QSettings>
 #include <QAction>
 #include <QMenu>
Index: thirdparty/Eigen/Core
===================================================================
--- thirdparty/Eigen/Core   (revision 824)
+++ thirdparty/Eigen/Core   (working copy)
@@ -9,6 +9,9 @@
   #if (_MSC_VER >= 1500) // 2008 or later
     // Remember that usage of defined() in a #define is undefined by the standard.
     // a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP.
+        #if (_MSC_VER >= 1800)
+            #include <algorithm>
+        #endif
     #if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(_M_X64)
       #define EIGEN_SSE2_ON_MSVC_2008_OR_LATER
     #endif   

PS. I've edited this post to replace the patch with the minimal patch. It's getting too confusing because messageboxes and spashscreens get it to work automatically. For some reason, the atmosphere part of the solarsys.json catalog file seems to be unloaded and I haven't figured out why. At start up, no atmospheres. If you reload solarsys.json, the atmospheres work.
Now, Time for a Beer. ;) Never did drink that beer. Think I'll have it now. Maybe a few more too. ;)
I'll have to look into this addon problem you mentioned. I haven't tried that. All my time was trying to figure this out.
cartrite


Last edited by cartrite on Sun, 30-11-14, 22:39 GMT, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Mon, 01-12-14, 2:55 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
I replaced the patch again because it was not working as expected. The catalog file solarsys.json needed to be reloaded to get atmospheres to work, The debugger was showing me that it was just repeating the code that occurred at start up. So I decided the best approach for now is to disable the loading of the 2 catalog files during initialization. "solarsy.json" and "start-viewpoints.json". They are commented out on lines 736 and 737 in Cosmographia.cpp. The patch includes a messagebox that has been commented out in main.cpp. Lines 17 and 113. Remove the comment slashes and it will use the messagbox approach to get this program to work.

If you apply the patch as is, you'll need to load those 2 catalog files manually. "solarsy.json" needs to be loaded first and it does take a while. Probably because it needs to generate the atmosphere textures. "start-viewpoints.json" loads in seconds. It would need to be loaded 2nd. Then everything should work. Except for addons. Haven't started looking at that yet.

I think I need to find a way, if possible, to get the glcontext to share the one I create or get the one that is created in the program to be shared while generating the atmosphere textures. Right now, I got no idea on how to do that.

The one thing I do know is QT5 is a freaking pain.

cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Mon, 01-12-14, 3:32 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
t00fri wrote:
Yet in the Setup/add-ons panel, NO file paths are found, which generates a corresponding warning if you switch any of the add-ons from OFF to ON state.

Fridger

One needs to copy and paste the examples folder into the data folder. Then rename it to addons.

They work. Here is a screen shot of io .

Attachment:
screen1.jpg
screen1.jpg [ 149.28 KiB | Viewed 2293 times ]


And a small mp4.

https://drive.google.com/file/d/0B4ES1R ... sp=sharing

I actually like this one better.

https://drive.google.com/file/d/0B4ES1R ... sp=sharing

PS I posted a lot of patches in the last few days and I can see why one waits to make any code public. :oops:

cartrite


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 65 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group