RE: qwt and openGL on Android
Brought to you by:
rathmann
|
From: Suciu, A. <Adr...@an...> - 2022-01-21 17:11:25
|
Hello, I figured out why qwt with OpenGL didn't work on Android. The refreshtest example uses the constructor referenced here: https://sourceforge.net/p/qwt/git/ci/develop/tree/src/qwt_plot_opengl_canvas.cpp#l48 , which (if I understood correctly)overrides any QSurfaceFormats which may have been initialized. Qt example hellogl2 - https://code.qt.io/cgit/qt/qtbase.git/tree/examples/opengl/hellogl2/main.cpp#n88 initializes QSurfaceFormat and sets the default format that will be used in the application. On Android, in the refreshtest examples you get a black widget regardless of initializing QSurfaceFormat to a default format(as suggested by the Qt example). However if I'm instantiating the opengl canvas using the constructor that takes surface format as a parameter and use the QSurfaceFormat parameter as in the Qt example , everything works great because this actually makes use of the surface format - https://sourceforge.net/p/qwt/git/ci/develop/tree/src/qwt_plot_opengl_canvas.cpp#l65 ! In the screenshot you can clearly see the Android Ui with the khaki plot which suggests it's OpenGL rendered. Another problem I've had in my own application is that the application hangs if I try to replot before initializing OpenGL in some way. I put in a workaround where I create and delete an QOpenGLWidget(which loads openGL in my application) before trying to do anything with the plots. I think a race condition is involved in some way, but I haven't figured it out yet. I just put this down as it may be useful to someone else. Also, as a side-note, in the refreshtest example, Immediate Paint checkbox doesn't do anything if OpenGL is enabled, as the code actually sets the attribute only on the QwtPlotCanvas branch of the if statement - https://sourceforge.net/p/qwt/git/ci/develop/tree/examples/refreshtest/Plot.cpp#l200 . You need to add this to OpenGl branch as well with the appropriate call: plotCanvas->setPaintAttribute(QwtPlotAbstractGLCanvas::ImmediatePaint, s.canvas.immediatePaint ); In conclusion, qwt and Android and openGL works fine although I think the constructor bug should be addressed in some way (maybe initialize QSurfaceFormat used in the QwtPlotOpenGLCanvas to the QSurfaceFormat::defaultFormat before changing it ?) -Adrian From: Suciu, Adrian <Adr...@an...> Sent: Tuesday, January 11, 2022 1:49 PM To: List for both Qwt users and developers <qwt...@li...> Subject: RE: qwt and openGL on Android [External] I think you mean Immediat paint, and the answer is yes, it's the same behavior. I'm using Qt 5.15.2 for Android downloaded using the Qt Maintnance tool (I did not build it myself). I tested with qwt both develop and qwt-multiaxes branch from git. -Adrian From: Uwe Rathmann <Uwe...@ti...<mailto:Uwe...@ti...>> Sent: Tuesday, January 11, 2022 9:14 AM To: qwt...@li...<mailto:qwt...@li...> Subject: Re: qwt and openGL on Android [External] > has anyone tested qwt with openGL on Android ? Never tried Qwt on Android myself - neither with or without OpenGL > I just built the > refreshtest example and when enabling opengl I'm simply getting a > black widget ... Does this also happen when unchecking "Incremental Paint" ? Which Qt/Qwt versions are you using ? Uwe |