Re: [osg-users] Autoshadow aliasing in shadow maps

2011-08-30 Thread Robert Osfield
Hi Sergey,

On Mon, Aug 29, 2011 at 10:55 PM, Sergey Polischuk pol...@yandex.ru wrote:
 All shadowmapping techniques have problems with such aliasing problems. You 
 can try use shadow volumes technique as it dont suffer from this problem and 
 generates correct shadows in any case, but it have other drawbacks. IIRC this 
 algo also implemented in osgShadows.

Shadow volumes will have problems with vertical surfaces that cast
their own shadow as well as numerical precision issues will mean that
some areas will classified in and other areas classified as out of the
shadow.

The matching of the vertex and fragment shaders handling of ambient
light is solution in both cases.

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


Re: [osg-users] How to force reloading the texture in the shader

2011-08-30 Thread Robert Osfield
HI Fred,

What is probably happening is the update to the texture is happening
just fine, but the previous frames draw traversal is still running so
sees the update to the image and downloads and uses it right away.
Setting the threading to SingleThreaded will prevent the osgViewer
from running the update in parallel to the previous draw traversal so
avoid this issue of texture being applied a frame early.

However, a better solution is to set the DataVariance on the StateSet
that the Texture is associated with to DYNAMIC stateset so that the
draw traversal knows to hold back the next frame till all the elements
that are changing have been dispatched first.  The checked for
DataVariance is only done at Drawable and StateSet level so setting
this directly on the Texture won't help.

A a general note, make sure your a using an osg::ImageStream for
continuously updating data as this subclass from osg::Image adds the
use of PixelBufferObject automatically, this provides a much more
efficient means for downloading the data to OpenGL.

Robert.

On Mon, Aug 29, 2011 at 10:32 PM, Fred Maulir wallys...@live.com wrote:
 Hello to All,

 I'm having a very specific issue using OpenSceneGraph. While using a texture 
 shader I developped, I need to attach a texture to my object. But my texture 
 need to be changed at each frame. However, I noticed that my texture is not 
 updated in the next viewer.update() if my computer is very fast. If I slow 
 down my computer it is correctly synchronized.

 In other word, I'm looking for a way to way for a texture object to be 
 propagated in the gpu buffer before rendering the frame.

 As I'm using OpenSceneGraph for simulation purpose even 1 frame offset is not 
 acceptable for me.


 Basically the code can be summed up this way:

 Code:

 osg::Image IMAGE;
 IMAGE-setImage(..., imageData, osg::Image::AllocationMode::NO_DELETE);

 osg::StateSet *mystate = new osg::StateSet();
 osg::Texture2D *texture = new osg::Texture2D();
 texture-setImage(IMAGE);

 (...)

 for(int i=0;i!viewer-done();++i)
 {
 IMAGE-setImage(..., ImageData[i], osg::Image::AllocationMode::NO_DELETE);


 viewer-frame(ctime);
 }



 In this example when rendering the scene OSG sometimes uses the ImageData of 
 index i-1 instead of index i


 If anyone can help me I would be very happy.
 Regards.

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





 ___
 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] [build] cmake install target

2011-08-30 Thread Gianni Ambrosio
Dear All,

