Re: [osg-users] heightfield change height crashes

2009-11-25 Thread Thomas Maier
Hi,

i inserted the dirtyDisplayList() into an update callback which i set with 
setUpdateCallback() and it works, but only if i click into the viewer window 
and move the heightField ?

thanks for the help, i will try also the other variants, to see if they work 
better. 

Thank you!

Cheers,
Thomas

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





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


Re: [osg-users] heightfield change height crashes

2009-11-24 Thread Jean-Sébastien Guay

Hello Thomas,


i only have set -setDataVariance(osg::Object::DYNAMIC); to the geode, now i 
also have set it to the shapeDrawable. Should i apply it only to the shapeDrawable 
or to both?


Data variance only has an effect on subclasses of osg::Drawable and on 
osg::StateSet (at run time - it has an effect on other nodes for the 
osg::Optimizer if you use that, but at run time it only effects 
drawables and statesets).



After this change it draws the first point of my setHeight() changes, any 
following setHeight() call doesnt paint anything?  If i use 
-dirtyDisplayList(); on the shapeDrawable directly after calling setHeight() 
crashes the application.


But you didn't answer the other question, do you call it in the update 
phase? If you don't pay attention to when you call it, you might be 
calling it during the cull phase while OSG is trying to draw your height 
field, so one thread will be trying to draw it while another will be 
trying to update it and it will crash.


For the changes in height to be visible, either you need to disable 
display lists completely (setUseDisplayList(false)) or you need to dirty 
the display list (dirtyDisplayList()). There's no getting around that, 
if you don't do one of those two things then the old display list will 
still be used and you won't see any changes you make using 
setHeight()... Makes sense doesn't it?


For a relatively small height field, the general recommendation is that 
if you're going to be changing the heights often (say more often than 
once per second), you should disable display lists completely, or else 
you'll be spending too much time updating them. But if you're going to 
be changing the heights less often, then you should keep display lists 
enabled and call dirtyDisplayList() (from the update phase! say in an 
update callback on your geode).


But for large height fields, you should probably disable display lists 
in any case, and perhaps even enable VBOs, if you're using a pretty 
recent video card, it will be more efficient that way.


Anyways, try the different alternatives out and see for yourself.

Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] heightfield change height crashes

2009-11-23 Thread Thomas Maier
Hi,

i only have set -setDataVariance(osg::Object::DYNAMIC); to the geode, now i 
also have set it to the shapeDrawable. Should i apply it only to the 
shapeDrawable or to both?

After this change it draws the first point of my setHeight() changes, any 
following setHeight() call doesnt paint anything?  If i use 
-dirtyDisplayList(); on the shapeDrawable directly after calling setHeight() 
crashes the application.

what should i do, that it paints also the following setHeight() calls?

Thank you!

Cheers,
Thomas

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





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


Re: [osg-users] heightfield change height crashes

2009-11-23 Thread Thomas Maier
Hi,

i use SingleThreaded, i got no multithreading enum property only these

   SingleThreaded,
   CullDrawThreadPerContext,
ThreadPerContext = CullDrawThreadPerContext,
DrawThreadPerContext,
CullThreadPerCameraDrawThreadPerContext,
ThreadPerCamera = CullThreadPerCameraDrawThreadPerContext,
AutomaticSelection

i got osg 2.4.0, not the newest, but for this test-app it should work. What 
enum property should i use, AutomaticSelection ?

i dont get it to paint the following setHeight() calls, even if i use 
automaticSelection?

Thank you!

Cheers,
Thomas

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





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