Re: [osg-users] Dynamically change the persistence of the motion blur example

2013-05-17 Thread Robert Osfield
Hi Bill,

Is there any reason why you could retain a ref_ptr to the Operation and
modify it in your frame loop, or get the list of operations and use a
dynamic_castMotionBlurOperation*() to determine which one is the one you
need to modify?

Robert.


On 16 May 2013 23:15, William Hart bill.h...@utas.edu.au wrote:

 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_castosg::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
 ___
 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] [build] Building OpenThreads on Windows

2013-05-17 Thread Trajce Nikolov NICK
Hi,

OpenThreads is also part of the OpenSceneGraph trunk, you can download it
and it builds for many known platforms including Windows without problems

Nick


On Fri, May 17, 2013 at 7:49 AM, Nav Joseph nk...@tatapowersed.com wrote:

 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\OpenThreadsmake
 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




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




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


Re: [osg-users] [build] Building OpenThreads on Windows

2013-05-17 Thread Nav Joseph
Ok thanks, using the lib that was with the osg build worked, but initially I 
was getting some error that it couldn't find OpenThreads_somethingwin32.lib. 
Now that error is no longer there.
But still, I would like to know how to get it built on Windows without having 
to build the whole of OSG.


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

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





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


Re: [osg-users] [build] Building OpenThreads on Windows

2013-05-17 Thread Trajce Nikolov NICK
 But still, I would like to know how to get it built on Windows without
having to build the whole of OSG

It is CMake driven. Generate solution and projects and work only with the
OpenThreads project


On Fri, May 17, 2013 at 12:39 PM, Nav Joseph nk...@tatapowersed.com wrote:

 Ok thanks, using the lib that was with the osg build worked, but initially
 I was getting some error that it couldn't find
 OpenThreads_somethingwin32.lib. Now that error is no longer there.
 But still, I would like to know how to get it built on Windows without
 having to build the whole of OSG.

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

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





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




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


Re: [osg-users] Dynamically change the persistence of the motion blur example

2013-05-17 Thread William Hart
Hi Robert,

Sorry I'm not much of a C++ programmer, I do most of what I can in python and 
only wrap the bits I need to.  This sounds like what I want to do, is there 
somethings similar amongst the example s?

thanks

-Bill
On 17/05/2013, at 6:46 PM, Robert Osfield 
robert.osfi...@gmail.commailto:robert.osfi...@gmail.com wrote:

Hi Bill,

Is there any reason why you could retain a ref_ptr to the Operation and 
modify it in your frame loop, or get the list of operations and use a 
dynamic_castMotionBlurOperation*() to determine which one is the one you need 
to modify?

Robert.


On 16 May 2013 23:15, William Hart 
bill.h...@utas.edu.aumailto:bill.h...@utas.edu.au wrote:
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_castosg::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
___
osg-users mailing list
osg-users@lists.openscenegraph.orgmailto:osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.orgmailto: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] osgUtil::Optimizer::optimize not obeying Permissible Optimizations for MERGE_GEODES

2013-05-17 Thread Frank Sullivan
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





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


Re: [osg-users] 3D mice

2013-05-17 Thread Thomas Lerman
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





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