OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Qt Quick and Android


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
tanshihaj
Newbie


Joined: 11 Aug 2017
Posts: 7

PostPosted: Tue Sep 19, 2017 2:28 pm    Post subject:
Qt Quick and Android
Reply with quote

Hi all,I’m developing cross-platform application using Qt Quick 2. And I want to integrate OpenSceneGraph view into my application.It seems that there is there are several libraries that can integrate OpenSceneGraph into Qt Quick application:https://github.com/podsvirov/osgqtquick - works good under desktop but I don’t know how to to make Android build (https://github.com/podsvirov/osgqtquick/issues/18). Active project.https://bitbucket.org/leon_manukyan/qtquick2osgitem - works good under desktop but there are bugs under Android (https://bitbucket.org/leon_manukyan/qtquick2osgitem/issues/3/android-rendering-problems). Active project?https://github.com/Sparadon/qquickosg - works good under desktop and some Android devices. In other android devices just doesn’t render scene. Inactive project.https://github.com/rickyviking/qmlosg - crashes on desktop and android builds. Inactive project.Now I’m trying to build osgqtquick library (or just code that is responsible to create QQuickItem) for Android. However I would like to know is there any library that surely works under desktop platforms (Windows, Linux, macOS) and mobile (Android and maybe iOS)?I’ve tested libraries above with OpenSceneGraph 3.4.0 | Qt 5.9.1 | Android SDK 26 | Android NDK 15. Android target API 17.Host computer: macOS 10.12.6.Sincerely,Zaripov Kamil.

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
karcios
Newbie


Joined: 12 Feb 2016
Posts: 11

PostPosted: Wed Sep 20, 2017 7:26 am    Post subject:
Reply with quote

Hi,

I also fighting with qtquick/osg integration but on PC. (there are several issues that crash app).
My solution is a mix of qmlosg/qtquick/librepilot, but according to
Code:
...
renders only first frame, second and subsequent frames doesn't renders.
...


I had to change:

you can try commenting lines in synchronize() function
Code:
h->viewer->advance();
h->viewer->eventTraversal();
h->viewer->updateTraversal();

and in render() comment
Code:
h->viewer->renderingTraversals();


and add instead in render()
Code:
h->viewer->frame();

frame() - calls those for 4 functions

and you have to call somewhere update() on QQuickItem, im doing this with QTimer
Code:
void OSGViewport::timerEvent(QTimerEvent *)
{
update();
}

and add somewhere
Code:
startTimer(50);


Good luck Smile

Regards,
Back to top
View user's profile Send private message
tanshihaj
Newbie


Joined: 11 Aug 2017
Posts: 7

PostPosted: Thu Sep 21, 2017 10:25 am    Post subject:
Qt Quick and Android
Reply with quote

Hi Wojtek,

Thanks for replying!

However, I’ve checked osgitem.cpp file in https://bitbucket.org/leon_manukyan/qtquick2osgitem/overview project and I didn’t see lines such as:

h->viewer->advance();
h->viewer->eventTraversal(); h->viewer->updateTraversal();
In RendererImpl::synchronize() method. Moreover, RendererImpl::render() already contains viewer_->frame() call.Maybe we are talking about different projects?Sincerely,Zaripov Kamil.
Quote:
On 20 Sep 2017, at 10:26, Wojtek Kowalski < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:qtquick2osgitem


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
James Turner
Guest





PostPosted: Fri Sep 22, 2017 8:18 am    Post subject:
Qt Quick and Android
Reply with quote

Quote:
On 19 Sep 2017, at 15:28, Kamil Zaripov < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Now I’m trying to build osgqtquick library (or just code that is responsible to create QQuickItem) for Android. However I would like to know is there any library that surely works under desktop platforms (Windows, Linux, macOS) and mobile (Android and maybe iOS)?

There’s another approach you can use, which is simpler than these examples, using the beforeRendering hook of QQ2 to run the OSG render frame. I think I have an example of that somewhere, but would need to check.

