[SailfishDevel] opengl again..

joao morgado joaodeusmorgado at yahoo.com
Thu Dec 5 01:35:38 UTC 2013


Hi

What I want to achieve is something similar to a cad / paint app, with a menu with buttons (circle, line, ...) and a drawing area. In Qt Widgets, I would have done a QMainWindow with a menu with buttons and a QGLwidget in the mdi area.
In QML, I have a main rectangle, with a menu with some buttons, now how do I set a child opengl drawing area ?


1) using QML writing C++ items to integrate into the scene graph (see http://qt-project.org/doc/qt-5.0/qtquick/qquickitem.html for the base class) - this also means you’ll be able to use Silica in your application


I'm not sure if this is what I want/need but I will check better the link 


2) using C++, instantiating a QWindow, and doing all your rendering by yourself (ideally using OpenGL ES) - something like http://qt-project.org/doc/qt-5.0/qtgui/openglwindow.html


I like this option because I want to use OpenGL ES for my drawing area, where the user can input lines, circles, ... with touch events. But can I have best of both worlds and use also a fancy QML menu with buttons ? I would have to have a main (something ???) with a child qml menu and a child opengl QWindow.


3) other, as-yet-to-be-finalised routes like doing *everything* yourself, using SDL, etc.
 
Not a change in hell :) Life is short and I just want to keep it simple, and use whenever possible all the goodies Qt has to offer :)

Thanks for your replay, and patience, has I am not, yet, very familiar with QML world.

Regards
João  






Em Quarta-feira, 4 de Dezembro de 2013 22:40, Robin Burchell <robin.burchell at jolla.com> escreveu:
 
Hi, 


On 04 Dec 2013, at 20:18, joao morgado <joaodeusmorgado at yahoo.com> wrote:
@: Wim de Vries. 
>I share your frustation about OpenGL with QWindow, and I'm also frustated with Qt widgets. 
>I have a very nice app in OVI, symbian, with QWidgets and OpenGL, I'll have to do a complete redesign, since widgets are black listed.

The reason for the blacklist is twofold:
1) we do not (and have not) done any work on QWidget-using applications on Sailfish, either in terms of working at all/working correctly, let alone working performantly - and as we don’t have infinite resources, we have to choose where to focus, and that isn’t on widget-using applications
2) they will not work performantly at all, due to being stuck with the software rendering stack (we’re talking something well under the display refresh rate on an un-loaded device)

Separately from the problem of actually working, and working well, any use of QtWidgets also imposes some pretty nasty resource penalties on your application (mostly in terms of startup, but also resource usage) as it’s a pretty massive library.

Generally speaking - they just aren’t very mobile-friendly.


That example of QWindow with OpenGL, to me, it's an over complicated mess, luckly I managed to port my opengl code to QWindow but took me quite a while to do it. To me, there is a better example here https://github.com/advancingu/Qt5OpenGL

An example rather depends on what you want to do. Either you’re:
1) using QML writing C++ items to integrate into the scene graph (see http://qt-project.org/doc/qt-5.0/qtquick/qquickitem.html for the base class) - this also means you’ll be able to use Silica in your application
2) using C++, instantiating a QWindow, and doing all your rendering by yourself (ideally using OpenGL ES) - something like http://qt-project.org/doc/qt-5.0/qtgui/openglwindow.html
3) other, as-yet-to-be-finalised routes like doing *everything* yourself, using SDL, etc.

So it seems that only QML apps are supported, but I have no clue how to add a QWindow in a QML app. There's an example in QtCreator "Scene Graph - OpenGL under QML" but they use QQuickItem, 
>for OpenGL, so I still don't have a clue how to use OpenGL in a QML app.

Your QML application has a C++ entry point (though if you’re using something like qmlscene… you’ll need to create such an entry point yourself) with your ‘main’ function. You can create a QWindow in there, and show it. You can hook into QML using Q_INVOKABLE methods to show it based on a clicked action on a Silica button, etc, etc, etc.

I’d need more information to be able to really provide useful help here :)


Regards
>João de Deus 

BR,
Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20131204/ccb3fc48/attachment.html>


More information about the Devel mailing list