[osg-users] Android osgViewer input scaling in 3.3.1
Good day, I'm working on an Android OSG program and I've recently upgraded from OSG 3.0.1 to OSG 3.3.1. The viewer seems to work correctly, I do see the objects I load, but as soon as I give a touch input the model goes out of view. In the second navigation mode the model starts spinning extremely fast, even with the smallest touch input. Previously, in version 3.0.1, this worked fine for me. Is there something changed in the later osg versions and does the osg AndroidExample needs to be updated or is there something else I'm missing? It looks like it needs normalized inputs rather than absolute pixels values, but I got stuck implementing that for picking objects, which I can't get back to work. Wouter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59221#59221 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Android osgViewer input scaling in 3.3.1
wroos wrote: > Good day, > > I'm working on an Android OSG program and I've recently upgraded from OSG > 3.0.1 to OSG 3.3.1. The viewer seems to work correctly, I do see the objects > I load, but as soon as I give a touch input the model goes out of view. In > the second navigation mode the model starts spinning extremely fast, even > with the smallest touch input. Previously, in version 3.0.1, this worked fine > for me. Is there something changed in the later osg versions and does the osg > AndroidExample needs to be updated or is there something else I'm missing? > It looks like it needs normalized inputs rather than absolute pixels values, > but I got stuck implementing that for picking objects, which I can't get back > to work. > > Wouter I solved the problem by using the EventQueue from the window(s) rather than the viewer's, now everything works as expected. Please see attached updated viewer code for osgAndroidExampleGLES2, will work the same for osgAndroidExampleGLES1 Code: void OsgMainApp::mouseButtonPressEvent(float x,float y,int button){ osgViewer::ViewerBase::Windows windows; _viewer->getWindows( windows ); for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr != windows.end();++itr) { (*itr)->getEventQueue()->mouseButtonPress(x, y, button); } } void OsgMainApp::mouseButtonReleaseEvent(float x,float y,int button){ osgViewer::ViewerBase::Windows windows; _viewer->getWindows( windows ); for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr != windows.end();++itr) { (*itr)->getEventQueue()->mouseButtonRelease(x, y, button); } } void OsgMainApp::mouseMoveEvent(float x,float y){ osgViewer::ViewerBase::Windows windows; _viewer->getWindows( windows ); for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr != windows.end();++itr) { (*itr)->getEventQueue()->mouseMotion(x, y); } } void OsgMainApp::keyboardDown(int key){ osgViewer::ViewerBase::Windows windows; _viewer->getWindows( windows ); for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr != windows.end();++itr) { (*itr)->getEventQueue()->keyPress(key); } } void OsgMainApp::keyboardUp(int key){ osgViewer::ViewerBase::Windows windows; _viewer->getWindows( windows ); for(osgViewer::Viewer::Windows::iterator itr = windows.begin();itr != windows.end();++itr) { (*itr)->getEventQueue()->keyRelease(key); } } [/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59256#59256 Attachments: http://forum.openscenegraph.org//files/osgmainapp_296.cpp ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Android osgViewer input scaling in 3.3.1
Martin Siggel wrote: > You can also workaround this (instead of using the eventqueue) by telling > OSG about the input range of your mouse after setting up your viewer: > > viewer->getEventQueue()->setMouseInputRange(x, y, x + width, y + height); > > > > Cheers, > Martin > > Thanks for that method, that looks much better, and works for the android examples just as well. However it does not work when I use a picker, it still returns no intersections whereas using the Window's EventQueue does give me the correct results. Any ideas on why this might be? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59259#59259 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Android osgViewer input scaling in 3.3.1
Thanks for that solution, that does make sense. I will be using my method of setting the EventQueue of the window as that requires no changes to my picker and I can keep my code base between desktop and Android the same apart for the viewer code. I suggest that for the examples we add the Code: viewer->getEventQueue()->setMouseInputRange(x, y, x + width, y + height); line to make the examples usable again. Martin Siggel wrote: > We also had that problem with the picker. We fixed that, by reimplementing > the picking like this: > > > // map pixel coordinates to [-1,1] (OpenGL Screen Coordinates) > float xwindow = x/screenWidth * 2. - 1; > float ywindow = -y/screenHeight * 2. + 1; > osg::Camera* cam = viewer->getCamera(); > osg::Matrixd m; > > m.preMult(cam->getProjectionMatrix()); > m.preMult(cam->getViewMatrix()); > // define intersection ray > osg::Vec3d startPoint (xwindow, ywindow, -1000); > osg::Vec3d endPoint(xwindow, ywindow, 1000); > osg::Matrixd i; > > i.invert(m); > osg::Vec3d wStart = startPoint * i; > osg::Vec3d wEnd = endPoint * i; > osg::ref_ptr picker = new > osgUtil::LineSegmentIntersector(wStart, wEnd); > > > > 2014-05-05 13:43 GMT+02:00 Wouter Roos < ()>: > > > > > Martin Siggel wrote: > > > > > You can also workaround this (instead of using the eventqueue) by > > > telling OSG about the input range of your mouse after setting up your > > > viewer: > > > > > > viewer->getEventQueue()->setMouseInputRange(x, y, x + width, y + height); > > > > > > > > > > > > Cheers, > > > Martin > > > > > > > > > > > > > > > > > Thanks for that method, that looks much better, and works for the android > > examples just as well. > > However it does not work when I use a picker, it still returns no > > intersections whereas using the Window's EventQueue does give me the > > correct results. Any ideas on why this might be? > > > > -- > > Read this topic online here: > > > > http://forum.openscenegraph.org/viewtopic.php?p=59259#59259 > > (http://forum.openscenegraph.org/viewtopic.php?p=59259#59259) > > > > > > > > > > > > ___ > > osg-users mailing list > > () > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > > -- > Post generated by Mail2Forum [/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59270#59270 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Android osgViewer input scaling in 3.3.1
Hi Martin, I simply use Code: osgUtil::LineSegmentIntersector::Intersections intersections; view->computeIntersections( ea.getX(), ea.getY(),intersections)); which is giving me correct results on Android and Windows, with using the EventQueue of the window(s) on Android. I was iirc getting the correct mouse ranges in Android, what version of osg are you using? I've tested with 3.3.1 Martin Siggel wrote: > Hi wouter, > I tried your code, but standard picking didn't work because the mouse input > ranges of the event are wrong. How did you do the picking? > Cheers, > Martin Am 06.05.2014 08:55 schrieb "Wouter Roos" < ()>: > > Thanks for that solution, that does make sense. I will be using my method > > of setting the EventQueue of the window as that requires no changes to my > > picker and I can keep my code base between desktop and Android the same > > apart for the viewer code. > > > > I suggest that for the examples we add the > > > > Code: > > viewer->getEventQueue()->setMouseInputRange(x, y, x + width, y + height); > > > > line to make the examples usable again. > > > > > > Martin Siggel wrote: > > > > > We also had that problem with the picker. We fixed that, by > > > reimplementing the picking like this: > > > > > > > > > // map pixel coordinates to [-1,1] (OpenGL Screen Coordinates) > > > float xwindow = x/screenWidth * 2. - 1; > > > float ywindow = -y/screenHeight * 2. + 1; > > > osg::Camera* cam = viewer->getCamera(); > > > osg::Matrixd m; > > > > > > m.preMult(cam->getProjectionMatrix()); > > > m.preMult(cam->getViewMatrix()); > > > // define intersection ray > > > osg::Vec3d startPoint (xwindow, ywindow, -1000); > > > osg::Vec3d endPoint(xwindow, ywindow, 1000); > > > osg::Matrixd i; > > > > > > i.invert(m); > > > osg::Vec3d wStart = startPoint * i; > > > osg::Vec3d wEnd = endPoint * i; > > > osg::ref_ptr picker = new > > > osgUtil::LineSegmentIntersector(wStart, wEnd); > > > > > > > > > > > > 2014-05-05 13:43 GMT+02:00 Wouter Roos < ()>: > > > > > > > > > > > > > > Martin Siggel wrote: > > > > > > > > > > > > > You can also workaround this (instead of using the eventqueue) by > > > > > telling OSG about the input range of your mouse after setting up your > > > > > viewer: > > > > > > > > > > viewer->getEventQueue()->setMouseInputRange(x, y, x + width, y + > > > > > height); > > > > > > > > > > > > > > > > > > > > Cheers, > > > > > Martin > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks for that method, that looks much better, and works for the > > > > android examples just as well. > > > > However it does not work when I use a picker, it still returns no > > > > intersections whereas using the Window's EventQueue does give me the > > > > correct results. Any ideas on why this might be? > > > > > > > > -- > > > > Read this topic online here: > > > > > > > > http://forum.openscenegraph.org/viewtopic.php?p=59259#59259 > > > > (http://forum.openscenegraph.org/viewtopic.php?p=59259#59259) > > > > (http://forum.openscenegraph.org/viewtopic.php?p=59259#59259 > > > > (http://forum.openscenegraph.org/viewtopic.php?p=59259#59259)) > > > > > > > > > > > > > > > > > > > > > > > > ___ > > > > osg-users mailing list > > > > () > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)) > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Post generated by Mail2Forum > > > > > [/code] > > > > -- > > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=59270#59270 > > (http://forum.openscenegraph.org/viewtopic.php?p=59270#59270) > > > > > > > > > > > > ___ > > osg-users mailing list > > () > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > -- > Post generated by Mail2Forum [/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59283#59283 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Android osgPlugins
nathan wrote: > Hi Jordi, > > thanks for getting back to me. I did compile with OSG in static mode. Here > are the flags I'm using: > > OSG_GLES2_VARS="-DOSG_GL1_AVAILABLE=OFF > -DOSG_GL2_AVAILABLE=OFF > -DOSG_GL3_AVAILABLE=OFF > -DOSG_GLES1_AVAILABLE=OFF > -DOSG_GLES2_AVAILABLE=ON > -DOSG_GL_LIBRARY_STATIC=OFF > -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF > -DOSG_GL_MATRICES_AVAILABLE=OFF > -DOSG_GL_VERTEX_FUNCS_AVAILABLE=OFF > -DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=OFF > -DOSG_GL_FIXED_FUNCTION_AVAILABLE=OFF" > > OSG_ANDROID_VARS="-DDYNAMIC_OPENTHREADS=OFF > -DDYNAMIC_OPENSCENEGRAPH=OFF > -DOSG_BUILD_PLATFORM_ANDROID=ON > -DANDROID_ABI="armeabi armeabi-v7a" > -DANDROID_PLATFORM=7 > -DANDROID_STL="gnustl_static" > -DANDROID_DEBUG=OFF > -DANDROID_NDK=${ANDROID_NDK_ROOT} > -DJ=12" > > cmake ${OSG_ANDROID_VARS} ${OSG_GLES2_VARS} -DCMAKE_BUILD_TYPE=Release > -DCMAKE_INSTALL_PREFIX="${GLOBAL_OUTDIR}/osg-${VERSION}/${TOOLCHAIN}" > > I wondered about that too, because OSG is searching for a dynamic library in > osgPlugins-3.2.1/ directories. I thought I didn't need to add this directory > with the plugins on to my device. As far as I can see I don't have an > osgPlugings directory produced by my OSG build for Android in the same way I > would for PC. Is this something I need to do? If so I would appreciate a link > to any instructions available. > > Thanks, > Nathan > From: [] on behalf of Jordi Torres [] > Sent: 09 January 2014 17:13 > To: OpenSceneGraph Users > Subject: Re: Android osgPlugins > > > > Hi Nathan, > > Did you compile OSG in static mode as stated in the documentation? > > > -DDYNAMIC_OPENTHREADS=OFF -DDYNAMIC_OPENSCENEGRAPH=OFF > > > Right now is a must to compile in static mode. We have some tests with > dynamic libraries but compiling in dynamic mode involves too many changes and > we have still work to do to make it public. > > > Hope it helps. > > > > 2014/1/9 Nathan Collins < ()> > > > > > Hi, > > > > I have compiled OSG for Android, and built and deployed the GLES2 Android > > example on my Nexus 4. However I’m having trouble loading cow.osg, or any > > other .osg/.osgt files, to test that it works. I’ve built OSG for Android > > in the past and had these models working but this time around I’m not able > > to load any models at all. I get the following warnings from logcat: > > > > 01-09 16:46:11.812: E/Osg Viewer(18327): There are 1 models to load > > 01-09 16:46:11.812: E/Osg Viewer(18327): Loading: > > /storage/emulated/0/cow.osgt > > 01-09 16:46:11.812: D/Osg Viewer(18327): > > FindFileInPath(/storage/emulated/0/cow.osgt): returning > > /storage/emulated/0/cow.osgt > > 01-09 16:46:11.812: D/Osg Viewer(18327): itr='/vendor/lib' > > 01-09 16:46:11.812: D/Osg Viewer(18327): FindFileInPath() : trying > > /vendor/lib/osgPlugins-3.2.1/osgdb_osg.so ... > > 01-09 16:46:11.812: D/Osg Viewer(18327): itr='/system/lib' > > 01-09 16:46:11.812: D/Osg Viewer(18327): FindFileInPath() : trying > > /system/lib/osgPlugins-3.2.1/osgdb_osg.so ... > > 01-09 16:46:11.812: D/Osg Viewer(18327): itr='/usr/lib/' > > 01-09 16:46:11.812: D/Osg Viewer(18327): FindFileInPath() : trying > > /usr/lib/osgPlugins-3.2.1/osgdb_osg.so ... > > 01-09 16:46:11.812: D/Osg Viewer(18327): itr='/usr/local/lib/' > > 01-09 16:46:11.812: D/Osg Viewer(18327): FindFileInPath() : trying > > /usr/local/lib/osgPlugins-3.2.1/osgdb_osg.so ... > > 01-09 16:46:11.812: D/Osg Viewer(18327): itr='/vendor/lib' > > 01-09 16:46:11.812: D/Osg Viewer(18327): FindFileInPath() : trying > > /vendor/lib/osgdb_osg.so ... > > 01-09 16:46:11.812: D/Osg Viewer(18327): itr='/system/lib' > > 01-09 16:46:11.812: D/Osg Viewer(18327): FindFileInPath() : trying > > /system/lib/osgdb_osg.so ... > > 01-09 16:46:11.812: D/Osg Viewer(18327): itr='/usr/lib/' > > 01-09 16:46:11.812: D/Osg Viewer(18327): FindFileInPath() : trying > > /usr/lib/osgdb_osg.so ... > > 01-09 16:46:11.812: D/Osg Viewer(18327): itr='/usr/local/lib/' > > 01-09 16:46:11.812: D/Osg Viewer(18327): FindFileInPath() : trying > > /usr/local/lib/osgdb_osg.so ... > > 01-09 16:46:11.812: I/Osg Viewer(18327): Warning: dynamic library > > 'osgPlugins-3.2.1/osgdb_osg.so' does not exist (or isn't readable): > > 01-09 16:46:11.812: I/Osg Viewer(18327): dlopen failed: library > > "osgPlugins-3.2.1/osgdb_osg.so" not found > > 01-09 16:46:11.812: I/Osg Viewer(18327): DynamicLibrary::failed loading > > "osgPlugins-3.2.1/osgdb_osg.so" > > 01-09 16:46:11.812: E/Osg Viewer(18327): Model not loaded > > > > Now I thought I didn’t have to do anything special last time to load an > > .osg file but I’m wondering what I’ve missed? My Android.mk file just has > > the standard set OSG_ANDROID_DIR and add path/to/libgnustl_static.a in > > LOCAL_LDLIBS modifications. I’m working with OSG branch 3.2 on Fedora, with > > ndk-r9c. > > > > Any help would be greatly appreciated. Thanks, > > > > Nathan > > > > Nathan C
Re: [osg-users] Vanishing letters in osg::Text
I've experienced a similar issue lately where we were running a project on lower spec systems with only an integrated GPU. On those systems the frame rate would not show properly, having the same issue as described here, with some numbers not showing properly. I did a test on my laptop, and when I force it to use the integrated GPU (4600) the problems shows up as well. If I switch to use the GTX970M everything is fine again. This is all on Windows 10, osg 3.4.0 I haven't done any further investigation as the project is not using any Text objects, but maybe this might help somehow. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70827#70827 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgQt Material issue
Hi, I'm in the process of updating to OSG 3.6.4 and have come across a problem with osgQt. When running the supplied example of osgViewerQt models don't show correctly. It looks like the textures are missing and that lighting is not as expected, but on some models (cow.osg) it appears to be a problem with texture mapping. The same models look fine with the normal osgViewer running 3.6.4. I have attached a screenshot of how cow.osg renders in osgViewerQt. The plugins to load the images are correctly loaded in the Qt version. I have played around with the QSurfaceFormat settings but I couldn't see any changes. Is there anything I'm missing or is there something that could be causing this? Can others please confirm that the osgViewerQt example is working fine on their side? My setup: Visual Studio 2013, compiling in 64bit OSG 3.6.4 osgQt master Qt 5.5.1 -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76652#76652 Attachments: http://forum.openscenegraph.org//files/cow_107.png ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [forum] compile osgQt by osg3.6.3 fail
Hi, I have encountered the same problem and created a pull request: https://github.com/openscenegraph/osgQt/pull/28 Hope it helps, it compiles fine on my side now. Wouter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76653#76653 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgQt Material issue
After some investigations I figured that the fixed pipeline functionality wasn't used and I came across this code that seems to explicitly disable that regardless of OpenGL version (I'm running 2) OSGRenderer.cpp lines 210 Code: for(osgViewer::Viewer::Windows::iterator itr = windows.begin(); itr != windows.end(); ++itr) { (*itr)->getState()->setUseModelViewAndProjectionUniforms(false); (*itr)->getState()->setUseVertexAttributeAliasing(false); (*itr)->getState()->setShaderCompositionEnabled( false); // TODO: check if we need it ??? } Removing these lines fixes the problem for me, but I want to make sure it will work for other versions (OpenGL 3) as well. As far as I understand and could see in the OSG code these settings are already applied correctly when setting up a View in OSG and none of these are necessary? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76670#76670 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Render to Texture and osgQt (osgQOpenGL)
Hi all, I'm really struggling with getting RTT to work under the latest version of osgQt and using osgQOpenGL. I am aware of the discussion around adding the setDrawBuffer(GL_BACK) and setReadBuffer(GL_BACK) to the camera for double buffered contexts, but no matter what settings I set for the window and QSurface, the screen remains empty. I am using the original osgPrerender example for testing. The same works fine with the previous version (the one that was updated to incorporate the camera buffer changes) of osgQt, which uses GraphicsWindowQt. Given the state of the current master of osgQt and the problems compiling and running it to begin with; is anybody using the osgQOpenGL at the moment? Is it working with a render to texture camera? Kind regards, Wouter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76682#76682 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to Texture and osgQt (osgQOpenGL)
Thank you, that looks helpful. I have quickly tried implementing it but it does not seem to fix the problem I'm having, however it now does now react to keyboard inputs again, so it looks like it is a step in the right direction. I will try I bit more later today. gwaldron wrote: > Read this - it might help: > http://forum.osgearth.org/solved-black-screen-with-drape-mode-in-a-QOpenGLWidget-td7592420.html#a7592421 > > (http://forum.osgearth.org/solved-black-screen-with-drape-mode-in-a-QOpenGLWidget-td7592420.html#a7592421) > > Glenn Waldron / osgEarth > > > -- > Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76685#76685 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Render to Texture and osgQt (osgQOpenGL)
Finally had some time to look at it in more detail and it was a problem on my side, all is working now with setting the default fbo id. I've made a pull request, thanks again for the pointer. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76724#76724 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org