Re: [osg-users] [forum] CMake can't find libraries

2019-01-07 Thread Nathan Mielcarek
Hi Rodrigo,

If you run make install from the build directory, all of the includes and
libraries will go to the /usr/local/ directories and then you can set
OSG_ROOT to /usr/local (although I believe it's already on the search
path). It's good practice to not have multiple OSG versions on the search
path as that can lead to potential issues.

-Nathan

On Tue, Jan 1, 2019 at 5:41 PM Rodrigo Dias  wrote:

> Hi,
>
> I'm following OpenSceneGraph 3.0: Beginner's Guide (
> https://www.packtpub.com/game-development/openscenegraph-30-beginners-guide),
> and right at page 44 there is a CMakeLists.txt that won't work. CMake is
> giving the following error message:
>
>
> > Could NOT find OpenThreads (missing:  OPENTHREADS_LIBRARY)
> > Could NOT find osg (missing:  OSG_LIBRARY)
> > Could NOT find osgDB (missing:  OSGDB_LIBRARY)
> > Could NOT find osgUtil (missing:  OSGUTIL_LIBRARY)
> > Could NOT find osgViewer (missing:  OSGVIEWER_LIBRARY)
> > Configuring done
> >
>
>
> The book says "make sure you have the OSG_ROOT environment variable set.
> Otherwise, the find_package() macro may not be able to find OSG
> installations correctly."
>
> This variable is set to the directory of the build, the one which includes
> applications, bin, data, include, lib, packaging and src. However, the
> "include" directory only contains OpenThreads and osg, while
> /usr/local/include contains 18 directories (from a previous installation, I
> guess). Also, the OpenThreads in the build directory only contains two
> files: Config and Version, while the one in /usr/local/include contains 13
> files. What have I done wrong?
>
> Thank you!
>
> Cheers,
> Rodrigo[/url]
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75371#75371
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Can i use MatrixTransform to transform a HUD node?

2019-01-07 Thread Terry Welsh
>  So you mean that if i want to move or scale these hud nodes on the main 
> screen, i have to use the camera's setviewmatrix method to do this? Add the 
> hud nodes to a new MT and use the Mt transform methods won't work,right?
>
>  The node structure instruction is like the following:
>
>   1. Root->hud node->Mt node->geode node->geometries;
>
>   2. Root->Mt node-> hud node->geode node->geometries;
>
> So the first one will work and the second won't,right?
>
I have only done #1, where the HUD node is derived from osg::Camera. I
set the view matrix and projection matrix to provide a simple box in
which to render all HUD elements. The individual elements can be
positioned within that box with MatrixTransforms.

It's not very hard to get this working. Try prototyping it with one
osgText::Text element and one simple box or sphere under a
MatrixTransform.

>
> I'm afraid I didn't understand this explanation very well myself. My first
> question would be, do the HUD elements (the 2d pics) stay stuck to the
> screen space (as if they were part of a game scoreboard overlaid onto the
> screen) or do the move around the screen as the main view camera rotates,
> tilts, moves, etc like an Augment Reality environment?
>
Chris, I assumed your first idea. AR labels never crossed my mind.
Maybe Chen can tell us if I made the right assumption.
- Terry
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Can i use MatrixTransform to transform a HUD node?

2019-01-07 Thread Chen Gao

Chris Hanson wrote:
> 
> 
> I'm afraid I didn't understand this explanation very well myself. My first 
> question would be, do the HUD elements (the 2d pics) stay stuck to the screen 
> space (as if they were part of a game scoreboard overlaid onto the screen) or 
> do the move around the screen as the main view camera rotates, tilts, moves, 
> etc like an Augment Reality environment?
> 
> 
> -- 
> 
> 
> Chris 'Xenon' Hanson, omo sanza lettere.  http://www.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]
> 
>  --
> Post generated by Mail2Forum


Thank you for your reply. If you feel confused by my unprofessional   
explanation:), you can think it this way as below:

   Can I use a MT node to add the Hud node and then transform the hud on 
the screen by the MT parent node.This should be clear.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75417#75417





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] setViewMatrixAsLookAt not working to set the initial camera position

