Re: [osg-users] Integrate Qt into OSG - not OSG into Qt osgQt
Hello, On 02/10/2019 15:23, Trajce Nikolov NICK wrote: > Hi community, > > I am struggling with the design of such a task. And I am a bit > familiar with Qt and other UI frameworks. The task is to embed the > whole Qt framework into OSG - including the event processing and let > OSG render ( through RTT ) the widgets content. > > Any clue, hints what direction I should take? > > Thanks a bunch as always! > Nick Ufff, you are in for quite a battle, I am afraid. I have done this few years ago when we were using Ogre and OSG for our virtual reality simulators at work and we needed a proper UI framework to display user interfaces inside the application. You have basically two options: a) Render the Qt widget/window into a texture/image, grab that and display it as an OSG texture. Input from OSG can be fed into Qt's event system by artificially creating and injecting events. This works and it is how we have done it. Qt widgets can render themselves into an image/texture directly, simply by calling their render() method with proper arguments. We were able to display most Qt widgets and render QML using OSG textures. Where things get very hairy is the state management between OSG and Qt (Qt uses its own OpenGL backend for rendering and assumes that it is in a certain state!) and then input. When you aren't rendering Qt the usual way by showing windows on screen but you only call render() and grab a texture, Qt will not initialize some internal state relating to issues such as cursor, keyboard focus, state of some widgets, etc. The result is that you will have problems with cursor disappearing, widgets not accepting keyboard input, keyboard shortcuts not working and myriads of other problems like this. It can be solved to some degree by digging into the Qt's source code, seeing which flags it is relying on where and then manually calling the necessary functions to ensure that they are set correctly. We have managed to get it to such shape that the UIs were usable but if you need a very complex UI you will likely run into problems. Also OSG's event system doesn't handle anywhere close to the gamut of input events that Qt does, so a lot of things will have to be emulated. b) Implement a new Qt backend running on top of OSG. Qt implements several of these backends, including a basic framebuffer and OpenGL already, that is how they port Qt to different platforms, such as phones or embedded hardware. This would be probably cleaner approach if you really need the entire Qt to work but also a lot more work than the above, because the API is fairly extensive, not super well documented (this are really the dirty guts of Qt you aren't supposed to normally see) and may not have a completely straightforward mapping to OSG. Good luck, Jan signature.asc Description: OpenPGP digital signature ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Orient a node to face another
Hi Paul, you subtract the two input vectors and by this you get the direction from one to the other, then normalize and make the Quaternion to rotate the axis (in the code bellow is Y-forward) to the normalized vector. Something like this: osg::Quat GetRotation(const osg::Vec3& tgtPos, const osg::Vec3& subjectPos) { osg::Vec3 v = tgtPos - subjectPos; v.normalize(); osg::Quat ret; ret.makeRotate(osg::Vec3(0, 1, 0), v); return Quat; } Nick On Wed, Oct 2, 2019 at 6:04 PM Paul Leopard wrote: > Hi, > > What would be the best approach to solve the following problem where I > need one node to be updated through a callback to face another node? I > understand how to get a node to face the screen with a billboard but that's > not the problem here... > > Here is the problem: > > I've got a satellite node that is a child of a PAT and currently, I am > updating that PAT position only to orbit the satellite around a planet > node. I want to update the satellite PAT rotation also so that the > satellite Z-Axis always faces the planet node origin. So, I need to compute > the proper rotation Quat … > > > Code: > > Quat GetRotation( const Vec3& tgtPos, const Vec3& subjectPos ) > { > Quat ret = what?; > return Quat; > } > > Vec3 targetPosition(...); > Vec3 satellitePosition(...); > Quat rotation = GetRotation( satellitePosition, targetPosition ); > > satellitePAT->setPosition( satellitePosition ); > satellitePAT->setRotation( rotation ); > > > > > What would be the best approach for the calculations in GetRotation(...) > using OSG functions? I can work out the math on my own but I'd like to know > if there are any cool OSG utilities to do this. > > Thank you! > > Cheers, > Paul > > > things are more like they are now than they have ever been before > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=76770#76770 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Orient a node to face another
Hi, What would be the best approach to solve the following problem where I need one node to be updated through a callback to face another node? I understand how to get a node to face the screen with a billboard but that's not the problem here... Here is the problem: I've got a satellite node that is a child of a PAT and currently, I am updating that PAT position only to orbit the satellite around a planet node. I want to update the satellite PAT rotation also so that the satellite Z-Axis always faces the planet node origin. So, I need to compute the proper rotation Quat … Code: Quat GetRotation( const Vec3& tgtPos, const Vec3& subjectPos ) { Quat ret = what?; return Quat; } Vec3 targetPosition(...); Vec3 satellitePosition(...); Quat rotation = GetRotation( satellitePosition, targetPosition ); satellitePAT->setPosition( satellitePosition ); satellitePAT->setRotation( rotation ); What would be the best approach for the calculations in GetRotation(...) using OSG functions? I can work out the math on my own but I'd like to know if there are any cool OSG utilities to do this. Thank you! Cheers, Paul things are more like they are now than they have ever been before -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76770#76770 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Integrate Qt into OSG - not OSG into Qt osgQt
Hi community, I am struggling with the design of such a task. And I am a bit familiar with Qt and other UI frameworks. The task is to embed the whole Qt framework into OSG - including the event processing and let OSG render ( through RTT ) the widgets content. Any clue, hints what direction I should take? Thanks a bunch as always! Nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Notification
Hi Chris, On Tue, 1 Oct 2019 at 05:08, Chris Hanson wrote: > This happened to this list a few years ago and it took me like a week to > hunt it down because it was actually subscribed through a forwarding > address different from the one that was responding. > Seemed to be a bit more straight forward this time thankfully. Still odd though. > Doesn't this list send a confirmation email that has to be replied to by a > human being? Seems more than accidental... > I don't know if mailman, or our configuration of it, sends a confirmation email that you have to respond to. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org