It is currently Mon, 15-10-18, 15:08 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: Wed, 12-11-14, 18:09 GMT 
Offline
Site Admin
User avatar

Joined: Fri, 31-08-07, 7:01 GMT
Posts: 4578
Location: Hamburg, Germany
chuft-captain wrote:
My apologies for my rather random posting in that other thread ... pure laziness on my part, especially as the OP, I should have shown a bit more discipline in not changing the topic of conversation so much.


Never mind! To me action & competence are more important than over-disciplined threads...

Fridger ;-)

_________________
Image


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Wed, 12-11-14, 18:26 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
I didn't mind either. I just want to try and keep things together.

Anyhow, I'm no longer confused and getting closer to an answer.
It seems that a table is being read in at startup thru the program universeloader.cpp. This calls generateTextures which is supposed to generate a texture from the catalog file. I think. The data seems good until the generateInscatterTexture(); is called. The data changes to memory access errors on the first line of that part of the program. So I'm thinking something upstream is somehow corrupting the data.
cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Wed, 12-11-14, 21:54 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
This be give someone an idea of what is really going on here. I can't figure it out. This same code has no problem with qt4. But crashes in qt5.
Image 0 is a screenshot of the debugger. Here it is.

Attachment:
screen0.jpg
screen0.jpg [ 399.92 KiB | Viewed 2784 times ]


Notice to the right, there are a lot of numbers in brackets. If I expand 1 of these it will show 4 valid float values.
The texture has been generated from the previous table. When I resume the program to the next break point I get this.

Attachment:
screen1.jpg
screen1.jpg [ 488.93 KiB | Viewed 2784 times ]


The only thing I can think of is not enough memory is being allocated to the program. Hence the segmentation fault.
This could be a bug with qt5? This same code does work in qt4.
We seem to be sure that this is effecting linux and windows. Maybe someone can try building r824 on a Mac and see if that works.
cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sat, 15-11-14, 19:48 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
I think this is what is causing the crash when atmospheres are drawn.
I seen it on this forum thread.
http://qt-project.org/forums/viewthread/14446/
In particular this post.
Quote:
This has ceased working in Qt 5. QGLWidget automatically includes QGLFunctions, which blows away glew. This ought to be fixed.

I found the program runs as long as this code is commented out.
Code:
    glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA32F, m_scatterSunAngleSamples, m_scatterViewAngleSamples, m_scatterHeightSamples, 0, GL_RGBA, GL_FLOAT, &m_inscatterTable[0]);
It does this but crashes on the next line.
cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sat, 15-11-14, 20:51 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
Well. Some progress. I figured out what was causing the compile errors in UniverseView.cpp. The line #include <QGLWidget> had to be moved below all the vesta headers. Anyhow, it builds but still crashes when trying to generate the atmosphere textures. :wall:


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

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
These are the only changes needed to get cosmographia to build and run on qt5. I started with a complete unaltered version r824 and this is as short as I can make it. It just fixes the menu problem and problems with building the code. The change to Atmosphere.cpp is what was needed to stop it from crashing. I can't figure out why that is happening yet.


EDIT: Just to add to this, I think it would be wise to either have all pure gl code or all qt5 gl code in the project. Mixing the two just doesn't work. ;) There may not be a simple cure for this bug. It's been around a while too.
https://code.google.com/p/cosmographia/ ... tail?id=27


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

Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Mon, 17-11-14, 1:46 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
I tried an experiment by using the code on this page.
https://devtalk.nvidia.com/default/topi ... -than-pbo/
I pasted the rgba32 float code in the area where it crashes and commented out the real code. And it still crashed. It just can't run the glTexImage3D function.
I also tried to initialize glTexImage3D manually with this code.That didn't work either but a strange thing happened. Before I put windows.h in, the wglGetProcAddress identifier wasn't found so it wouldn't compile. At first I commented it out and it ran through the generate textures but crashed later on a read violation. Oh well, I'm out of ideas.

cartrite


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

Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Thu, 20-11-14, 0:00 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
I ran into problems and to shorten the story, mvsc 2010 express doesn't work anymore on my system. 2013 mvsc does. So. Here is a patch to work with msvc2013. With cosmographia that is.
Code:
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   

Wiedersehen


Last edited by cartrite on Tue, 25-11-14, 13:36 GMT, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Fri, 21-11-14, 23:01 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
Instead of using sdk7.1, I installed sdk 8. And now I'm using that debugger. Wouldn't you know it, I actually get debugging info that makes sense. I spent a lot of time trying stuff that didn't need trying. I'm almost completely convinced that the issues I have been seeing with cosmographia are a qt5 problem. In other words, what I'm seeing in the debug info is saying the size is right and it is a power of 2. The two first things to look for when glTexImage3D is used and causes a problem.
PS I'm just copying this here to put an end to this issue. That is unless I find a solution. It was also posted in another thread
cartrite


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

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

thanks very much for your extensive efforts! While they may not constitute the final solution for Cosmographia, there is a lot to be learned for everyone from your various attempts...

Fridger

PS: I'll soon investigate Qt5 from my perspective, when trying to implement 3D positional sound for milli-second pulsars into celestia.Sci. After plenty of coding with Qt 4.x, I sure know how to do things safely with Qt4. I hope this strategy will continue into Qt5.

_________________
Image


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

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

thanks very much for your extensive efforts! While they may not constitute the final solution for Cosmographia, there is a lot to be learned for everyone from your various attempts...

Fridger

Ihr willkommen (babylon translation.) ;)