2019-01-07 Thread Rodrigo Dias
I just tried it, but still the camera is messed up. No matter which numbers I 
choose to eye, center and up, it never behaves as default. I have not even a 
clue about the difference between 10, 100 and 1000, which one should I use? 
(I'm using osgEarth's Map and MapNode, btw, which are displaying a whole flat 
white Earth, with only the desired country drawn with a texture) I tried using 
getViewMatrixAsLookAt with the default values, but it's still a mess. I've 
looked at many questions here, and in some of the source code, but nothing 
clears this up.

Thank you!

Cheers,
Rodrigo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75415#75415





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] setViewMatrixAsLookAt not working to set the initial camera position

2019-01-07 Thread sam
After you set the home position try:
viewer.getCameraManipulator()->home(1);

Sorry I'm not right in front of my computer right now.

On Mon, Jan 7, 2019 at 7:26 PM Rodrigo Dias  wrote:

> Hi Sam,
>
> By "home" I think you mean
>
>
> Code:
> viewer.getCameraManipulator()->setHomePosition( eye, center, up );
>
>
>
>
> This really changed camera's position, though it's totally freaking out
> now (I'm still fiddling with the values in eye, center and up).
>
> But I have no idea what you meant by "delta time", something to go inside
> the loop?
>
> Thank you!
>
> Cheers,
> Rodrigo
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75413#75413
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] setViewMatrixAsLookAt not working to set the initial camera position

2019-01-07 Thread Rodrigo Dias
Hi Sam,

By "home" I think you mean


Code:
viewer.getCameraManipulator()->setHomePosition( eye, center, up );




This really changed camera's position, though it's totally freaking out now 
(I'm still fiddling with the values in eye, center and up).

But I have no idea what you meant by "delta time", something to go inside the 
loop?

Thank you!

Cheers,
Rodrigo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75413#75413





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] setViewMatrixAsLookAt not working to set the initial camera position

2019-01-07 Thread sam
Hey Rodrigo,

You have to set the home position of your camera manipulator and make a
call to home(1). You can force the delta time with a 1.

Sam

On Mon, Jan 7, 2019 at 6:48 PM Rodrigo Dias  wrote:

> Hi,
>
> I'm able to change the camera's position with TrackballManipulator.
> However, I'd like to change the camera's initial position, but all the
> examples I've found just won't work. My source code is:
>
>
> Code:
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
>
> using namespace std;
> using namespace osg;
> using namespace osgEarth;
> using namespace osgEarth::Drivers;
>
> int main (int argc, char** argv) {
> MapOptions mapOpt;
> mapOpt.coordSysType() = MapOptions::CSTYPE_PROJECTED;
> mapOpt.profile() = ProfileOptions("plate-carre");
> osg::ref_ptr map = new Map(mapOpt);
> {
> GDALOptions gdal;
> gdal.url() = "br_modified.tif";
> osg::ref_ptr layer = new ImageLayer( "BR",
> gdal );
> map->addLayer( layer );
> }
> {
> GDALOptions gdal;
> gdal.url() = "BRalt.tif";
> osg::ref_ptr layer = new ElevationLayer(
> "SRTM", gdal );
> map->addLayer( layer );
> }
> osg::ref_ptr mapNode = new MapNode( map );
> osgViewer::Viewer viewer;
> viewer.setSceneData( mapNode.get() );
> viewer.setCameraManipulator( new osgGA::TrackballManipulator );
>
> Vec3 eye( 1.0, 5.0, 10.0 ); // The position of your
> camera
> Vec3 center( 0.0, 0.0, 0.0 ); // The point your camera is looking
> at
> Vec3 up( 0.0, 1.0, 0.0 ); // The up-vector of your camera - this
> controls how your viewport will be rotated about its center and should be
> equal to [0, 1, 0] in a conventional graphics coordinate system
> viewer.getCamera()->setViewMatrixAsLookAt( eye, center, up );
> while ( !viewer.done() ) {
> viewer.frame();
> }
> return 0;
> }
>
>
>
>
> No matter which values I use for "eye", the camera always begins in the
> same position. Why is that?
>
> Thank you!
>
> Cheers,
> Rodrigo
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75411#75411
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] setViewMatrixAsLookAt not working to set the initial camera position

2019-01-07 Thread Rodrigo Dias
Hi,

I'm able to change the camera's position with TrackballManipulator. However, 
I'd like to change the camera's initial position, but all the examples I've 
found just won't work. My source code is:


Code:
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;
using namespace osg;
using namespace osgEarth;
using namespace osgEarth::Drivers;

int main (int argc, char** argv) {
MapOptions mapOpt;
mapOpt.coordSysType() = MapOptions::CSTYPE_PROJECTED;
mapOpt.profile() = ProfileOptions("plate-carre");
osg::ref_ptr map = new Map(mapOpt);
{
GDALOptions gdal;
gdal.url() = "br_modified.tif";
osg::ref_ptr layer = new ImageLayer( "BR", gdal );
map->addLayer( layer );
}
{
GDALOptions gdal;
gdal.url() = "BRalt.tif";
osg::ref_ptr layer = new ElevationLayer( 
"SRTM", gdal );
map->addLayer( layer );
}
osg::ref_ptr mapNode = new MapNode( map );
osgViewer::Viewer viewer;
viewer.setSceneData( mapNode.get() );
viewer.setCameraManipulator( new osgGA::TrackballManipulator );

Vec3 eye( 1.0, 5.0, 10.0 ); // The position of your camera
Vec3 center( 0.0, 0.0, 0.0 ); // The point your camera is looking at
Vec3 up( 0.0, 1.0, 0.0 ); // The up-vector of your camera - this 
controls how your viewport will be rotated about its center and should be equal 
to [0, 1, 0] in a conventional graphics coordinate system
viewer.getCamera()->setViewMatrixAsLookAt( eye, center, up );
while ( !viewer.done() ) {
viewer.frame();
}
return 0;
}




No matter which values I use for "eye", the camera always begins in the same 
position. Why is that?

Thank you!

Cheers,
Rodrigo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75411#75411





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] getting the world coordinate by screen coordinate in a sky shpere

2019-01-07 Thread Qi Liu
Hi,all

I am a new to osg and I use the following method to get the world  
coordinate by screen corrdiante and it works well: 
osg::Matrix VPW = viewer->getCamera()->getViewMatrix() *
viewer->getCamera()->getProjectionMatrix() *viewer->
getCamera()->getViewport()_>computeWindowMatrix();
osg::Matrix Inm = osg::Matrix::inverse(VPW);
osg::Vec3d world = (osg::Vec3d(pos.x(), pos.y(), 0)) * Inm;

My scene is quite sample,the root has only one child:
root->addchild(osgDB::readNodeFile("cow.osg"));


When i add a big sky shpere that surrounds the cow,scene changing to:
root->addchild(osgDB::readNodeFile("cow.osg")); 
osg::ref_ptr drawable = new osg::ShapeDrawable(new 
osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), 100));
   osg::ref_ptr geode = new osg::Geode;
   geode->addDrawable(drawable.get());
   root->addchild(geode);

I cannot get the right world  coordinate when my camera move inside the sphere 
by the above method. 

Did I miss something?Is there some way to  ignore the sphere and then to get 
the world coordinate by screen coordinate?
 
If anyone could point me in the right direction with some simple code,it is 
very much appreciated. Thanks a lot!

Thank you!

Cheers,
Qi :D

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75410#75410





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [3rdparty] Use PNG as texture for terrain in osgEarth

2019-01-07 Thread Rodrigo Dias
Well, I managed to create a georeferenced texture file in TIFF format. However, 
since it's about twice the size of the PNG (even compacted with LZW), it would 
be great if PNGs could be used instead.

I also managed to make the map projected (flat), by adding the following code 
in the beginning:


Code:
MapOptions mapOpt;
mapOpt.coordSysType() = MapOptions::CSTYPE_PROJECTED;
mapOpt.profile() = ProfileOptions("plate-carre");
osg::ref_ptr map = new Map(mapOpt);




However, I just can't see the elevation. Is there any "exaggeration" parameter, 
such as in Google Earth? I couldn't find any.

Thank you!

Cheers,
Rodrigo[/img]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75409#75409





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Deleting still referenced object

2019-01-07 Thread Richard Harrison

Using osg master; self built; application FlightGear; Win32 x64; MSVC 2015.

In FlightGear when OSG warning Warning: deleting still referenced object 
... the final reference count was" is detected in our NotifyHandler we 
throw an exception (probably the only reliably thing to do, as this 
message generally comes before some sort of segfault).


I've been trying to figure out what's the root cause of this for a 
months; I managed to reduce the incidence of these errors by changing 
ObjectCache::removeExpiredObjectsInCache to use < expiry time rather 
than <= expiry time, however this might be a specific instance of a more 
general problem; as since I did this I think I've figured out what is 
actually going on.


The more general problem is that the ObjectCache is removing an expired 
object however at the same time and inside the DatabasePager thread the 
object becomes active again; i.e. after the check for expiry time where 
_refCount == 1 passes and the deletion has started when at the same 
point a ref_ptr to the newly loaded object is created.


I think my analysis is right; I've had probably the longest debug 
session ever (since 31/12/2018) whilst I investigate (it took over 
40hours of flight before the problem happened).



See https://i.imgur.com/DTPEpmh.png

So to unravel the two threads; firstly the stack dump of the main thread.
1.    fgfs.exe!NotifyLogger::notify(osg::NotifySeverity severity, const 
char * message) Line 26    C++

2.  osg160-osg.dll!osg::NotifyStreamBuffer::sync() Line 92 C++
3.  msvcp140.dll!7ff8ed0927f2()    Unknown
4. osg160-osg.dll!std::endl 
>(std::basic_ostream > & _Ostr) Line 994    C++