I’m currently working on an integration in the other direction, where QQ2 lives in a custom drawable / post-render camera. This uses QQuickRenderControl and has the advantage of rendering on the OSG graphics thread, so in theorey it’s compatible will all the OSg threading modes and hence offers better performance. It does rely on using a forked implementation of GraphcisWindowQt based on QWindow and QGOpenGLContext. Some of that code is already public (inside FlightGear), the rest should hopfully be published in the next few weeks.

Kind regards,
James

------------------
Post generated by Mail2Forum
Back to top
tanshihaj
Newbie


Joined: 11 Aug 2017
Posts: 7

PostPosted: Fri Sep 22, 2017 6:55 pm    Post subject:
Qt Quick and Android
Reply with quote

Hi James,

Thank you for suggestions.

I don’t sure that using QQuickWindow::beforeRendering() or QQuickWindow::afterRendering() signal will help since it also uses same OpenGL context as Qt Quick Scene Graph, but I will try it.

Solution that uses QQuickRender sound good, I will lock at FlightGear sources.

Best regards,
Kamil.
Quote:
On 22 Sep 2017, at 11:17, James Turner < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
On 19 Sep 2017, at 15:28, Kamil Zaripov < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Now I’m trying to build osgqtquick library (or just code that is responsible to create QQuickItem) for Android. However I would like to know is there any library that surely works under desktop platforms (Windows, Linux, macOS) and mobile (Android and maybe iOS)?

There’s another approach you can use, which is simpler than these examples, using the beforeRendering hook of QQ2 to run the OSG render frame. I think I have an example of that somewhere, but would need to check.

I’m currently working on an integration in the other direction, where QQ2 lives in a custom drawable / post-render camera. This uses QQuickRenderControl and has the advantage of rendering on the OSG graphics thread, so in theorey it’s compatible will all the OSg threading modes and hence offers better performance. It does rely on using a forked implementation of GraphcisWindowQt based on QWindow and QGOpenGLContext. Some of that code is already public (inside FlightGear), the rest should hopfully be published in the next few weeks.

Kind regards,
James

_______________________________________________osg-users mailing (
Only registered users can see emails on this board!
Get registred or enter the forums!
)http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
James Turner
Guest





PostPosted: Mon Sep 25, 2017 3:54 pm    Post subject:
Qt Quick and Android
Reply with quote

Quote:
On 22 Sep 2017, at 20:55, Kamil Zaripov < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
I don’t sure that using QQuickWindow::beforeRendering() or QQuickWindow::afterRendering() signal will help since it also uses same OpenGL context as Qt Quick Scene Graph, but I will try it.


Is that a problem? Keep in mind you can set any QSurfaceFormat as the default (before creating the first QQuickWindow, if you want to work on Mac) and hence request an arbitrary frame-buffer format or context profile, with the Qt API, and QtQuick can still use it.

(And there is QQuickView::resetOpenGLState to avoid any state pollution)

Of course the QQFBOItem approach is nice if you want to keep the contexts separate for some reason.

Quote:

Solution that uses QQuickRender sound good, I will lock at FlightGear sources.


The QQuickRenderControl part isn’t pushed to FlightGear yet, I have it on a local branch since right now it’s not threadsafe, until I find a safe way to run QQuickRenderControl::sync from the OSG graphics thread, but with the main thread guaranteed to be locked. I can guess a few solutions to that but I’m hoping some people more familiar with the threading in osgViewer[base] will have some definitive answers.

BTW both of my solutions above rely on using my GraphicsWindowQt5 which is a port+evolution of the old GraphicsWindowQt5 to QWIndow+QOpenGLContext; that part /is/ in FlightGear already but I’m still debugging some issues, especially mouse-pointer-warping, which FlightGear uses, is not working reliably compared to the ‘native’ GraphicsWindows (Cocoa, Win32, X11, etc)

Kind regards,
James

------------------
Post generated by Mail2Forum
Back to top
Riccardo Corsi
Guest





PostPosted: Thu Sep 28, 2017 12:19 pm    Post subject:
Qt Quick and Android
Reply with quote

Hi all,


James can you just confirm that, with the QQuickRenderControl approach, it's no more mandatory to have the main application loop handled by a Qt application class?


