[osg-users] questions about developing drivers for osg/osgEarth

speterson at idealaero.com speterson at idealaero.com
Wed Sep 25 11:09:51 PDT 2019


Wanted to let you know I had some success with this following code.

    // Feature Options (references the geometry)
    _featureOptions.geometry() = _polygon;

    // Model Options (references the feature options and style)
    _geomOptions.featureOptions() = _featureOptions;
    _geomOptions.merge(_featureOptions);

    osgEarth::Layer* l = _map->getLayerByName("newlayer" + std::to_string(_newlayertimemin));
    osgEarth::ModelLayer* ml = dynamic_cast<osgEarth::ModelLayer*>(l);
    osgEarth::Features::FeatureModelSource* ms = (osgEarth::Features::FeatureModelSource*)ml->getModelSource();
    ms->getFeatureSource()->dirty();

When I was doing this before I was using ms->dirty(); which never caused the redraw but found that someone in one of the forms was using a doing it one call deeper on the ModelSource insteadof the FeatureModelSource and this fixed my update issue within my system thread.  My changes to the geometry _polygon are now working and seems to work really nicely.

Ofc if this is not the optimal way to handle this please let me know. Or if my shader idea for doing animations is not optimal please feel free to suggest ways to make it better.

Thanks.

From: osg-users [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Chris Hanson
Sent: Wednesday, September 25, 2019 12:08 AM
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
Subject: Re: [osg-users] questions about developing drivers for osg/osgEarth

I'd like to help you a bit more, but I've been really slammed with another osgEarth client this week. If you're patient, I can probably help you more in a few days.

On Mon, Sep 23, 2019 at 2:03 PM speterson at idealaero.com<mailto:speterson at idealaero.com> <speterson at idealaero.com<mailto:speterson at idealaero.com>> wrote:
Got shaders to work on geometry’s now just took me getting totally frustrated and taking a walk it seems ☺

osgEarth::ModelLayerOptions layerOptions("test polygon", geomOptions);
osgEarth::ModelLayer* test = new osgEarth::ModelLayer(layerOptions);
osg::StateSet* tss = test->getOrCreateStateSet();
VirtualProgram* vp = VirtualProgram::getOrCreate(tss);
vp->setName("imageLayer");
myshaders shaders;
shaders.load(vp, shaders.myimagecc_Vertex);
shaders.load(vp, shaders.myimagecc_Fragment);
_map->addLayer(test);

Was the code to get it working had to apply it to the ModelLayer not the geometry and add some hooks into my shaders to keep the transparent parts the same.


Now to figure out how to get the data to change for the shaders to act on.


From: osg-users [mailto:osg-users-bounces at lists.openscenegraph.org<mailto:osg-users-bounces at lists.openscenegraph.org>] On Behalf Of Chris Hanson
Sent: Thursday, September 19, 2019 10:29 AM
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org<mailto:osg-users at lists.openscenegraph.org>>
Subject: Re: [osg-users] questions about developing drivers for osg/osgEarth

Ok. That helps a lot. Thanks.

So, I theorize that you are loading a 2d vector field as a data layer, that represents the 2D wind velocity vector at every data grid point covering the area, and then you use some kind of shader to display that as a colorfield and displays the moving flow lines? And then you update the 2d vector map periodically to represent the current data?

If that's the case, it sounds like you're just needing to load a conventional two-channel 2D image and do all the display work in shaders. That doesn't sound like how you're doing it though?


There's nothing at all that is file-specific about osgEarth, its drivers or its data sources. Many of the drivers talk to network-based data sources without accessing local files, so those shouldn't be an issue.

Glenn can probably comment better on how to best make a driver that updates itself periodically or on cue, but you ought to be able to just poll every 30 seconds or so and see if a data is available and refresh it somehow.


The information contained in this email and any attachments is intended only for the personal and confidential use of the intended recipients. This email message may be or may contain privileged and confidential communications. If the reader of this e-mail is not an intended recipient, you are hereby notified that you have received this communication in error and that any retention, review, use, dissemination, distribution or copying of this communication or the information contained herein is strictly prohibited. If you have received this communication in error, please notify the sender immediately and delete the original message and all attachments from your system. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email. This communication may also contain data subject to U.S. export laws. If so, that data subject to the International Traffic in Arms Regulation (ITAR) cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, absent the express prior approval of the U.S. Department of State. If you have received this communication in error, please notify the sender by reply e-mail and destroy the e-mail message and any physical copies made of the communication. Thank you.
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org<mailto:osg-users at lists.openscenegraph.org>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
Chris 'Xenon' Hanson, omo sanza lettere. Xenon at AlphaPixel.com<mailto:Xenon at AlphaPixel.com> http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel<https://twitter.com/alphapixel> facebook.com/alphapixel<http://facebook.com/alphapixel> (775) 623-PIXL [7495]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20190925/ade6f79e/attachment-0001.html>


More information about the osg-users mailing list