<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi Sam,</p>
<p><br>
</p>
<p>I have tested this solution and it solves for the geometry inversion, but it does not solve the behavior inversion problem. This means that when the trackball is moved up the scene actually goes down (either in rotation or in pan).</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> osg-users <osg-users-bounces@lists.openscenegraph.org> on behalf of Sam Brkopac <brkopac@gmail.com><br>
<b>Sent:</b> 08 August 2016 23:54<br>
<b>To:</b> OpenSceneGraph Users<br>
<b>Subject:</b> Re: [osg-users] Left handed scene</font>
<div> </div>
</div>
<div>
<div></div>
<div>If you need to rotate your entire scene you can add a single transform to the root node and do the rotation. Then can treat that transform as the new root node.</div>
<div><br>
On Aug 2, 2016, at 10:27, Antoine Rennuit <<a href="mailto:antoinerennuit@hotmail.com">antoinerennuit@hotmail.com</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi all,</p>
<p><br>
</p>
<p>My problem is solved my I flip my FrameBuffer vertically (in Qt), which I should not be doing.</p>
<p><br>
</p>
<p>So anyone has an idea of what can flip my OSG view vertically?</p>
<p><br>
</p>
<p>Thanks, <br>
</p>
<p><br>
</p>
<p>Antoine.<br>
</p>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> osg-users <<a href="mailto:osg-users-bounces@lists.openscenegraph.org">osg-users-bounces@lists.openscenegraph.org</a>> on behalf of Antoine
Rennuit <<a href="mailto:antoinerennuit@hotmail.com">antoinerennuit@hotmail.com</a>><br>
<b>Sent:</b> 02 August 2016 18:37<br>
<b>To:</b> <a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<b>Subject:</b> Re: [osg-users] Left handed scene</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi all,</p>
<p><br>
</p>
<p>Going a bit forward with my left handedness problem...</p>
<p><br>
</p>
<p>My viewport actually appears upside down vertically: the HUD coordinate system on the left is up when it should be down and the text is also written upside (see joined picture). It behaves as if the viewport had its y origin at the bottom of the viewport
(and not at the top as usual).</p>
<p><br>
</p>
<p>Any idea?</p>
<p><br>
</p>
<p>Kind regards,</p>
<p><br>
</p>
<p>Antoine.<br>
</p>
<br>
<br>
<div style="color:rgb(0,0,0)">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> osg-users <<a href="mailto:osg-users-bounces@lists.openscenegraph.org">osg-users-bounces@lists.openscenegraph.org</a>> on behalf of Antoine
Rennuit <<a href="mailto:antoinerennuit@hotmail.com">antoinerennuit@hotmail.com</a>><br>
<b>Sent:</b> 02 August 2016 14:36<br>
<b>To:</b> <a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<b>Subject:</b> [osg-users] Left handed scene</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><font size="2"><span style="font-size:10pt"></span></font>Hi all,</p>
<p><br>
</p>
<p>I have a QtWidget app which I am converting to QtQuick. My app works well with QtWidget but after transitioning to QtQuick I have observed that the whole scene is now left handed: not only the geometry is left handed (the z axis is down when it should be
up - check joined file) but also the TrackballManipulator behavior (e.g. when I pan up with the mouse the scene goes down, and it's the same opposite reaction for rotate).</p>
<p><br>
</p>
<p>I do not understand where this is coming from. I was able to easily put the geometry back right handed using a scale -1 on Z but I should not have to do that and this does not solve the TrackballManipulator behavior.</p>
<p><br>
</p>
<p>I have used <a id="LPlnk708810" href="https://bitbucket.org/leon_manukyan/qtquick2osgitem" class="OWAAutoLink">
https://bitbucket.org/leon_manukyan/qtquick2osgitem</a> as a starting point and my code does the following:</p>
<p><br>
</p>
<p>I have a RendererImpl class, created by an OsgItem and which is responsible for maintaining the osgViewer::Viewer and the osgViewer::GraphicsWindow, here is its init method:</p>
<p><br>
</p>
<p></p>
<div>void RendererImpl::init()<br>
{<br>
m_sceneRoot = new osg::Group();<br>
<br>
m_viewer = new osgViewer::Viewer;<br>
m_viewer->setThreadingModel(osgViewer::ViewerBase::SingleThreaded);<br>
m_viewer->setSceneData(m_sceneRoot);<br>
m_viewer->setCameraManipulator(new osgGA::TrackballManipulator);<br>
m_viewer->getCameraManipulator()->setHomePosition(osg::Vec3d(4.0, -4.0, 2.0), osg::Vec3d(0.0, 0.0, 1.0), osg::Vec3d(0.0, 0.0, 1.0));<br>
m_viewer->home();<br>
<br>
m_sceneRoot->addChild(setupLight());<br>
m_sceneRoot->addChild(setupGrid(6.0f, 2.0f));<br>
<br>
m_window = new FrameBufferWindow(this);<br>
updateSize();<br>
<br>
osg::Camera* camera = m_viewer->getCamera();<br>
camera->setGraphicsContext( m_window.get() );<br>
<br>
camera->setClearColor( osg::Vec4(0.2, 0.2, 0.6, 1.0) );<br>
}</div>
<p></p>
<p><br>
</p>
<p>And its update method on window size change:</p>
<p><br>
</p>
<p></p>
<div>void RendererImpl::updateSize()<br>
{<br>
m_window->getEventQueue()->windowResize(0, 0, osgItem().width(), osgItem().height() );<br>
m_window->resized(0, 0, osgItem().width(), osgItem().height());<br>
<br>
osg::Camera& camera = *m_viewer->getCamera();<br>
const osg::GraphicsContext::Traits& t = *m_window->getTraits();<br>
camera.setViewport( 0, 0, t.width, t.height );<br>
double aspectRatio = t.height ? (double)t.width / (double)t.height : 1.0;<br>
camera.setProjectionMatrixAsPerspective(30.0f, aspectRatio, 1.0f, 10000.0f );<br>
}</div>
<br>
<p></p>
<p>And I have an item which streams the events to the window, e.g.: <br>
</p>
<p><br>
</p>
<p></p>
<div>void OsgItem::mouseMoveEvent(QMouseEvent *event)<br>
{<br>
m_renderer->m_window->getEventQueue()->mouseMotion(event->x(), event->y());<br>
<br>
update();<br>
}</div>
<p></p>
<p><br>
</p>
<p>Does anyone have an idea of what is wrong in my code? I have looked for days and I am stuck!</p>
<p><br>
</p>
<p>Thanks,</p>
<p><br>
</p>
<p>Antoine.</p>
<p><br>
</p>
<font size="2"><span style="font-size:10pt">
<div class="PlainText"></div>
</span></font>
<div style="color:rgb(0,0,0)"><font size="2"><span style="font-size:10pt"></span></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>osg-users mailing list</span><br>
<span><a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a></span><br>
<span><a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a></span><br>
</div>
</blockquote>
</div>
</div>
</div>
</body>
</html>