t00fri wrote:
PS: I'll soon investigate Qt5 from my perspective, when trying to implement 3D positional sound for milli-second pulsars into celestia.Sci. After plenty of coding with Qt 4.x, I sure know how to do things safely with Qt4. I hope this strategy will continue into Qt5.


I did a lot of searching for similar problems that Cosmographia has and the answer most often given was don't use Glew with Qt5. So....... Celestia builds and runs and uses Glew. But I can for see a version of qt where this will end. On another note, I read somewhere that the compilers are almost caught up implementing the c++11 standard. But now there is a c++14 standard. x/

Anyhow, I thought this may be worth a mention.
First, some context. There are 3 files in the data folder that load the atmospheres. One for Earth, Mars, and Titan. Each body has 2 textures. Transmittance and Scatter.
With the qt5 version, when I run the new debugger with break points at both texture generators, I get a zero value for the texture ID's. But it still runs if the scatter texture is disabled. Even though the 3 ID's for the transmittance texture are zero. What's interesting is the qt4 version starts with a value of 8. The Earth's transmittance texture has the 8 value, the Earth's scatter texture has a 9 value. Then Mar's transmittance texture is 10, and so on. Until I saw it run with the qt5 version having 3 zero values for the transmittance textures, I thought this was something but it's just another mystery. Oh well.


cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Sun, 23-11-14, 2:13 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
A sort of fix for this. ;) It's ugly and I'm sure there is a better way but...... Getting there.
This little bit of code placed in the help menu section of Cosmographia.cpp fixes the atmospheres and stops the crash.
Code:
    QMessageBox glInfo(this);
    glInfo.setText("This is a temporary fix.<br>\nClose to continue");
    glInfo.exec();



I was actually attempting to create a help menu box that list the opengl info like celestia does. I was just getting started and got rid of the compile errors when I hit the debug button instead of the build button. What a surprise when I seen a box appear and and the program kept running with atmospheres and all. :clap: That kinda sidetracked me and I settled for this hack ;) . It was QDialog that first got it running. But it seems that a box that is initialized at start up with opengl info will get this program to stop crashing.


Time for another beer. :clap:
cartrite


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

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

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
I was wrong. :wall:
Creating another help menu item that shows opengl info doesn't stop it from crashing.
Attachment:
screen3.jpg
screen3.jpg [ 306.78 KiB | Viewed 2487 times ]

Attachment:
screen4.jpg
screen4.jpg [ 205.94 KiB | Viewed 2487 times ]

It looks as if the program only has basic gl 1.1 capabilities until that message box is executed. Using glewInit does no good. Looking at the value for the texture ID's seem to show that none of the gl statements in atmosphere.cpp is working properly. Actually, I read in a couple of places that only OpenGL 1.1 is hardcoded at build time. All GL symbols that still need loading do it at run time. Until a dialog or message box is called in in qt5, the program thinks it only has GL1.1 and can't execute statements like glGenTextures, glBindTexture, etc. That 2nd image above shows the GL version and its capabilities but that same box is virtually blank if it draws before the messagebox or qdialog were used. As it did on my first attempt when I discovered all this.

After getting GL working with the messagebox and inserting a break point at the spot where it usually crashes debug info shows valid values for the texture ID's. These instructions execute after the box is closed. It looks like all the instructions need to be manually loaded.
But I think I'm gonna take a break from this. For sure this time. At least I think I know why it is happening.
cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Tue, 25-11-14, 23:03 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
Well back at it again. ;)
A new development. Unfortunately, I didn't get the expected results. I tried to start a splash screen like Celestia does in main.cpp but it still crashed.
However, after replacing the messagebox code with the splash screen code, it runs better. By that I mean there is no visual effects. The user sees the program starting normally.

But since this is experimental, this seems to tell me that the gl context is getting destroyed somewhere between main.cpp and Cosmographia.cpp. Running a spash screen in Cosmographia.cpp seems to get the gl context back to a workable state for vesta to generate the atmosphere textures even though it never appears. When the code is in main.cpp the splash screen appears but it still crashes.

I should probably just create a gl context and make it current. But I don't know how. Such a context will need to be in a proper place and be a proper context. But the splash screen code seems to do what I'm trying to do. I just don't know what the splash screen is really doing. :|
Here is the splash screen code I used.
The headers.
Code:
#include <QSplashScreen>
#include <QPixmap>
#include <QBitmap>

The executable code.
Code:
    QPixmap pixmap("splash.png");
    QSplashScreen splash(pixmap);
    splash.setMask(pixmap.mask());
    splash.show();

Used from Celestia. Placed into Cosmographia.cpp in the help menu section. ;)

EDIT: Theb3rd line from the executable code can be commented out. Its line 4 that stops the crash. Comment out that line and..... crash. The compiler needs the first2 to compile the last line. An event re initializes GL. This something that should be fixed with QT5. Amen.
cartrite


Top
 Profile  
 
 Post subject: Re: QT5
PostPosted: Thu, 27-11-14, 0:34 GMT 
Offline
User avatar

Joined: Thu, 25-10-07, 15:20 GMT
Posts: 992
Location: NE PA, USA
This is confusing me. That so called fix mentioned above is placed in the help menu section. This code is executed after the atmospheres are generated. Or so it seems. The splash.show(); line of code needs to be there or the program crashes. But it hasn't been executed yet when the atmospheres are generated. It's like which came first, the chicken or the egg. :? Maybe I'm not reading the flow of the code right. I give up.
Happy Thanksgiving Day for those who observe it.

I wasn't reading the flow of the code right. The splash screen does come first.
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:  
Powered by phpBB® Forum Software © phpBB Group