At the time when I wrote https://github.com/rickyviking/qmlosg (probably it was against Qt 4.Cool the only option available was to render custom GL stuff within a QtQuick node, and as such I had opted for osgViewer to render into an FBO created on a separate GL context, to avoid any conflict between the GL state used/updated by OSG and the one used by Qt to render its own widgets.


Riccardo


On Mon, Sep 25, 2017 at 5:53 PM, James Turner < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:

Quote:
On 22 Sep 2017, at 20:55, Kamil Zaripov < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
I don’t sure that using QQuickWindow::beforeRendering() or QQuickWindow::afterRendering() signal will help since it also uses same OpenGL context as Qt Quick Scene Graph, but I will try it.



Is that a problem? Keep in mind you can set any QSurfaceFormat as the default (before creating the first QQuickWindow, if you want to work on Mac) and hence request an arbitrary frame-buffer format or context profile, with the Qt API, and QtQuick can still use it.


(And there is QQuickView::resetOpenGLState to avoid any state pollution)


Of course the QQFBOItem approach is nice if you want to keep the contexts separate for some reason.



Quote:


Solution that uses QQuickRender sound good, I will lock at FlightGear sources.



The QQuickRenderControl part isn’t pushed to FlightGear yet, I have it on a local branch since right now it’s not threadsafe, until I find a safe way to run QQuickRenderControl::sync from the OSG graphics thread, but with the main thread guaranteed to be locked. I can guess a few solutions to that but I’m hoping some people more familiar with the threading in osgViewer[base] will have some definitive answers.


BTW both of my solutions above rely on using my GraphicsWindowQt5 which is a port+evolution of the old GraphicsWindowQt5 to QWIndow+QOpenGLContext; that part /is/ in FlightGear already but I’m still debugging some issues, especially mouse-pointer-warping, which FlightGear uses, is not working reliably compared to the ‘native’ GraphicsWindows (Cocoa, Win32, X11, etc)


Kind regards,
James


_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



------------------
Post generated by Mail2Forum
Back to top
James Turner
Guest





PostPosted: Fri Sep 29, 2017 1:35 pm    Post subject:
Qt Quick and Android
Reply with quote

Quote:
On 28 Sep 2017, at 08:45, Riccardo Corsi < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
James can you just confirm that, with the QQuickRenderControl approach, it's no more mandatory to have the main application loop handled by a Qt application class?

At the time when I wrote https://github.com/rickyviking/qmlosg (probably it was against Qt 4.Cool the only option available was to render custom GL stuff within a QtQuick node, and as such I had opted for osgViewer to render into an FBO created on a separate GL context, to avoid any conflict between the GL state used/updated by OSG and the one used by Qt to render its own widgets.


Uh, these two points are unrelated I think!

First thing - it’s never been necessary to have Qt handle the main application loop : so long as you call QCore|GuiApplication ::proccessEvents periodcilly, eg once per frame. That’s true since 4.x

Second thing, rendering in QtQuick 1 vs 2 (i.e Qt 4.x vs Qt5) changed completed, so yes most concepts are different. There’s several different ways to do OSG + QtQuick, some are easy but restrict OSG to rendering in the QtQuick render thread, which still gives overlapping of the main-thread and GL drawing. What I’m trying with the QQuickRenderControl stuff is to make a maximally performance solution for Flightgear which is compatible with /all/ the OSG threading modes. At the moment I’m not sure how well I will succeed.

Alas, no one replied to my message here about running tasks before the rendering starts, but I think I’ve worked out a solution, with some restrictions. I didn’t have time to work on this stuff in the past week, so a little more patience is needed before I can try out my theories.

Kind regards,
James

------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Cross-platform examples for Linux, ma... kornerr Announcement [ANN] 6 Tue Aug 14, 2018 10:51 am View latest post
No new posts Can Material, Color, LightSource, etc... jovo General 1 Thu Jul 19, 2018 10:02 am View latest post
No new posts Can't access to assets in Android jovo General 1 Wed Jul 11, 2018 1:40 pm View latest post
No new posts Android can't build osgdb_png lyn General [forum] 6 Fri Jun 29, 2018 2:35 am View latest post
No new posts osgEarth Android (and iOS) Chris Hanson General 0 Mon Jun 25, 2018 11:08 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP