Farshid Lashkari | 21 May 2013 05:41
Picon

DatabasePager setTargetMaximumNumberOfPageLOD behavior

Hi,

I'm hoping to get some clarification on how the DatabasePager::setTargetMaximumNumberOfPageLOD is supposed to work. I am setting this value to 3 in my application. I then use the following function to create and add PagedLODs the the scene:

void AddPagedLOD()
{
  osg::ref_ptr<osg::PagedLOD> lod = new osg::PagedLOD;
  lod->addChild( new osg::Group, 10.0f, FLT_MAX );
  lod->setFileName(1,"large.osgb");
  lod->setRange(1,0.0f,10.0f);
  root->addChild(lod);
}

When I add 3 PagedLODs to my scene and have them load the file, they are never released from memory once I leave the active range. This makes sense since the number PagedLODs is not above the target.

However, when I add 4 PagedLODs then leave the active range, all 4 files are released from memory. I was expecting only 1 of the files to be released.

Am I misunderstanding the behavior of this setting or should only 1 file be released in this case?

I had a quick glance at the DatabasePager source and was able to make two small changes to get the behavior I was expecting. However, I don't have much experience dealing with PagedLODs and wanted to verify that this should be the correct behavior before submitting a patch.

Cheers,
Farshid

<div><div dir="ltr">Hi,<div><br></div>
<div>I'm hoping to get some clarification on how the DatabasePager::setTargetMaximumNumberOfPageLOD is supposed to work. I am setting this value to 3 in my application. I then use the following function to create and add PagedLODs the the scene:</div>
<div><br></div>
<div>void AddPagedLOD()</div>
<div>{</div>
<div>
<div>&nbsp; osg::ref_ptr&lt;osg::PagedLOD&gt; lod = new osg::PagedLOD;</div>
<div>&nbsp; lod-&gt;addChild( new osg::Group, 10.0f, FLT_MAX );</div>
<div>
&nbsp; lod-&gt;setFileName(1,"large.osgb");</div>
<div>&nbsp; lod-&gt;setRange(1,0.0f,10.0f);</div>
<div>&nbsp; root-&gt;addChild(lod);</div>
<div>}</div>
<div><br></div>
<div>When I add 3 PagedLODs to my scene and have them load the file, they are never released from memory once I leave the active range. This makes sense since the number PagedLODs is not above the target.</div>
<div><br></div>
<div>However, when I add 4 PagedLODs then leave the active range, all 4 files are released from memory. I was expecting only 1 of the files to be released.</div>
<div><br></div>
<div>Am I misunderstanding the behavior of this setting or should only 1 file be released in this case?</div>
<div><br></div>
<div>I had a quick glance at the DatabasePager source and was able to make two small changes to get the behavior I was expecting. However, I don't have much experience dealing with PagedLODs and wanted to verify that this should be the correct behavior before submitting a patch.</div>
<div><br></div>
<div>Cheers,</div>
<div>Farshid</div>
<div><br></div>
</div>
</div></div>
David Glenn | 21 May 2013 01:13
Favicon

Re: AlphaPixel Whitepaper on VirtualPlanetBuilder/OSGDEM


Chris Hanson wrote:
> As promised last week:
> 
> 
> http://alphapixel.com/content/openscengraph-virtual-planet-builder-osgdem (http://alphapixel.com/content/openscengraph-virtual-planet-builder-osgdem)
> 
> 
> 
> 
> 
> Feedback welcomed.
> 
> 
> -- 
> 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
> Digital Imaging • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography •
Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android
>  <at> alphapixel (https://twitter.com/alphapixel) facebook.com/alphapixel
(http://facebook.com/alphapixel) (775) 623-PIXL [7495]
> 
>  ------------------
> Post generated by Mail2Forum

Greetings Chris!

I just learned about it this week so I got a copy to review. 

As far as I can tell, there are not many papers (if any) on this subject and VPB is a remarkable tool. 

It's nice to understand the Terrain Theory that the bases to how this works. 

I must admit that most of the other paging schemes that I had to deal with in the past did not go as far as this and
did not do as well.  Mostly because they where hacks using preexisting terrain elements that where clearly
not made for paging. This makes much more sense to me.

------------------------
David Glenn
---------------
D Glenn 3D Computer Graphics Entertainment.
www.dglenn.com

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

_______________________________________________
osg-users mailing list
osg-users <at> lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Asher Kamiraze | 20 May 2013 23:00
Picon

[Viewer] Detecting mouse move

Hi all,

In some of my application, I would like to detect when a clic + mouse move event happen. My goal is to display on screen during the clic + mouse move only objects bounding boxes.

Do you have any hint on how to do this? Maybe some tips starting from osgviewer could help!

Best regards,

Asher
<div><div dir="ltr">
<div>
<div>
<div>
<div>Hi all,<br><br>
</div>In some of my application, I would like to detect when a clic + mouse move event happen. My goal is to display on screen during the clic + mouse move only objects bounding boxes.<br><br>
</div>Do you have any hint on how to do this? Maybe some tips starting from osgviewer could help!<br><br>
</div>Best regards,<br><br>
</div>Asher<br>
</div></div>
Patrick Keenan | 18 May 2013 17:46
Picon
Favicon

osgGA::TrackballManipulator Bottom View (Look Directly Up)

Hi,

This should be a simple answer, hopefully this hasn't been asked. I have some buttons for switching to the
views between top, right,... and bottom. my code is all in the following function:

Code:

void M_OSG_viewer::setViewpoint(Viewpoint new_viewpoint, double distance)
{
	switch (new_viewpoint)
	{
		case MINUS_X: 
			manipulator->home(0);
			manipulator->setCenter(osg::Vec3d(0.0, 0.0, 0.0));
			manipulator->setRotation(osg::Quat(-90.0f, osg::Vec3f(0.0f, 1.0f, 0.0f)));
			manipulator->setCenter(osg::Vec3d(0.0, 0.0, 1800.0));
			manipulator->setElevation(0.0f);
			manipulator->setDistance(distance);
			break;
		case PLUS_X:
			manipulator->home(0);
			manipulator->setCenter(osg::Vec3d(0.0, 0.0, 0.0));
			manipulator->setRotation(osg::Quat(90.0f, osg::Vec3f(0.0f, 1.0f, 0.0f)));
			manipulator->setCenter(osg::Vec3d(0.0, 0.0, 1800.0));
			manipulator->setElevation(0.0f);
			manipulator->setDistance(distance);
			break;
		case MINUS_Y: 
			manipulator->home(0);
			manipulator->setCenter(osg::Vec3d(0.0,0.0,0.0));
			manipulator->setRotation(osg::Quat(90.0f, osg::Vec3f(1.0f,0.0f,0.0f)));
			manipulator->setCenter(osg::Vec3d(0.0,0.0,1800.0));
			manipulator->setElevation(0.0f);
			manipulator->setDistance(distance);
			break;
		case PLUS_Y: 
			manipulator->home(0);
			manipulator->setCenter(osg::Vec3d(0.0,0.0,0.0));
			manipulator->setRotation(osg::Quat(-90.0f, osg::Vec3f(1.0f,0.0f,0.0f)));
			manipulator->setCenter(osg::Vec3d(0.0,0.0,1800.0));
			manipulator->setElevation(0.0f);
			manipulator->setDistance(distance);
			break;
		case MINUS_Z: 
			manipulator->home(0);
			manipulator->setCenter(osg::Vec3d(0.0, 0.0, 0.0));
			manipulator->setRotation(osg::Quat(179.0f, osg::Vec3f(1.0f, 0.0f, 0.0f))); // looking at the
bottom exactly is NAN i guess todo 
			manipulator->setCenter(osg::Vec3d(0.0, 0.0, 1000.0));
			manipulator->setDistance(distance);
			break;
		case PLUS_Z: 
			manipulator->home(0);
			manipulator->setCenter(osg::Vec3d(0.0f, 0.0f, 0.0f));
			manipulator->setRotation(osg::Quat(0.0f, osg::Vec3f(0.0f, 0.0f, 1.0f)));
			manipulator->setCenter(osg::Vec3d(0.0, 0.0, 1000.0));
			manipulator->setDistance(distance);
			break;
		case ISOMETRIC:
			// Isometric view
			manipulator->home(0);
			manipulator->setCenter(osg::Vec3d(0.0, 0.0, 1000.0));
			manipulator->setDistance(distance);
			manipulator->setElevation(775.0f);
			manipulator->setHeading(0.6f);
			break;
		default: 
			// do nothing
			break;
	}
}

but that bottom view is always wacky if I try to change that 179 deg to 180 deg. Is there some easy way to look
directly up from -Z? The home(0) trick took me a while to figure out, it is a good way to stop any rotation
that's going on which I have seen people have issues with in other posts. I think I have tried every
permutation of arguments for osg::Quat.

Thanks

Patrick

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

Thomas Lerman | 18 May 2013 04:12
Picon
Favicon

Re: 3D mice

I am finally getting back to this (you know, priorities). I have VRPN compiled on my computer. However, it
would appear that the 3DConnexion SpaceMouse Pro might not be supported?

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

Frank Sullivan | 18 May 2013 01:18
Picon

osgUtil::Optimizer::optimize not obeying Permissible Optimizations for MERGE_GEODES

Greetings!

This may be by design, but just in case, I wanted to ask about it. I'm using version 3.0.0, and if I look on Line
282 of osgUtil/Optimizer.cpp, the MergeGeodesVisitor is created. However, the optimizer object
(this) is not passed into the constructor, and so the visitor does not have a pointer to the optimizer
object. 

As a consequence, the visitor cannot access the optimizer's _permissibleOptimizationsMap and thus
returns true every time isOperationPermissibleForObject is called. 

The reason I bring this up is that I do want to merge geodes, but I have four geodes in the model that I cannot
allow to be merged. I was able to work around this problem by creating my own MergeGeodesVisitor, and that
seems to be working well. I just have to remember not to include MERGE_GEODES in my options bit field that I
pass into Optimizer::optimize(), and handle it manually myself as I described.

Thank you!

Cheers,
Frank

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

Nav Joseph | 17 May 2013 07:49
Gravatar

[build] Building OpenThreads on Windows

How does one build OpenThreads library standalone on Windows?

Downloaded OpenThreads (http://openthreads.sourceforge.net/) and it built fine with make on Linux,
but when I try using make with Gnu Make for Windows, it shows this error:
F:\ProgramFiles\OpenThreads>make
process_begin: CreateProcess(NULL, uname, ...) failed.
f was unexpected at this time.
make: *** [default] Error 255

and when I tried with MinGW, it gave errors I've attached as an image with this message (couldn't copy text in
the Mingw prompt). 

Help please...

------------------------
Nav or Joseph? You can call me Nav :-)

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

How does one build OpenThreads library standalone on Windows?

Downloaded OpenThreads (http://openthreads.sourceforge.net/) and it built fine with make on Linux,
but when I try using make with Gnu Make for Windows, it shows this error:
F:\ProgramFiles\OpenThreads>make
process_begin: CreateProcess(NULL, uname, ...) failed.
f was unexpected at this time.
make: *** [default] Error 255

and when I tried with MinGW, it gave errors I've attached as an image with this message (couldn't copy text in
the Mingw prompt). 

Help please...

------------------------
Nav or Joseph? You can call me Nav :-)

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

William Hart | 17 May 2013 00:15
Picon
Picon
Favicon

Dynamically change the "persistence" of the motion blur example

Hi,

I've been using the Accumulation buffer to apply motion blur to point cloud animations, directly taken
from the osgMotionBlur example, where the motion blur is applied to each window as an osg::Operation. 
What I'd like to be able to do is dynamically change the amount of blur by varying the persistence
parameter.  I've poked around the API and found that I can remove the motion blur operation with a
removeAllOperations call then reapply the motion blur with a different persistence value, but this
causes the accumulation buffer to be cleared.  I can't see any other way to access the Operator once its been applied.

Below is the code, 

#include <osgViewer/ViewerBase>
#include <osgViewer/Viewer>
#include <iostream>

class MotionBlurOperation: public osg::Operation
{
public:
    MotionBlurOperation(double persistence):
        osg::Operation("MotionBlur",true),
        cleared_(false),
        persistence_(persistence)
    {
    }

    virtual void operator () (osg::Object* object)
    {
        osg::GraphicsContext* gc = dynamic_cast<osg::GraphicsContext*>(object);
        if (!gc) return;

        double t = gc->getState()->getFrameStamp()->getSimulationTime();

        if (!cleared_)
        {
            // clear the accumulation buffer
            glClearColor(0, 0, 0, 0);
            glClear(GL_ACCUM_BUFFER_BIT);
            cleared_ = true;
            t0_ = t;
        }

        double dt = fabs(t - t0_);
        t0_ = t;

        // compute the blur factor
        double s = powf(0.2, dt / persistence_);

        // scale, accumulate and return
        glAccum(GL_MULT, s);
        glAccum(GL_ACCUM, 1 - s);
        glAccum(GL_RETURN, 1.0f);
    }

private:
    bool cleared_;
    double t0_;
    double persistence_;
};

void motionblur(osgViewer::GraphicsWindow* w, double persistence) {
  w->add(new MotionBlurOperation(persistence));
}

any ideas ?

thanks in advance

Bill
Gabriel Francu | 16 May 2013 11:09
Picon
Favicon

Crashes after unloading library

Hi,

I have an application built with Qt that uses osg to create a scene and to display it. I have also created a
shared library that is loaded and unloaded by my application using QLibrary. In this library I create osg
objects that are retained in objects created in the application. If I do not unload the library, all is ok
but after I unload the library, strange crashes occurs in osg.

I suspect that these are related to memory allocation because osg objects are created on the heap in the
shared library and then the shared library in unloaded. Any suggestions?
... 

Thank you!

Cheers,
Gabriel

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

Laurens Voerman | 16 May 2013 10:20
Picon
Favicon

problem with include/osgViewer/config for windows users (svn commit 13403)

Hi Robert,

with svn commit a problem for windows users emerged, the file
include/osgViewer/Config
prohibits the creation of the directory
include/osgViewer/config/
on non case sensitive filesystems.

(Turtoise)svn update fails with a permissions error.

I would suggest renaming the directory (to winconfig or screenconfig 
perhaps?).

Regards,
Laurens Voerman.

Joe Doob | 15 May 2013 23:08
Picon

crashing with paged LODs, line intersector on computeBound

Hi,

I wonder if anyone can offer some insight on why I may be experiencing these random crashes. 

Essentially I have many line intersection visitors following a node which is moving through the scene and
performing line intersections on terrain, which is a pagedLOD database of proxynodes.

This is done in a multithreaded fashion, i.e. there are many threads each with a lineSegmentIntersector
and intersectionVisitor of its own. By and large, it works great, but on very rare and seemingly random
occasions the application crashes with a segmentation fault.

It traces to the accept call, where I am calling the terrain's group node's accept function on an
intersection visitor.

A human-friendly version of the backtrace is as follows:

Code:

osg::Group::computeBound at Group.cpp
 osg::LOD::computeBound at LOD.cpp
getBound at Node.cpp
isCullingActive at Node.cpp
enter at LineSegmentIntersector.cpp
enter at IntersectionVisitor.cpp
accept at Group.cpp
traverse at Group.cpp
apply at IntersectionVisitor.cpp
accept at Group.cpp

The code that performs the actual intersection looks like this:

Code:

lineSegmentIntersector->setStart(start);
lineSegmentIntersector->setEnd(end);
intersectionVisitor->reset();
root->accept(*intersectionVisitor);

It's possible I am doing something evil with this multithreading setup that I am unaware of (please tell
me!), but since everything works 99.9% of the time, I suspect there is something more subtle going on. 

I am running OSG 3.0.1 in C++.

Thanks,
Stathibus

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


Gmane