5.  osg160-osg.dll!osg::Referenced::~Referenced() Line 216 C++
6.  osgdb_ac.dll!osg::Group::`scalar deleting destructor'(unsigned 
int)    C++
7. osg160-osg.dll!osg::Referenced::signalObserversAndDelete(bool 
signalDelete, bool doDelete) Line 306    C++

8.  osg160-osg.dll!osg::Referenced::unref() Line 194    C++
9. 
osg160-osgDB.dll!std::_Tree,std::allocator 
>,osg::ref_ptr 
>,std::pair,double>,osgDB::ObjectCache::ClassComp,std::allocator,std::allocator >,osg::ref_ptr > const ,std::pair,double> > >,0> >::erase(std::_Tree_const_iterator,std::allocator >,osg::ref_ptr > const ,std::pair,double> > > > > _Where) Line 1431    C++
10. 
osg160-osgDB.dll!osgDB::ObjectCache::removeExpiredObjectsInCache(double 
expiryTime) Line 171    C++
11.  osg160-osgViewer.dll!osgViewer::Viewer::updateTraversal() Line 
1161    C++
12.  osg160-osgViewer.dll!osgViewer::ViewerBase::frame(double 
simulationTime) Line 748    C++

13.  fgfs.exe!fgOSMainLoop() Line 339    C++
14.  fgfs.exe!fgMainInit(int argc, char * * argv) Line 619 C++
15.  fgfs.exe!main(int argc, char * * argv) Line 339    C++
16.  fgfs.exe!__scrt_common_main_seh() Line 253    C++
17.  kernel32.dll!7ff96a477e94()    Unknown
18.  ntdll.dll!7ff96c81a251()    Unknown

The problem starts in (10) above, referring to the code; it is calling 
_objectCache.erase(oitr) which the reference count must be 1, following 
this through it is Referenced::unref that decrements the count, and 
finally this is checked in Referenced.cpp:213 (I've added extra code as 
part of the diagnostic process).



(10)
155. void ObjectCache::removeExpiredObjectsInCache(double expiryTime)
156. {
157. OpenThreads::ScopedLock 
lock(_objectCacheMutex);

158.
159. // Remove expired entries from object cache
160. ObjectCacheMap::iterator oitr = _objectCache.begin();
161. while (oitr != _objectCache.end())
162. {
163. if (oitr->second.second <= expiryTime)
164. {
165. if (oitr->second.first->referenceCount() == 1) {
166. #if __cplusplus > 199711L
167. oitr = _objectCache.erase(oitr);
168. #else
169. _objectCache.erase(oitr++);
170. #endif
171. continue;
172. }
173. else
174. //RJHDO: consider whether or not _refCount>0 prior 
to removal

175. // first is FileNameOptionsPair
176. // second is ObjectTimeStampPair
177. OSG_WARN << 
"ObjectCache::removeExpiredObjectsInCache expired object has references: 
" << oitr->first.first << " refcount != 1 " << 
oitr->second.first->referenceCount() << std::endl;

178.
179. }
180. ++oitr;
181. }
182. }
183.

(8)

169. inline int Referenced::unref() const
170. {
171. int newRef;
172. #if defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS)
173. newRef = --_refCount;
174. bool needDelete = (newRef == 0);
175. #else
176. bool needDelete = false;
177. if (_refMutex)
178. {
179. OpenThreads::ScopedLock lock(*_refMutex);
180. newRef = --_refCount;
181. needDelete = newRef==0;
182. }
183. else
184. {
185. newRef = --_refCount;
186. needDelete = newRef==0;
187. }
188. #endif
189.
190. if 

Re: [osg-users] [3rdparty] Use PNG as texture for terrain in osgEarth

2019-01-07 Thread Rodrigo Dias
Ok, Chris, I got it.

Is there any way to tell the program where to put the PNG image? Or must I use 
a georeferenced TIFF?

Other thing, the XML documentation 
(http://docs.osgearth.org/en/latest/references/earthfile.html#map) explains 
that I can choose between a geocentric (ellipsoidal) or a projected (flat) map. 
How can I choose a flat map programmatically? I didn't find anything in the 
documentation 
(https://updraft.github.io/osgearth-doc/html/classosgEarth_1_1Map.html), and 
the default is geocentric.

Thank you!

Cheers,
Rodrigo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75407#75407





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [3rdparty] Use PNG as texture for terrain in osgEarth

2019-01-07 Thread Chris Hanson
Ok, so if you're adding an image layer programmatically, you *don't *want
to add a .earth XML file.


It should probably look something like

// Add an imagery layer
{
GDALOptions gdal;
gdal.url() = "br.png";
osg::ref_ptr layer = new ImageLayer( "NASA",
tms );
layer->setOpacity(0.5);
printf("\nOpacity: %.2f\n",layer->getOpacity());
map->addLayer( layer );
}

The GDAL loader handles almost all local-disk data loading. The TMS loader
you were trying to use is for loading data from an Internet Tile Map
Server. The GDAL loader loads either elevation or imagery data.

Keep in mind, if you are using br.png, there isn't any positional
information in a PNG file to tell osgEarth WHERE on the Earth to place that
PNG file. Certain file types like TIFF can have extra data (called GeoTIFF)
that specify this positioning. So, consider what you're trying to do here
-- it may not give you errors but you may not see br.png placed anywhere
useful on your map.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [3rdparty] Use PNG as texture for terrain in osgEarth

2019-01-07 Thread Rodrigo Dias
Hi Chris,

following the example, I thought I could use directly a PNG instead of a .earth 
XML. Now I tried a XML.

My source code, main.cpp:


Code:
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;
using namespace osgEarth;
using namespace osgEarth::Drivers;

int main (int argc, char** argv) {
// Create a Map and set it to Geocentric to display a globe
osg::ref_ptr map = new Map();
cout << 1;

// Add an imagery layer (blue marble from a TMS source)
{
TMSOptions tms;
tms.url() = "br.earth";
osg::ref_ptr layer = new ImageLayer( "NASA", tms );
layer->setOpacity(0.5);
printf("\nOpacity: %.2f\n",layer->getOpacity());
map->addLayer( layer );
}
cout << 2 << endl;
}




Compile line:


> g++ main.cpp -lOpenThreads -losg -losgDB -losgUtil -losgViewer -losgEarth -o 
> main
> 


The XML file:


> 
> 
> br.png
> 
> 
> 


How am I supposed to show you my XML if the tags disappear?

I have a br.png file in the same directory of the program. I don't know if I 
should specify "br" or "br.png" as the name of the "image" tag, if driver 
really can contain "png", and if the name of the image should be specified in 
the "url" tag instead (or both).

Now, when the code runs, it displays:


> 1
> Opacity: 0.50
> [osgEarth]* [TMS] Could not find root TileMap element 
> 2
> 


Thank you!

Cheers,
Rodrigo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75405#75405





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [3rdparty] Use PNG as texture for terrain in osgEarth

2019-01-07 Thread Chris Hanson
Can you show your exact code and the .earth XML file?

It sounds to me like it failed to open/load the XML file. Is it a file
path/permisssions issue?

On Mon, Jan 7, 2019 at 6:13 PM Rodrigo Dias  wrote:

> Hi,
>
> Following this example (
> http://docs.osgearth.org/en/latest/developer/maps.html#programmatic-map-creation),
> I'm trying to use a PNG instead of a link (like the example uses a TIFF for
> elevation). However, I got the following error:
>
>
> > [osgEarth]* Error in XML document: Error document empty. (row 0, col 0)
> > [osgEarth]* [TMS] Could not find root TileMap element
> >
>
>
> What should I do instead?
>
> Thank you!
>
> Cheers,
> Rodrigo
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75402#75402
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@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  facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Get Animation current time

2019-01-07 Thread Diego Mancilla
Hello Robert,

Thank you very much for you complete response.

 I'm trying to do what you suggest and have my on 
AnimationPath/AnimationPathCallback classes that handle my data. But I stumble 
into a problem.

 When I subclass AnimationPath and AnimationPathCallback I have no problems. 
But when I wrote my own classes, from scratch my application crashes.

 In order to achieve what I want, I pass a pointer to a custom data container 
class to my AnimationPath class (I called it MobilesAnimationPath) from my main 
application. I tried to keep most part of the architecture of AnimationPath, 
but I eliminate the TimeControlPointMap container. So, now my class generates 
the control points from the data pointed from custom data pointer class. 


So, for instance, my custom Path class looks like this:


Code:
#include "MobileObject.h"
#include 
#include 

using namespace osg;

class MobilesAnimationPath: public virtual osg::Object
{
public:
MobilesAnimationPath();
MobilesAnimationPath(const MobilesAnimationPath &, const osg::CopyOp & 
copyop = osg::CopyOp::SHALLOW_COPY);
MobilesAnimationPath(MobileObject & mobile);

META_Object(osg, MobilesAnimationPath); //Visual Studio complains about 
this line, but compiles... : "function definition for META_Object not found"

enum LoopMode
{
SWING,
LOOP,
NO_LOOPING
};

void setLoopMode(LoopMode loopMode);
LoopMode getLoopMode() const;

virtual bool getInterpolatedControlPoint(double time, 
osg::AnimationPath::ControlPoint & cp) const;

double getFirstTime() const;
double getLastTime() const;
double getPeriod() const;

protected:
~MobilesAnimationPath(){};

private:
MobileObject * _mobile;
LoopMode _loopMode;

};



And the implementation.


Code:
#include "MobilesAnimationPath.h"

MobilesAnimationPath::MobilesAnimationPath()
:_loopMode(NO_LOOPING)
,_mobile(nullptr)
{
}


MobilesAnimationPath::MobilesAnimationPath(const MobilesAnimationPath& ap, 
const osg::CopyOp& copyop)
:osg::Object(ap, copyop)
,_loopMode(ap._loopMode)
,_mobile(ap._mobile) 
{
}

MobilesAnimationPath::MobilesAnimationPath(MobileObject & mobile)
:_loopMode(NO_LOOPING)
{
_mobile = 
}

void MobilesAnimationPath::setLoopMode(LoopMode loopMode)
{
_loopMode = loopMode;
}

MobilesAnimationPath::LoopMode MobilesAnimationPath::getLoopMode() const
{
return _loopMode;
}

double MobilesAnimationPath::getFirstTime() const
{
if (_mobile != nullptr)
{
if (_mobile->dataLoaded())
{
return _mobile->getFirstTime();
}
}
return 0.0;
}

double MobilesAnimationPath::getLastTime() const
{
if (_mobile != nullptr)
{
if (_mobile->dataLoaded())
{
return _mobile->getLastTime();
}
}
return 0.0;
}

double MobilesAnimationPath::getPeriod() const
{
if (_mobile != nullptr)
{
if (_mobile->dataLoaded())
{
return _mobile->getFirstTime() - _mobile->getLastTime();
}
}
return 0.0;
}

bool MobilesAnimationPath::getInterpolatedControlPoint(double time, 
osg::AnimationPath::ControlPoint & cp) const
{
if (_mobile == nullptr) return false;
if (!_mobile->dataLoaded()) return false;

// at this point _mobile points something thats not nullptr but returns 
garbage...

switch (_loopMode)
{
case(SWING):
{
double modulated_time = (time - getFirstTime()) / 
(getPeriod()*2.0);
double fraction_part = modulated_time - floor(modulated_time);
if (fraction_part > 0.5) fraction_part = 1.0 - fraction_part;

time = getFirstTime() + (fraction_part*2.0) * getPeriod();
break;
}
case(LOOP):
{
double modulated_time = (time - getFirstTime()) / getPeriod();
double fraction_part = modulated_time - floor(modulated_time);
time = getFirstTime() + fraction_part * getPeriod();
break;
}
case(NO_LOOPING):
// no need to modulate the time.
break;
}

//... here I fill the control point through the data on _mobile.

return true;


}



but at the first call to "getInterpolatedControlPoint" the application crashes. 
Moreover, the _mobile pointer is "corrupted", i.e., when I try to access its 
data it returns garbage (but it not nullptr). Also the "time" value passed is 
random (sometimes huge, sometimes negative, etc...)

As I pointed on the code snippet, MSVS complains about my META_Object call, but 
the code compiles.

Am I 

[osg-users] [3rdparty] Use PNG as texture for terrain in osgEarth

2019-01-07 Thread Rodrigo Dias
Hi,

Following this example 
(http://docs.osgearth.org/en/latest/developer/maps.html#programmatic-map-creation),
 I'm trying to use a PNG instead of a link (like the example uses a TIFF for 
elevation). However, I got the following error:


> [osgEarth]* Error in XML document: Error document empty. (row 0, col 0)
> [osgEarth]* [TMS] Could not find root TileMap element
> 


What should I do instead?

Thank you!

Cheers,
Rodrigo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75402#75402





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Scale object based on camera distance

2019-01-07 Thread Chris Hanson
Are you using osgEarth?

On Mon, Jan 7, 2019 at 3:38 PM David Mitchell  wrote:

> Thanks, Trajce.  That looks like it will do what I need.  Since this was
> my first post to the forums, apparently it wouldn't show up until an admin
> approved it and during that time I was able to modify the
> GeoPositionNodeAutoScaler class from osgEarth to do what I need it to.
> Looking at osg::AutoTransform, it looks like it's doing more or less the
> same thing, but is more involved.  My solution ended up being a little more
> specialized for my use case.
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75400#75400
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@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  facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Scale object based on camera distance

2019-01-07 Thread David Mitchell
Thanks, Trajce.  That looks like it will do what I need.  Since this was my 
first post to the forums, apparently it wouldn't show up until an admin 
approved it and during that time I was able to modify the 
GeoPositionNodeAutoScaler class from osgEarth to do what I need it to.  Looking 
at osg::AutoTransform, it looks like it's doing more or less the same thing, 
but is more involved.  My solution ended up being a little more specialized for 
my use case.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75400#75400





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Can i use MatrixTransform to transform a HUD node?

2019-01-07 Thread Chris Hanson
>
> Well,as the subject notes,The software in my dev job has to use a HUD
> to show 2d pics. Generally using a camera to create a new viewport to show
> the pic will be OK.
> But the 'Entity' base class for the software system uses a MT
> (matrixtransform) to add the detailed entity node(such as basic
> geometry,text with a geode) and then add this MT node to the root by the
> datacontainer manager class.
> If I create the hud entity class derived from the base class, ie, add
> the camera node to the MT node,does it work if I operate the move, scale
> commands to this hud entity by using MT,not the camera? If it doesn't work,
> how can I change the node structure to make the Hud entity responsive to
> the transform operations which is generated by MT.Or do I only have to use
> the camera node itself to do these transformation jobs?
>

I'm afraid I didn't understand this explanation very well myself. My first
question would be, do the HUD elements (the 2d pics) stay stuck to the
screen space (as if they were part of a game scoreboard overlaid onto the
screen) or do the move around the screen as the main view camera rotates,
tilts, moves, etc like an Augment Reality environment?

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@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  facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Can i use MatrixTransform to transform a HUD node?

2019-01-07 Thread Chen Gao
Thank you Terry! 

 So you mean that if i want to move or scale these hud nodes on the main 
screen, i have to use the camera's setviewmatrix method to do this? Add the hud 
nodes to a new MT and use the Mt transform methods won't work,right?

 The node structure instruction is like the following:

  1. Root->hud node->Mt node->geode node->geometries;

  2. Root->Mt node-> hud node->geode node->geometries;

So the first one will work and the second won't,right?  



Terry Welsh wrote:
> I have made plenty of HUD classes derived from osg::Camera. It's easy
> to set it up as an orthographic or perspective projection, depending
> on what look you're going for. Then I compute some simple coordinates
> for the screen corners like this:
> 
> mHUDLRBT[0] = -mAspectRatio;
> mHUDLRBT[1] = mAspectRatio;
> mHUDLRBT[2] = -1.0f;
> mHUDLRBT[3] = 1.0f;
> if(mAspectRatio < 1.0f){
> mHUDLRBT[0] = -1.0f;
> mHUDLRBT[1] = 1.0f;
> mHUDLRBT[2] = -1.0f / mAspectRatio;
> mHUDLRBT[3] = 1.0f / mAspectRatio;
> }
> 
> All your HUD nodes (such as osgText::Text or something derived from
> MatrixTransform) can be positioned relative to those screen corners.
> Every time you resize your window you should call your HUD nodes
> positioning method.
> - Terry
> 


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75398#75398





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] openGL error 'stack overflow' at after RenderBin::draw(..)

2019-01-07 Thread Chris Hanson
Well, it's hard to say because I don't really know how you are doing it
now, but it seems to me like you're spending a lot of effort rotating and
positioning each text element individually. Normally, I don't go through
that process.

Normally, I make a hierarchy of a few groups, each with various children
individually positioned. Then, I can adjust the overall position and
rotation of the whole set by applying position and rotation transforms to
the Group node, not to each text or other sub-element.

>From your description (maybe I misinterpreted what you were saying) it
didn't sound like you were doing it this way, and I worried that you were
making unnecessary work for yourself as a result.



On Mon, Jan 7, 2019 at 8:40 AM Nebi Sarikaya  wrote:

> Hi Chris;
>
> Can you be more specific on "I usually put all of the text and HUD
> elements into a group and position them relative to the group and then
> rotate and shift that group. All the sub-children will rotate properly. " ?
>
> Thank you!
>
> Cheers,
> Nebi
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75394#75394
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@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  facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Happy New Year to all OSG Users

2019-01-07 Thread Chris Hanson
Happy New Year, everyone!

Nothing urgent in this post, I just thought it would be interesting to ask
folks what sorts of things they are doing with OSG, how it is going for
them, and what you'd like to do in the next year.

How do you feel about Vulkan, and where do you see Vulkan and VSG affecting
your work?

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@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  facebook.com/alphapixel (775)
623-PIXL [7495]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Changing statesets at runtime

2019-01-07 Thread Mike Bralkowski
I'm trying to swap back and forth between two statesets on a geode, but don't 
think I'm approaching this correctly. When I create a geode I set the user data 
as a struct which contains two statesets, and then use a NodeVisitor to toggle 
the statesets via geode.setStateSet. When calling my node visitor, I see the 
setStateSet call happen but the geometry ends up white. I'm not sure if this is 
due to not calling some dirty() method, or do I need to use a different method 
for swapping statesets due to some race condition?

Thanks,
Mike

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75385#75385





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org