is it possible to specify a custom install target for cmake? I need that 
because even if I run nmake with a subset of osg libs as target, then calling 
nmake install will force the build of the missing libs (that I don't need). 
On the other hand I need to have all built libs in a lib dir, all dll in a 
bin dir like the nmake install command does.

Regards,
Gianni

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





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


Re: [osg-users] When ref_ptrs get deleted

2011-08-30 Thread David Benoit
Sorry.  I was not clear about exactly what my problem was.  It was not a memory 
leak.  I was running out of memory because the OSG garbage collector was not 
freeing memory right away.  It would eventually free memory if I waited long 
enough, but I needed a way to force it to free the memory immediately.

In my code, if I added some sleep() calls, I could see (on Ubuntu) memory usage 
rise and fall as expected.  If I removed those sleep() calls, but left 
everything else the same, memory usage would not fall and I would run out of 
memory.

My solution was to use DeleteHandler::flush() after removeChild() as well as 
making sure my object have been rendered to the screen.  (I suspect the 
refCount won't be zero until after an object has actually been drawn, but I 
didn't verify this.)

I would be interested to hear from anyone else who has had to worry about the 
details of the garbage collector.

Thanks!

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





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


Re: [osg-users] When ref_ptrs get deleted

2011-08-30 Thread Ulrich Hertlein
Hi David,

On 30/08/11 14:37 , David Benoit wrote:
 Sorry.  I was not clear about exactly what my problem was.  It was not a 
 memory leak.
 I was running out of memory because the OSG garbage collector was not freeing 
 memory
 right away.  It would eventually free memory if I waited long enough, but I 
 needed a
 way to force it to free the memory immediately.
 
 In my code, if I added some sleep() calls, I could see (on Ubuntu) memory 
 usage rise
 and fall as expected.  If I removed those sleep() calls, but left everything 
 else the
 same, memory usage would not fall and I would run out of memory.
 
 My solution was to use DeleteHandler::flush() after removeChild() as well as 
 making
 sure my object have been rendered to the screen.  (I suspect the refCount 
 won't be zero
 until after an object has actually been drawn, but I didn't verify this.)
 
 I would be interested to hear from anyone else who has had to worry about the 
 details
 of the garbage collector.

There is no 'OSG garbage collector' for objects in the scene graph.

OSG uses reference counting and objects are released when no one is using them 
anymore. If
you see a delay between the time that your code releases an object and the time 
that the
object gets deleted it is because someone else (e.g. the draw thread) is still 
using it.

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


[osg-users] [osgPlugins] Writing plugins, where to start

2011-08-30 Thread Paul Leopard
Hi,

My apologies if I have missed something but I have been searching for some good 
reference material on the requirements for writing OSG plugins. Would someone 
be so kind as to point me to some documentation that will detail the steps and 
requirements for creating a plugin from scratch?

Thank you!
Paul

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





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


Re: [osg-users] [osgPlugins] Writing plugins, where to start

2011-08-30 Thread Chris 'Xenon' Hanson
On 8/30/2011 8:30 AM, Paul Leopard wrote:
 Hi,
 My apologies if I have missed something but I have been searching for some 
 good reference material on the requirements for writing OSG plugins. Would 
 someone be so kind as to point me to some documentation that will detail the 
 steps and requirements for creating a plugin from scratch?

  Mostly I just take something like the OBJ plugin and strip out everything OBJ 
specific
and throw in my code.

  There's some magic objects and macros that perform plugin registration that 
you need to
preserve.

 Thank you!
 Paul


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
There is no Truth. There is only Perception. To Perceive is to Exist. - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPlugins] Writing plugins, where to start

2011-08-30 Thread Paul Martz

On 8/30/2011 8:30 AM, Paul Leopard wrote:

Hi,

My apologies if I have missed something but I have been searching for some good 
reference material on the requirements for writing OSG plugins. Would someone 
be so kind as to point me to some documentation that will detail the steps and 
requirements for creating a plugin from scratch?


I know the Quick Start Guide has some basic info on this.
http://stores.lulu.com/pmartz

And it appears Wang Rui's book contains plugin info in chapter 10.
https://www.packtpub.com/openscenegraph-3-0-beginners-guide/book

   -Paul



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


Re: [osg-users] [osgPlugins] Writing plugins, where to start

2011-08-30 Thread Paul Leopard
[quote=Paul Martz]On 8/30/2011 8:30 AM, Paul Leopard wrote:

 And it appears Wang Rui's book contains plugin info in chapter 10.
 https://www.packtpub.com/openscenegraph-3-0-beginners-guide/book

Perfect! That's what I was looking for

Thanks!
Paul

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





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


Re: [osg-users] When ref_ptrs get deleted

2011-08-30 Thread David Benoit
Ulrich,

You appear to be correct.  As it turns out, in the process of debugging the 
issue and discovering the flush() function, I also add some redraw calls.  In 
my new code, I can turn off the flush()'s and I'm fine, but I can't turn off 
the redraw.  

I did check the refCounts were 0 when I was debugging this.  Unfortunately I 
don't have the debug code around to see why I was getting 0's when I didn't 
expect them.  In any event, in light of this new behavior it does seem likely 
that my error was not giving the draw thread a chance to remove the old objects.

Thanks all!

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





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


Re: [osg-users] Drawing a simple sphere...

2011-08-30 Thread Yann Blaudin de Thé
Can someone tell me what are the options to pass to cmake to compile OSG on OSX 
Lion? (either to a .framework form, or to a *nix form, like a .dylib)
I definitely don't get it, and I'm not experienced enough to find it out by 
myself. As written in a previous mail, I used so far:

OSG_WINDOWING_SYSTEM=Coca
CMAKE_ARCHITECTURE='i386;x86_64'
OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX=imageio
CMAKE_BUILD_TYPE=Release 

which seems quite relevant to me.
The problem is that in this case, the program at the end of this mail crashes, 
with the error:
Bus error: 10

BTW, what you, Tony H., suggested doesn't work. Thank you anyway!

Yann


Le 29 août 2011 à 20:44, Tony Horrobin a écrit :

 Hi Yann,
 
 I have tried your code with osg trunk under Windows 7 32bit and can report 
 that it does not crash.
 
 All I can suggest is to replace use of native pointers with osg::ref_ptr.
 
 So for example:
 
 Code:
 osg::Geode * geode = new osg::Geode();
 
 
 becomes
 
 
 Code:
 osg::ref_ptr Geode  geode = new osg::Geode();
 
 
 
 Cheers,
 
 -Tony
 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=42293#42293
 
 
 
 
 
 ___
 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