Android: From QT 5.2 to QT 5.3 issues
-
Hi everyone,
I've started a simple project for android in QT 5.2 (a simple OpenGL game but with some QT forms as well), but since I've got some problems with swapping between my main activities and a Facebook activity (losing OpenGL context), I have decided to put QT aside and wait for the QT 5.3. Now with QT 5.3, I've got some strange issues.
The first one:
The first screen is a QMainWindow which uses a from created in QT creator, that's ok, so far. It creates and draws the form perfectly and all the controls are working fine(sound on/off, etc...). But when I press the start button the things starts to get wrong. It keeps drawing the form, but I can see by the logs the game running, in other words, only rendering the last frame before the game starts!That game is running in an inherited QGLWidget, using OpenGL ES 2(I hope) and using QOpenGLShaderProgram for the shaders. and when I press start all I do is this:
@
RenderWidget *GameWid = new RenderWidget();
mainForm->setCentralWidget(GameWid);
@It works fine in QT 5.2, but not in QT 5.3. If anyone has any suggestion, I'll apreciate.
The second:
Don't know if it's related to the first one or not, in the end of the each round in the game, I take a screenshot from the last frame rendered and shows it as background of the end game form, which shows a button to share on FB or play again. In QT 5.2 all works fine, but in QT 5.3 any of these buttons works.Here is the libs I'm using in my .proj:
@
QT += core gui opengl network multimedia script gui-private
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
android: {
QT += androidextras
}
@So, that's it, sorry for my bad english....
-
Hi,
If you didn't change anything then there's indeed something fishy. Can you reproduce this with a minimal application ?
-
Ok, I've made a minimal test with it:
First I've created a small project with a simple QMainWindow with an ui form, that's ok.
After that I've got the OpenGL ES 2.0 Example for QT 5.(Shaders got problems to compile, I don't know if it was the same problem as the QGLShaderProgram in QT 5.2)
Then I've compiled with both 5.2 and 5.3.In 5.2:
The system runs ok, when I press the button the screen goes black, that's OK!!! the opengl was clearing the screen with black, but not rendering anything else due to shader failure. In other words, I HAVE OpenGL running!In 5.3:
The system runs ok, when I press the button, it keep showing the ui form, but I can't press the button again. If I check the QT log I can see the OpenGL Widget is running but not rendering or refreshing. If I run the OpenGL widget without the QMainwindow form before, it goes black screen exactly as when I press the button in 5.2 form.Here is the link of the project, just in case:
http://snk.to/f-cdpmanic -
What OS are you running ? On 10.8.5 the shaders fail to compile
-
My OS is Windows 7 SP1. QT Creator 3.1.1. Tested on Samsung GT-S6313T Android 4.1.1.
And about the shader failure, yep, I know it happens, but it always happened even in QT5.2(usually I use QOpenGLShaderProgram instead) but even with that, the App did not seems to create an OpenGL surface. This shader code I've got from Cube OpenGL ES 2.0 example for QT 5 (http://qt-project.org/doc/qt-5/qtopengl-cube-example.html), and it always gaves me the compile problem.
EDIT:
I beg your pardon, I manage to found the shader error and fixed, here is the link:
http://snk.to/f-ctjabsy8But the problem still the same
-
You should rather user something like github/gitorious/bitbucket to share your code. It'll make thing easier.
-
I know...I never though that I'll share it more than once...sorry for that...for any other changes from now on I'll put it on GitHub...
-
Don't worry about that ;)
I tested your example program and indeed, the symptoms are exactly what you are describing. You should go to the "bug report system":http://bugreports.qt-project.org to see if it's something known. If not please open a new report providing your example and detailed explanations
-
Ok, opened one, QTBUG-39652
-
Well...I've recieved the awnser and it's no good but I'll leave it here for the "future generations":
@
Eskil Abrahamsen Blomfeldt added a comment - 17/Jun/14 7:19 AM
"Unfortunately, opening an OpenGL window on top of a raster window does not work, as it has been designed to always display behind all raster windows. There is very limited support for stacking GL surface views in Android, so currently we haven't found any solution to this that doesn't come with its own limitations (the way this was handled in Qt 5.2 had much more severe limitations unfortunately).
At the moment you will have to make sure all raster-based (Qt Widget) windows are hidden when you show the OpenGL window."
@So...following Eskil's sugestion, All I have to do is hide/kill all widgets before open the OpenGL widget... I've tested it and it works, so I must change my game structure to work with this new way.
And actually what Eskil says is right, some big issues I have when I use OpenGL widget now won't happens anymore. So it'll worth...
Thanks SGaist for the help!