[osg-users] Draw through a mask
Hi, I have an osg::Geometry (a long rectangle above a terrain). But I want it to be really drawn only through a mask (this mask is for example a small square I can move on the terrain; it reveals the long geometry through it; other parts of the long geometry must not be drawn) What is the good approach for realizing this task? (note i am using OsgEarth, but as far as i know it does not provide a such feature). Thank you! Cheers, Jérôme -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70638#70638 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [ANN] Cross-platform guide for Linux, macOS, and Windows
Hi. Currently I work on OpenSceneGraph cross-platform guide. Its purpose is to let new users dive into OSG development on any of the following platforms: Linux, macOS, Windows, Android, iOS, Web. Here is the guide's home page: https://github.com/OGStudio/ openscenegraph-cross-platform-guide As of today (2017-04-03), there are 4 tutorials available: 1.1. Create a simple cube in Blender for OpenSceneGraph 1.2. Install OpenSceneGraph under Linux and display the cube with osgviewer 1.3. Install OpenSceneGraph under Windows and display the cube with osgviewer 1.4. Install OpenSceneGraph under macOS and display the cube with osgviewer Each tutorial consists of a video (available at both YouTube and GitHub) and an article. There are about 7 more tutorials pending, which will cover creating and using a simple application that would work across 6 platforms listed in the beginning. I decided to announce the guide in the middle of work, because your feedback may help make the rest of the tutorials better. Waiting for your feedback, folks. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [3rdparty] OSG + Qt on Android
Hi. There are 2 specific requirements for things to render on mobile: 1. Make sure your models are triangulated, quads are not supported 2. Make sure you use shaders, fixed function pipeline is not supported 2017-04-03 15:24 GMT+07:00 Alistair Baxter : > When I had to make an app integrate osg and Qt on Android (and other > portable platforms) , I based it off the osg / Qt Quick example here: > > https://forum.qt.io/topic/30707/demo-integrating- > openscenegraph-with-qt-quick > > Since then, other osg / Qt quick examples have been put forward, if you > search the mailing list archives. > > Qt widgets isn't really intended to work well with mobile platforms, and > that's what the old osgQt library is based on. > > > -Original Message- > From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On > Behalf Of Coach Treazy > Sent: 31 March 2017 23:45 > To: osg-users@lists.openscenegraph.org > Subject: [osg-users] [3rdparty] OSG + Qt on Android > > All, > > I'm trying to run an open scene graph+qt example on my Samsung Galaxy S2 > tablet. I'm using Qt 5.8, OpenSceneGraph 3.5.6, Android NDK-r13b and > Android 6.0 (API Level 23). FYI - I compiled open scene graph on Android > and did not download binaries. > > I cannot even get the open scene graph examples to work. Code compiles > fine but when I deploy it on my tablet all I see is a blue screen. I have > seen this question posted on the forums before but I do not think it has > been solved. This is my first post and therefore I cannot post URL links to > the previous answers but you can search for the title "OSG with Qt on > Android fails to render anything" on the forums > > I have posted my example code below and any help will be appreciated. > > > Code: > #include "QTimer" > #include "QApplication" > #include "QGridLayout" > > #include "osgViewer/CompositeViewer" > #include "osgViewer/ViewerEventHandlers" > #include "osg/PositionAttitudeTransform" > #include "osgGA/MultiTouchTrackballManipulator" > #include "osg/ShapeDrawable" > #include "osgDB/ReadFile" > #include "osgQt/GraphicsWindowQt" > > #include "iostream" > > class ViewerWidget : public QWidget, public osgViewer::CompositeViewer { > public: > ViewerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0, > osgViewer::ViewerBase::ThreadingModel threadingModel=osgViewer:: > CompositeViewer::SingleThreaded) : QWidget(parent, f) { setThreadingModel( > threadingModel); > > // disable the default setting of viewer.done() by pressing Escape. > setKeyEventSetsDone(0); > > const double r_earth = 6378.137; > const double r_sun = 695990.0; > const double AU = 149697900.0; > > // Create the Earth, in blue > osg::ShapeDrawable *earth_sd = new osg::ShapeDrawable; > osg::Sphere* earth_sphere = new osg::Sphere; earth_sphere-"setName(" > EarthSphere"); > earth_sphere-"setRadius(r_earth); > earth_sd-"setShape(earth_sphere); > earth_sd-"setColor(osg::Vec4(0, 0, 1.0, 1.0)); > > osg::Geode* earth_geode = new osg::Geode; earth_geode-"setName(" > EarthGeode"); > earth_geode-"addDrawable(earth_sd); > > // Create the Sun, in yellow > osg::ShapeDrawable *sun_sd = new osg::ShapeDrawable; > osg::Sphere* sun_sphere = new osg::Sphere; sun_sphere-"setName("SunSphere"); > sun_sphere-"setRadius(r_sun); sun_sd-"setShape(sun_sphere); > sun_sd-"setColor(osg::Vec4(1.0, 0.0, 0.0, 1.0)); > > osg::Geode* sun_geode = new osg::Geode; > sun_geode-"setName("SunGeode"); > sun_geode-"addDrawable(sun_sd); > > // Move the sun behind the earth > osg::PositionAttitudeTransform *pat = new osg::PositionAttitudeTransform; > pat-"setPosition(osg::Vec3d(0.0, AU, 0.0)); pat-"addChild(sun_geode); > > osg::Geometry * unitCircle = new osg::Geometry(); { > osg::Vec4Array * colours = new osg::Vec4Array(1); > (*colours)[0] = osg::Vec4d(1.0,1.0,1.0,1.0); > unitCircle-"setColorArray(colours, osg::Array::BIND_OVERALL); > const unsigned int n_points = 1024; > osg::Vec3Array * coords = new osg::Vec3Array(n_points); > const double dx = 2.0*osg::PI/n_points; > double s,c; > for (unsigned int j=0; j"n_points; ++j) { > s = sin(dx*j); > c = cos(dx*j); > (*coords)[j].set(osg::Vec3d(c,s,0.0)); > } > unitCircle-"setVertexArray(coords); > unitCircle-"getOrCreateStateSet()-"setMode(GL_LIGHTING,osg:: > StateAttribute::OFF); > unitCircle-"addPrimitiveSet(new osg::DrawArrays(osg:: > PrimitiveSet::LINE_LOOP,0,n_points)); > } > > osg::Geometry *axes = new osg::Geometry; { > osg::Vec4Array *colours = new osg::Vec4Array(1); > (*colours)[0] = osg::Vec4d(1.0,0.0,0.0,1.0); > axes-"setColorArray(colours, osg::Array::BIND_OVERALL); > osg::Vec3Array *coords = new osg::Vec3Array(6); > (*coords)[0].set(osg::Vec3d(0.0, 0.0, 0.0)); > (*coords)[1].set(osg::Vec3d(0.5, 0.0, 0.0)); > (*coords)[2].set(osg::Vec3d(0.0, 0.0, 0.0)); > (*coords)[3].set(osg::Vec3d(0.0, 0.5, 0.0)); >
Re: [osg-users] [3rdparty] OSG + Qt on Android
When I had to make an app integrate osg and Qt on Android (and other portable platforms) , I based it off the osg / Qt Quick example here: https://forum.qt.io/topic/30707/demo-integrating-openscenegraph-with-qt-quick Since then, other osg / Qt quick examples have been put forward, if you search the mailing list archives. Qt widgets isn't really intended to work well with mobile platforms, and that's what the old osgQt library is based on. -Original Message- From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Coach Treazy Sent: 31 March 2017 23:45 To: osg-users@lists.openscenegraph.org Subject: [osg-users] [3rdparty] OSG + Qt on Android All, I'm trying to run an open scene graph+qt example on my Samsung Galaxy S2 tablet. I'm using Qt 5.8, OpenSceneGraph 3.5.6, Android NDK-r13b and Android 6.0 (API Level 23). FYI - I compiled open scene graph on Android and did not download binaries. I cannot even get the open scene graph examples to work. Code compiles fine but when I deploy it on my tablet all I see is a blue screen. I have seen this question posted on the forums before but I do not think it has been solved. This is my first post and therefore I cannot post URL links to the previous answers but you can search for the title "OSG with Qt on Android fails to render anything" on the forums I have posted my example code below and any help will be appreciated. Code: #include "QTimer" #include "QApplication" #include "QGridLayout" #include "osgViewer/CompositeViewer" #include "osgViewer/ViewerEventHandlers" #include "osg/PositionAttitudeTransform" #include "osgGA/MultiTouchTrackballManipulator" #include "osg/ShapeDrawable" #include "osgDB/ReadFile" #include "osgQt/GraphicsWindowQt" #include "iostream" class ViewerWidget : public QWidget, public osgViewer::CompositeViewer { public: ViewerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0, osgViewer::ViewerBase::ThreadingModel threadingModel=osgViewer::CompositeViewer::SingleThreaded) : QWidget(parent, f) { setThreadingModel(threadingModel); // disable the default setting of viewer.done() by pressing Escape. setKeyEventSetsDone(0); const double r_earth = 6378.137; const double r_sun = 695990.0; const double AU = 149697900.0; // Create the Earth, in blue osg::ShapeDrawable *earth_sd = new osg::ShapeDrawable; osg::Sphere* earth_sphere = new osg::Sphere; earth_sphere-"setName("EarthSphere"); earth_sphere-"setRadius(r_earth); earth_sd-"setShape(earth_sphere); earth_sd-"setColor(osg::Vec4(0, 0, 1.0, 1.0)); osg::Geode* earth_geode = new osg::Geode; earth_geode-"setName("EarthGeode"); earth_geode-"addDrawable(earth_sd); // Create the Sun, in yellow osg::ShapeDrawable *sun_sd = new osg::ShapeDrawable; osg::Sphere* sun_sphere = new osg::Sphere; sun_sphere-"setName("SunSphere"); sun_sphere-"setRadius(r_sun); sun_sd-"setShape(sun_sphere); sun_sd-"setColor(osg::Vec4(1.0, 0.0, 0.0, 1.0)); osg::Geode* sun_geode = new osg::Geode; sun_geode-"setName("SunGeode"); sun_geode-"addDrawable(sun_sd); // Move the sun behind the earth osg::PositionAttitudeTransform *pat = new osg::PositionAttitudeTransform; pat-"setPosition(osg::Vec3d(0.0, AU, 0.0)); pat-"addChild(sun_geode); osg::Geometry * unitCircle = new osg::Geometry(); { osg::Vec4Array * colours = new osg::Vec4Array(1); (*colours)[0] = osg::Vec4d(1.0,1.0,1.0,1.0); unitCircle-"setColorArray(colours, osg::Array::BIND_OVERALL); const unsigned int n_points = 1024; osg::Vec3Array * coords = new osg::Vec3Array(n_points); const double dx = 2.0*osg::PI/n_points; double s,c; for (unsigned int j=0; j"n_points; ++j) { s = sin(dx*j); c = cos(dx*j); (*coords)[j].set(osg::Vec3d(c,s,0.0)); } unitCircle-"setVertexArray(coords); unitCircle-"getOrCreateStateSet()-"setMode(GL_LIGHTING,osg::StateAttribute::OFF); unitCircle-"addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,n_points)); } osg::Geometry *axes = new osg::Geometry; { osg::Vec4Array *colours = new osg::Vec4Array(1); (*colours)[0] = osg::Vec4d(1.0,0.0,0.0,1.0); axes-"setColorArray(colours, osg::Array::BIND_OVERALL); osg::Vec3Array *coords = new osg::Vec3Array(6); (*coords)[0].set(osg::Vec3d(0.0, 0.0, 0.0)); (*coords)[1].set(osg::Vec3d(0.5, 0.0, 0.0)); (*coords)[2].set(osg::Vec3d(0.0, 0.0, 0.0)); (*coords)[3].set(osg::Vec3d(0.0, 0.5, 0.0)); (*coords)[4].set(osg::Vec3d(0.0, 0.0, 0.0)); (*coords)[5].set(osg::Vec3d(0.0, 0.0, 0.5)); axes-"setVertexArray(coords); axes-"getOrCreateStateSet()-"setMode(GL_LIGHTING,osg::StateAttribute::OFF); axes-"addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6)); } // Earth orbit osg::Geode * earthOrbitGeode = new osg::Geode; earthOrbitGeode-"addDrawable(unitCircle); earthOrbitGeode-"addDrawable(axes); earthOr