Re: [osg-users] Old really nasty OpenThreads bug?

2010-12-03 Thread Ulrich Hertlein
Hi Anders,

On 3/12/10 22:05 , Anders Backman wrote:
> This is a WINDOWS problem only.
> 
> ...
> To reply Juan, the problem of using static variables for destruction is that
> it causes exactly this problem :-)
> 
> If  the static variable is defined in the MAIN-APP, it works just fine. In
> the same way that atexit() works when it is called from the main-app.
> 
> It is when the static variable (in your case static Deallocator deallocator)
> is defined in the .dll file for our library the problem occurs.

I've always had problems with Windows applications that do this sort of thing, 
namely
allocating memory in one unit (dll/exe, for lack of a better word) and deleting 
it in another.

The way it was explained to me is that dll and exe have separate heap 
management, and so
allocating an object from one heap and returning it to another doesn't work.  I 
worked
around this by making sure that memory is always allocated/freed within the 
same unit.
Worst case this meant to move common functionality into a header file and 
duplicated the
code in both the exe and the dll.

But I seem to remember that by some compiler switches you can actually avoid 
this mess!
(Hear, Hear!)  I was somewhat surprised that MS haven't added debug code to 
check for this
by tracking where a piece of memory was allocated.

Is it possible this is the case in your application?

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


[osg-users] [build] Using RPATH?

2010-12-03 Thread Roland Arsenault
Hi,

Is there a reason RPATH isn't used for gcc builds to avoid having to mess with 
library search paths when installing in an arbitrary directory?

The following patch allows the optional use of RPATH. While testing, plugins 
were not found when running from the build directory with RPATH enable, but the 
problem did not occur when installing to a directory in my home area. For this 
reason I decided to make this optional and have in disabled by default. 

Roland

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




Attachments: 
http://forum.openscenegraph.org//files/use_rpath_patch_124.txt


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


[osg-users] problem with manipulators

2010-12-03 Thread Martin Naylor
Hi all,
Are the default manipulators playing up? (it's probably me :)
But when I run osgviewer somegeocentricearth.ive I get strange behaviour
with the manipulators.
All is well until I hit the space bar, then changing the manipulators by
pressing 1 2, the earth will flip 180 degrees.
Then rotating also it flips around, orbit mode this seems to happen more.

Is it the data? I have just created a test model using SRTM data and blue
marble imagery, can anyone else see this?
I am running Windows.. running osgviewer cow.osg I cannot seem to produce
the same results.

Regards

Martin.


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


Re: [osg-users] how do I modify textures of an .IVE

2010-12-03 Thread John Farmer
[quote="Jason Daly"]On 12/03/2010 10:35 AM, John Farmer wrote:
[quote]Okay, the aircraft has a "skin" or texture that I would like to change.  
I would like to change the color and how it looks on the model but I don't know 
how.  The .IVE has everything in it.  So How would I edit/modify the texture 
and still keep the .IVE intact?  As you can tell I don't know much about the 
lingo used for this OSG stuff, but I'm learning.
[/quote]
We get that part, but you still haven't completely answered the 
question.  Do you want to change the texture while the OSG application 
is running, or do you want to change it before running the application?  
Your answer to this will determine how you'll want to make the change.

If I had to guess, I'd assume it's the latter.  In this case you can do 
this:

osgconv -O OutputTextureFiles aircraft.ive aircraft.osg

This will convert the model to a .osg file and write out the embedded 
textures as image files.  You can then alter the images as necessary.  
You can use osgviewer to see how your changes affect the model.  When 
you're done, you can run:

osgconv aircraft.osg aircraft_modified.ive

to convert it back to a .ive file.


There are other options as well, if you need more control than just 
editing the images.  For example, if you have a copy of MultiGen Creator 
available, you can convert the model to a .flt file instead, and then 
use Creator to edit it as necessary.

Jason,

I didn't know about the before/after options.  But I will try the suggestions 
you provided and see how that goes.  Thanks for taking the time to respond.

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





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


Re: [osg-users] How do I get the most accurate heightfield reading out of an OsgTerrain paged database

2010-12-03 Thread Roger James
Hi Robert, Chris, David

Thanks for the quick reply. I have been playing with putting osgTerrain support 
into VTP. Ben has probably written me off as a heretic!

I just wanted to get my placement of procedurally generated buildings a bit 
more accurate. So performance at that point is not too much of a problem.

I will look into osgSim.

Cheers,
Roger

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





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


Re: [osg-users] How do I get the most accurate heightfield reading out of an OsgTerrain paged database

2010-12-03 Thread David Glenn
Greetings!

A Word of Caution: that no matter how accurate the HAT is that the reading may 
be only as accurate as the Terrain used. In my experience making and using 
terrain, I have found that even some of these high priced terrain builders have 
their flaws compounded by the fact that most data in the public realm has only 
a certain level of accuracy. So you’re only going to get a certain level of 
confidence in relation to the real world figures or even some other forms of 
map data I have used. 

Terrain can be such a fickle beast!

... 

D Glenn


D Glenn (a.k.a David Glenn) - Join the Navy and See the World ... from your 
Desk!

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





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


Re: [osg-users] Please test svn/trunk in prep for 2.9.10 dev release

2010-12-03 Thread Robert Osfield
Hi All,

I have now make the 2.9.10 tag, I have to head out now so can't
complete the updates the website and blog to mention the new dev
release, I'll do this in the morning.

To check it out :

svn co 
http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-2.9.10
OpenSceneGraph

Thanks to all that have contributed to dev, debugging and testing.

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


Re: [osg-users] osgdem/vpb OS Open Data and geocentric

2010-12-03 Thread Martin Naylor
Hi Shayne,
Thanks for the reply.
I have tried all sorts to try and make this geocentric, but alas it seems to
fail.
My data is in .asc format for the terrain and is called the panorama from
OS(https://www.ordnancesurvey.co.uk/opendatadownload/products.html)
Also the .ntf files my gdal fails with unrecognised format(FW Tools under
windows).

OSGDEM fails with the following message after using gdalwarp as suggested:
Skipping source contertedtiffasc_warped\/tr26.asc-warp.tif as its extents
don't
overlap destination extents

The formats are :
Data type: Vector (Contours), Grid (DTM)
Supply format: DXF [Contours],ASCII grid [DTM],NTF [DTM]

I just used the ACII files, I am guessing the NTF files would be better but
my FW Tools won't recognise them, any ideas?

Regards

Martin.





-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Tueller,
Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Sent: 10 November 2010 22:47
To: OpenSceneGraph Users
Subject: Re: [osg-users] osgdem/vpb OS Open Data and geocentric

Try the following gdal command on your data (infile) that is not
geo-referenced...

gdalwarp -t_srs "+proj=latlong +datum=WGS84" -r bilinear  

and feed the resulting outfile into osgdem...

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Martin
Naylor
Sent: Wednesday, November 10, 2010 11:58 AM
To: 'OpenSceneGraph Users'
Subject: [osg-users] osgdem/vpb OS Open Data and geocentric

Hi all,
I have downloaded the free Ordinance Survey data and have managed to convert
the height data and raster data using gdal_translate.
Everything works brilliant when the option --geocentric is omitted.
Once --geocentric is included osgdem finished within about 20 seconds my
planet now looks like a sphere with bobbles attached, almost like a leather
football.
I am sure it's something to with the data and the format it is in, here is
gdalinfo of my converted data (excluding colour data).
Does anyone know how I should convert it over so I can get a whole earth, I
am guessing it's something to do with the format although osgdem reprojects
the data when --geocentric is included?
Using the latest SVN as of last Friday. The OS data is the best FREE data I
have come across so far, although I am sure there must be higher resolution
height data.


d:\OS OPENDATA\build\ras250_gb_converted>gdalinfo HP.tif-geo.tif
Driver: GTiff/GeoTIFF
Files: HP.tif-geo.tif
Size is 4000, 4000
Coordinate System is `'
Origin = (40.000,130.000)
Pixel Size = (25.000,-25.000)
Metadata:
  TIFFTAG_IMAGEDESCRIPTION=1:250 000 TILE HP.TIF
  TIFFTAG_DATETIME=2010:05:04 10:31:47
  TIFFTAG_COPYRIGHT=ORDNANCE SURVEY CROWN COPYRIGHT 2010
  TIFFTAG_XRESOLUTION=254
  TIFFTAG_YRESOLUTION=254
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch) Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  40.000, 130.000)
Lower Left  (  40.000, 120.000)
Upper Right (  50.000, 130.000)
Lower Right (  50.000, 120.000)
Center  (  45.000, 125.000)
Band 1 Block=256x256 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 256 entries)

___
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] Please test svn/trunk in prep for 2.9.10 dev release

2010-12-03 Thread Mikhail I. Izmestev
Hi,
03.12.2010 20:20, Robert Osfield wrote:
> Hi Mikhail,
>
> Thanks for the close observation.  I made a mistake when amending the
> code and left in the  && !textureObjectValid(state) that should have
> removed.   This code was there as part of interim development that I
> decided not to follow up.
>
> Could you do an svn update and check again.
>
> Cheers,
> Robert.
Looks fine for me now.
This feature looks very useful.

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


Re: [osg-users] How do I get the most accurate heightfield reading out of an OsgTerrain paged database

2010-12-03 Thread Robert Osfield
HI Roger & Chris,

On Fri, Dec 3, 2010 at 5:44 PM, Chris 'Xenon' Hanson
 wrote:
> On 12/3/2010 10:30 AM, Roger James wrote:
>> Hi,
>> I need to get the best heightfield reading I can out of an osgTerrain 
>> database at runtime. At the moment I am doing something like this:
>
>  Doesn't osgSim give you height above terrain functionality?

osgSim::HeightAboveTerrain ;-)

>  I don't think it automatically loads the highest LOD. I think this has been 
> a bit of a
> problem in the past, because loading of these tiles and subtiles can be an 
> expensive
> operation. Are you prepared to wait while all the tiles are loaded?

The osgSim intersector classes like HeightAboveTerrain all have
optional support for synchronous loading in paged databases.  See
osgintersection.   Synchronous loading will mean that the intersection
test will take much longer when external tiles have to be paged in.

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


Re: [osg-users] How do I get the most accurate heightfield reading out of an OsgTerrain paged database

2010-12-03 Thread Chris 'Xenon' Hanson
On 12/3/2010 10:30 AM, Roger James wrote:
> Hi,
> I need to get the best heightfield reading I can out of an osgTerrain 
> database at runtime. At the moment I am doing something like this:

  Doesn't osgSim give you height above terrain functionality?

  I don't think it automatically loads the highest LOD. I think this has been a 
bit of a
problem in the past, because loading of these tiles and subtiles can be an 
expensive
operation. Are you prepared to wait while all the tiles are loaded?

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


[osg-users] How do I get the most accurate heightfield reading out of an OsgTerrain paged database

2010-12-03 Thread Roger James
Hi,

I need to get the best heightfield reading I can out of an osgTerrain database 
at runtime. At the moment I am doing something like this:


Code:
osg::Node *pNode = osgDB::readNodeFile((const char *)fname_local);
// Top level node should be a coordinate system node
osg::CoordinateSystemNode *pCoordSystem = 
dynamic_cast(pNode);
// next node down should be a PageLOD
osg::PagedLOD *pLod = dynamic_cast(pCoordSystem->getChild(0));
osgTerrain::TerrainTile *pTopTile = 
dynamic_cast(pLod->getChild(0));
m_pLayer = pTopTile->getElevationLayer();

... Then

m_pLayer->getLocator()->convertModelToLocal(Model, Local);
// Get the Altitude
m_pLayer->getInterpolatedValue(Local.x(), Local.y(), fAltitude);



What I would really like to do is to drill down to the best LOD, ensure that 
that heightfield tile is loaded and query it directly

Has anyone got any tips or example code on how to do this.

Thank you!

Cheers,
Roger[/code]

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





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


Re: [osg-users] Please test svn/trunk in prep for 2.9.10 dev release

2010-12-03 Thread Robert Osfield
Hi Mikhail,

Thanks for the close observation.  I made a mistake when amending the
code and left in the  && !textureObjectValid(state) that should have
removed.   This code was there as part of interim development that I
decided not to follow up.

Could you do an svn update and check again.

Cheers,
Robert.

On Fri, Dec 3, 2010 at 2:45 PM, Mikhail I. Izmestev
 wrote:
> 03.12.2010 17:22, Robert Osfield wrote:
>>
>> Hi Thomas,
>>
>>> I'm not sure of what form this method needs to take yet.. will do some
>>> further thinking on the topic.
>>
>> I have settled upon a new SubloadCallback method:
>>
>>         class OSG_EXPORT SubloadCallback : public Referenced
>>         {
>>             public:
>>
>>                 virtual bool textureObjectValid(const Texture2D&
>> texture, State&  state) const
>>                 {
>>                     return texture.textureObjectValid(state);
>>                 }
>>
>>                ...
>>
>>         };
>>
>> And a new Texture2D helper method,
>> Texture2D::textureObjectValid(State&) that can be used by the
>> SubloadCallback as above with the default implementation, or by
>> osg::Texture2D::apply() itself to tell whether any modifications to
>> the Texture2D's Image will mean that the TextureObject needs
>> discarding and a new one to be created.
>
> Your latest changes caused very often call of computeInternalFormat,
> computeRequiredTextureDimensions and textureObject->match methods.
> In previous code this methods called only when getModifiedCount(contextID)
> != _image->getModifiedCount().
>
> Maybe would be better something like that:
> Index: src/osg/Texture2D.cpp
> ===
> --- src/osg/Texture2D.cpp       (revision 11982)
> +++ src/osg/Texture2D.cpp       (working copy)
> @@ -160,7 +160,7 @@
>
>     // get the texture object for the current contextID.
>     TextureObject* textureObject = getTextureObject(contextID);
> -    if (textureObject && !textureObjectValid(state))
> +    if (textureObject)
>     {
>         bool textureObjectInvalidated = false;
>         if (_subloadCallback.valid())
>
>
> Mikhail.
> ___
> 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] how do I modify textures of an .IVE

2010-12-03 Thread Jason Daly

On 12/03/2010 10:35 AM, John Farmer wrote:

Okay, the aircraft has a "skin" or texture that I would like to change.  I 
would like to change the color and how it looks on the model but I don't know how.  The 
.IVE has everything in it.  So How would I edit/modify the texture and still keep the 
.IVE intact?  As you can tell I don't know much about the lingo used for this OSG stuff, 
but I'm learning.


We get that part, but you still haven't completely answered the 
question.  Do you want to change the texture while the OSG application 
is running, or do you want to change it before running the application?  
Your answer to this will determine how you'll want to make the change.


If I had to guess, I'd assume it's the latter.  In this case you can do 
this:


osgconv -O OutputTextureFiles aircraft.ive aircraft.osg

This will convert the model to a .osg file and write out the embedded 
textures as image files.  You can then alter the images as necessary.  
You can use osgviewer to see how your changes affect the model.  When 
you're done, you can run:


osgconv aircraft.osg aircraft_modified.ive

to convert it back to a .ive file.


There are other options as well, if you need more control than just 
editing the images.  For example, if you have a copy of MultiGen Creator 
available, you can convert the model to a .flt file instead, and then 
use Creator to edit it as necessary.


--"J"

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


Re: [osg-users] reuse of clipping planes?

2010-12-03 Thread Yuri Vanzine
Hi,

My Apologies. The sentence in the middle should read:


"What goes into the apply method? Simply pushing the modelview 
matrix and calling the osg::ClipPlane::apply method and then popping it does 
not work. The ModelViewMatrix appears to be correctly set."

Cheers,
Yuri

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





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


Re: [osg-users] Graphic Context + Texture Memory

2010-12-03 Thread Juan Hernando

Hi Guy,

Because of the complexity of the scene I wanted to gain a little
performance by using multiple draw threads, but I guess I will have
to choose between performance gain (i.e multi-threaded) and memory
consumption (i.e single-threaded).
Having a thread for each cull traversal increases the performance. 
However, if you have a single graphics card, having a thread per camera 
(each one with a graphics context) doesn't necessarily improve the 
performance, what is more, it can degrade it. The reason is that each 
thread will be competing for the graphics card, which is an exclusive 
resource, and the driver is forced to perform many context switchs.


Regards,
Juan

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


Re: [osg-users] how do I modify textures of an .IVE

2010-12-03 Thread John Farmer
You'll need to be a bit more specific.  In what way do you want to
modify the textures (images associated with them)?  Replace the images
with different images on disk?  Modify the imagery at runtime such as
"painting on them"? Modify the images offline?

Robert.


Okay, the aircraft has a "skin" or texture that I would like to change.  I 
would like to change the color and how it looks on the model but I don't know 
how.  The .IVE has everything in it.  So How would I edit/modify the texture 
and still keep the .IVE intact?  As you can tell I don't know much about the 
lingo used for this OSG stuff, but I'm learning.

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





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


Re: [osg-users] reuse of clipping planes?

2010-12-03 Thread Yuri Vanzine
Hi,

Robert,

You outlined how to use a custom osg::ClipPlane to enable multiple ClipNodes 
per scene:

“You can create you own equivilant by subclassing from osg::ClipPlane and 
overriding the apply() then setting the modelview matrix you want and applying 
the clipplanes and then restoring it afterwards before the end of the apply()”

What goes into the apply method? Simply pushing the modelview
matrix and calling the osg::ClipNode::apply method and then popping it does not 
work. The ModelViewMatrix appears to be correctly set.

You also mention in other responses to other engineers about using  RenderStage 
per ClipNode.


Since it has been a few years since some of these conversations, what would be 
your recommendation to best extend osg to allow multiple ClipNodes be active in 
one scene?

Thank you,

Yuri

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





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


Re: [osg-users] Blur effect on a dynamic scene

2010-12-03 Thread Kim Bale
Hi Sajjadul,

Blur effects are usually created as a post process effect whereby the scene
is first rendered to a texture and then shaders are used blur the image. The
result is then rendered to the screen as a full screen quad with the blurred
texture map applied.

You could do this on a key press by using either a switch or nodemask to
swap between the normally rendered scene and the textured fullscreen quad.

You may also want to look at osgPPU as it's designed for these sort of post
processing effects.

K.


On 3 December 2010 14:48, Sajjadul Islam  wrote:

> Hello forum,
>
> I want to blur a dynamic scene with key press event. In that case i have to
> create a call back.
>
> Do i have to create subclass of the osg::Camera::DrawCallback ?
>
> And Do i have to set that subclassed call back class to the camera's final
> draw call back or post draw callback?
>
> These concepts are still blurry. It would be really nice to provide some
> references on these concepts.
>
> Thank you!
>
> Cheers,
> Sajjadul
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=34495#34495
>
>
>
>
>
> ___
> 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] Blur effect on a dynamic scene

2010-12-03 Thread Sajjadul Islam
Hello forum,

I want to blur a dynamic scene with key press event. In that case i have to 
create a call back. 

Do i have to create subclass of the osg::Camera::DrawCallback ?

And Do i have to set that subclassed call back class to the camera's final draw 
call back or post draw callback?

These concepts are still blurry. It would be really nice to provide some 
references on these concepts. 

Thank you!

Cheers,
Sajjadul

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





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


Re: [osg-users] Please test svn/trunk in prep for 2.9.10 dev release

2010-12-03 Thread Mikhail I. Izmestev

03.12.2010 17:22, Robert Osfield wrote:

Hi Thomas,


I'm not sure of what form this method needs to take yet.. will do some
further thinking on the topic.

I have settled upon a new SubloadCallback method:

 class OSG_EXPORT SubloadCallback : public Referenced
 {
 public:

 virtual bool textureObjectValid(const Texture2D&
texture, State&  state) const
 {
 return texture.textureObjectValid(state);
 }

...

 };

And a new Texture2D helper method,
Texture2D::textureObjectValid(State&) that can be used by the
SubloadCallback as above with the default implementation, or by
osg::Texture2D::apply() itself to tell whether any modifications to
the Texture2D's Image will mean that the TextureObject needs
discarding and a new one to be created.
Your latest changes caused very often call of computeInternalFormat, 
computeRequiredTextureDimensions and textureObject->match methods.
In previous code this methods called only when 
getModifiedCount(contextID) != _image->getModifiedCount().


Maybe would be better something like that:
Index: src/osg/Texture2D.cpp
===
--- src/osg/Texture2D.cpp   (revision 11982)
+++ src/osg/Texture2D.cpp   (working copy)
@@ -160,7 +160,7 @@

 // get the texture object for the current contextID.
 TextureObject* textureObject = getTextureObject(contextID);
-if (textureObject && !textureObjectValid(state))
+if (textureObject)
 {
 bool textureObjectInvalidated = false;
 if (_subloadCallback.valid())


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


[osg-users] why the model always flicker ?

2010-12-03 Thread Duan Linghao
Hi,

I wrote a program use MFC based on dialog,and I use a slider to rotate the 
model.I wonder why the model always flicker when I draging the slider? My code 
is 
setViewMatrix();
frame();

Thank you!

Cheers,
Duan

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





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


Re: [osg-users] Question about setting speed/acceleration with AnimationPath

2010-12-03 Thread Nguyen Tien Dat
Dear Robert,
Thank you very much for your answer. I'll manually move the object
along the line by using the time between frames to compute speed and
location then.
Best,
Dat

On Fri, Dec 3, 2010 at 3:13 AM, Robert Osfield  wrote:
> Hi Dat,
>
> The AnimationPath assumes a constant speed between each control point
> and animates accordingly.
>
> I guess it shouldn't be be possible to come up with the maths so that
> one assumes a constant acceleration between control points and then
> integrates to get the actual position at a given time.  One would also
> need to store the speed at the control point as the position, rotation
> and scale.
>
> I'm not really familiar with osgAnimation yet, perhaps it provides
> support for what you are after.
>
> Robert.
>
> On Fri, Dec 3, 2010 at 12:44 AM, Nguyen Tien Dat  wrote:
>> Dear all,
>> I need to move an object along a line with the speed of 1m/s. The
>> object starts from stationary (0m/s). I use AnimationPath like this:
>>
>>                osg::AnimationPath* animationPath = new osg::AnimationPath;
>>        animationPath->setLoopMode(osg::AnimationPath::NO_LOOPING);
>>
>>                osg::Vec3 startPoint(startMat(3,0), startMat(3,1),
>> startMat(3,2));
>>        animationPath->insert(0.0,osg::AnimationPath::ControlPoint(startPoint
>> , rotation));
>>
>>        osg::Vec3 endPoint(endMat(3,0), endMat(3,1), endMat(3,2));
>>
>>                float speed = 1.0; // (m/s)
>>                float timeOfAnimation = 
>> distanceFromStartPointToEndPoint/speed;
>>
>>        
>> animationPath->insert(timeOfAnimation,osg::AnimationPath::ControlPoint(endPoint
>> , rotation));
>>
>>        matTransNode.setUpdateCallback(new 
>> osg::AnimationPathCallback(animationPath));
>>
>> The animation works, but it seems to me that the speed instantly
>> becomes 1m/s and there's no acceleration. So my question is: is there
>> a way I can specify that, say, in the first second the acceleration is
>> +1 m/s^2, and the next few seconds the acceleration is 0 m/s^2 (so
>> that the speed is constant), and then in the last second the
>> acceleration is -1 m/s^2?
>>
>> Thank you very much for your help.
>> Best,
>> Dat
>> ___
>> 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
>



-- 
Dat Tien Nguyen
PhD Candidate, Computer Science Department
The University of Iowa
http://cs.uiowa.edu/~tinguyen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Graphic Context + Texture Memory

2010-12-03 Thread Guy Volckaert
Thanks for all your replies. That confirms what I imagined.

I forgot to mention that in addition of requiring multiple cameras, we also 
need multiple windows. Each window presents a different view of the scene.

Because of the complexity of the scene I wanted to gain a little performance by 
using multiple draw threads, but I guess I will have to choose between 
performance gain (i.e multi-threaded) and memory consumption (i.e 
single-threaded).

I will perform a few tests to see which is best suited for my situation.

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





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


Re: [osg-users] Please test svn/trunk in prep for 2.9.10 dev release

2010-12-03 Thread Robert Osfield
Hi Thomas,

> I'm not sure of what form this method needs to take yet.. will do some
> further thinking on the topic.

I have settled upon a new SubloadCallback method:

class OSG_EXPORT SubloadCallback : public Referenced
{
public:

virtual bool textureObjectValid(const Texture2D&
texture, State& state) const
{
return texture.textureObjectValid(state);
}

   ...

};

And a new Texture2D helper method,
Texture2D::textureObjectValid(State&) that can be used by the
SubloadCallback as above with the default implementation, or by
osg::Texture2D::apply() itself to tell whether any modifications to
the Texture2D's Image will mean that the TextureObject needs
discarding and a new one to be created.

This change is now checked into svn/trunk.  Since the default
behaviour of the callback and Texture2D is the same as before this
won't fix your example, to fix the example one simple adds:

virtual bool textureObjectValid(const osg::Texture2D& ,
osg::State&) const
{
return true;
}

To the NPOTResizeCallback.  Changes example attached.

I haven't rolled this change out to other Texture classes yet as I
want the new methods to be tested properly first.

Thomas could you test out svn/trunk and let me know how you get on.

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


Re: [osg-users] Old really nasty OpenThreads bug?

2010-12-03 Thread Anders Backman
Well, I have done some thorough googling on the matter, and it is a general
problem in dll-vs-atexit-static variables problem.

So it is most probably not a bug in OpenThreads. Lets close that issue.
Each dll has its own "order of destruction" for static variables, combine
that with that each dll-has its own order of execution of atexit() it
becomes a problem.

Smack the condition-locks that windows use internally for loading dll, which
by the way are handled as static variables, you have a mess.

Lights down, thanks for the attention :-)

/A

On Fri, Dec 3, 2010 at 12:59 PM, Robert Osfield wrote:

> Hi Anders,
>
> I'm pretty sure is not a threading issue / bug in OpenThreads, I
> believe it's an issue of proper management of the destruction order of
> objects/implementations.  When you use singletons you have to be
> particularly careful if you are relying upon automatic clean up
> provided by the static object destruction.
>
> One way you could handle the issue of implementations provided by
> dll's being unloaded prior to your singleton destructing is for the
> dll to have a static varaible that on the dll's unloaded/destruction
> will call the singleton to remove/clean up itself and instances of
> threads it provides correctly.   If when the singleton gets destructed
> and their are still threads there that need destructing it can do so.
>
> To do it I think you'll probably need not just the Thread subclasses
> in the plugin/library but also a statically created CleanUp class that
> when it destructs it knows about which types of Threads are associated
> with it and need cleaning up.  One way to do this might be have this
> helper class create and destroy the Threads that are associate with
> that plugin/library, maintaining a local list of these Threads.  The
> singleton then wouldn't directly have the list of threds, just a list
> of the help class.
>
> Robert.
> ___
> 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] how do I modify textures of an .IVE

2010-12-03 Thread Robert Osfield
Hi John,

On Thu, Dec 2, 2010 at 5:32 AM, John Farmer  wrote:
> I am new to OSG.  I have an .IVE file of an aircraft.  I would like to know 
> how to modify the textures of that aircraft, any help would greatly be 
> appreciated.

You'll need to be a bit more specific.  In what way do you want to
modify the textures (images associated with them)?  Replace the images
with different images on disk?  Modify the imagery at runtime such as
"painting on them"? Modify the images offline?

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


Re: [osg-users] Old really nasty OpenThreads bug?

2010-12-03 Thread Robert Osfield
Hi Anders,

I'm pretty sure is not a threading issue / bug in OpenThreads, I
believe it's an issue of proper management of the destruction order of
objects/implementations.  When you use singletons you have to be
particularly careful if you are relying upon automatic clean up
provided by the static object destruction.

One way you could handle the issue of implementations provided by
dll's being unloaded prior to your singleton destructing is for the
dll to have a static varaible that on the dll's unloaded/destruction
will call the singleton to remove/clean up itself and instances of
threads it provides correctly.   If when the singleton gets destructed
and their are still threads there that need destructing it can do so.

To do it I think you'll probably need not just the Thread subclasses
in the plugin/library but also a statically created CleanUp class that
when it destructs it knows about which types of Threads are associated
with it and need cleaning up.  One way to do this might be have this
helper class create and destroy the Threads that are associate with
that plugin/library, maintaining a local list of these Threads.  The
singleton then wouldn't directly have the list of threds, just a list
of the help class.

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


Re: [osg-users] Please test svn/trunk in prep for 2.9.10 dev release

2010-12-03 Thread Robert Osfield
Hi Thomas,

On Fri, Dec 3, 2010 at 7:05 AM, Thomas Hogarth  wrote:
> Hi Robert
> Attached is a simple example demonstrating my NPOT subload issue.

I have tested your example and reproduced the constant rebuild of the
texture object, and using this have dug into the Texture2D::apply()
method to under stand what is going on.

What is clear from the existing code is that the problem will exist
when you assign an osg::Image to a texture and use a subload callback
to create a texture object of a different size to that Image.  There
is specific code in Texture2D::apply() to catch when Images changes
size or format, but this code ignores the presence of the callback.

A quick fix is to only do the check for changes in image size and
pixel format when no callback is attached.  The attached Texture2D.cpp
does just this and is attached.  The change is pretty simple:

Index: Texture2D.cpp
===
--- Texture2D.cpp   (revision 11975)
+++ Texture2D.cpp   (working copy)
@@ -144,7 +144,7 @@

 if (textureObject)
 {
-if (_image.valid() && getModifiedCount(contextID) !=
_image->getModifiedCount())
+if (!_subloadCallback && _image.valid() &&
getModifiedCount(contextID) != _image->getModifiedCount())
 {
 // compute the internal texture format, this set the
_internalFormat to an appropriate value.
 computeInternalFormat();


While this is pretty easy change, it does push the responsibility of
catching when the texture object needs to be re-assigned due to
changes in the pixel format or size to the callback.  This is no great
problem, but it's a rather implicit change in behaviour.  In your
usage case it'll fix a problem, but just as easily it could break
other applications that rely upon the existing behaviour.

I'm currently learning towards doing what we did with the
Callback::generateTextureObject() method, and letting the callback
decide whether the re-assignment of the texture object is required,
and by default have this method provide the existing behaviour of
doing the resize if the image changes size or pixel format.

I'm not sure of what form this method needs to take yet.. will do some
further thinking on the topic.

Robert.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/

#include 
#include 
#include 
#include 

using namespace osg;

Texture2D::Texture2D():
_textureWidth(0),
_textureHeight(0),
_numMipmapLevels(0)
{
setUseHardwareMipMapGeneration(true);
}

Texture2D::Texture2D(Image* image):
_textureWidth(0),
_textureHeight(0),
_numMipmapLevels(0)
{
setUseHardwareMipMapGeneration(true);
setImage(image);
}

Texture2D::Texture2D(const Texture2D& text,const CopyOp& copyop):
Texture(text,copyop),
_image(copyop(text._image.get())),
_textureWidth(text._textureWidth),
_textureHeight(text._textureHeight),
_numMipmapLevels(text._numMipmapLevels),
_subloadCallback(text._subloadCallback)
{
}

Texture2D::~Texture2D()
{
}

int Texture2D::compare(const StateAttribute& sa) const
{
// check the types are equal and then create the rhs variable
// used by the COMPARE_StateAttribute_Parameter macros below.
COMPARE_StateAttribute_Types(Texture2D,sa)

if (_image!=rhs._image) // smart pointer comparison.
{
if (_image.valid())
{
if (rhs._image.valid())
{
int result = _image->compare(*rhs._image);
if (result!=0) return result;
}
else
{
return 1; // valid lhs._image is greater than null. 
}
}
else if (rhs._image.valid()) 
{
return -1; // valid rhs._image is greater than null. 
}
}

if (!_image && !rhs._image)
{
// no image attached to either Texture2D
// but could these textures already be downloaded?
// check the _textureObjectBuffer to see if they have been
// downloaded

int result = compareTextureObjects(rhs);
if (result!=0) return result;
}

int result = compareTexture(rhs);
if (result!=0) return result;

// compare each parameter in turn against the rhs.
#if 1
if (_textureWidth != 0 && rhs._textureWidth !=

[osg-users] how do I modify textures of an .IVE

2010-12-03 Thread John Farmer
Hello!

I am new to OSG.  I have an .IVE file of an aircraft.  I would like to know how 
to modify the textures of that aircraft, any help would greatly be appreciated.

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





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


Re: [osg-users] [osgPPU] Usage of osg::Uniform::Callback with osgPPU::ShaderAttribute ?

2010-12-03 Thread Art Tevs
Hi Peter,

hmm, thats strange. Actually an update callback is always running over full 
osgPPU graph too. So it should reach node's stateset and hence also update a 
callback. 

What happens if you specifiy just an update callback for an osgPPU unit. Unit's 
are derived from osg::Node so you could set an update callback on them. Please 
check then if the callback get called. 

Cheers,
Art

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





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


Re: [osg-users] Old really nasty OpenThreads bug?

2010-12-03 Thread Juan Hernando

Hi Anders
In that case I'm afraid I cannot help you because I seldom use Windows 
and I don't know enough about dll termination issues.

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


Re: [osg-users] Old really nasty OpenThreads bug?

2010-12-03 Thread Anders Backman
This is a WINDOWS problem only.

It works under Linux, MacOSX just fine.
Sorry for not pointing it out more clearly.

To reply Juan, the problem of using static variables for destruction is that
it causes exactly this problem :-)

If  the static variable is defined in the MAIN-APP, it works just fine. In
the same way that atexit() works when it is called from the main-app.

It is when the static variable (in your case static Deallocator deallocator)
is defined in the .dll file for our library the problem occurs.
So I can recreate exactly the same problem by using static deallocators
instead of atexit():

1. If deallocation of the thread occurs in "main", it works
2. If deallocation of the thread occurs in "dll" it hangs.

Same code works in Linux/Mac regardless of gcc version.

We have "deallocators" in the form of Singletons, which are handled by a
SingletonManager, which is responsible of shutting things down in a specific
order.

Problem is just, when should the "destructors" be called?
Explicitly:

main()
{
...

  shutdown(); // Works fine, thread dies happy.
}


or implicitly by the scope of static variables? (preferred so that user does
not have to call shutdown();

/A

On Fri, Dec 3, 2010 at 11:20 AM, Robert Osfield wrote:

> Hi Anders,
>
> I have just had a look at your test example and it fails to compile
> under linux due to the atexit() method.
>
> Reviewing the code I'm a bit confused why you are using atexit()
> method at all.  The OSG itself has lots of threads, objects and
> singleton created in difference places at different times and works
> fine with a platform specific exit mechanism, so I would have thought
> it should be possible for your app as well.
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
__
Anders Backman, CTO  Algoryx Simulation AB
Uminova Science Park, Box 7973,  SE-907 19
Umeå,  Sweden
and...@algoryx.se http://www.algoryx.se
Cell: +46-70-392 64 67
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Old really nasty OpenThreads bug?

2010-12-03 Thread Juan Hernando

Hi Anders,
I've tried your app on Linux and works fine. I've also reviwed the code 
and it seems to be OK. However I don't know about Windows dll stuff so 
you might be overlooking something (atexit called after process threads 
are cancelled?). In any case, as Robert says, the atexit function can be 
completely avoided using static variables and class destructors, and 
it's probably safer.
Why don't you try this modified version of your example to see what 
happens?:


#define OTBUG_LIBRARY
#include "otbugdll.h"

struct Deallocator
{
~Deallocator()
{
if (t != 0) {
t->cancel();
delete t;
}
}
OpenThreads::Thread *t;
};
static Deallocator deallocator;

// Register atexit that will delete the thread
void regThread( OpenThreads::Thread *t)
{
  deallocator.t = t;
}

Robert Osfield wrote:

Hi Anders,

I have just had a look at your test example and it fails to compile
under linux due to the atexit() method.

Reviewing the code I'm a bit confused why you are using atexit()
method at all.  The OSG itself has lots of threads, objects and
singleton created in difference places at different times and works
fine with a platform specific exit mechanism, so I would have thought
it should be possible for your app as well.

Robert.
___
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] Old really nasty OpenThreads bug?

2010-12-03 Thread Robert Osfield
Hi Anders,

I have just had a look at your test example and it fails to compile
under linux due to the atexit() method.

Reviewing the code I'm a bit confused why you are using atexit()
method at all.  The OSG itself has lots of threads, objects and
singleton created in difference places at different times and works
fine with a platform specific exit mechanism, so I would have thought
it should be possible for your app as well.

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


Re: [osg-users] Old really nasty OpenThreads bug?

2010-12-03 Thread Robert Osfield
Hi Anders,

I haven't tested out the app yet, but my first thought is that perhaps
the clean up on exit is destroying the thread objects + implementation
prior to the singleton destructor cleaning up.  I have seen a number
of issues like this over the years, and one just has to be careful
about what gets destructed when to make sure the runtime has all the
parts it needs to clean up correctly.  This clean up issue doesn't
require a bug in OpenThreads/Win32 threads for it occur, it can occur
simply due to destruction order.

Have you tested you test app out on any other platforms?

Robert.

On Thu, Dec 2, 2010 at 9:06 PM, Anders Backman  wrote:
> Hi all.
> Im using OpenSceneGraph 2.8.3 under windows. Visual studio 2008.
> However, this problem has been around for at least 2 years, so it existed in
> previous versions too.
> I have finally after two years? isolated the bug I reported quite a while
> back: http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2008-May/011360.html
> I took a deep breath, and after quite a few hours I managed to isolate the
> problem into one .dll file and one .exe file.
> The problem:
> Assume I have an application, it creates a thread.
> For various reason, I want to register this thread to a function for later
> destruction (in our lib we give the pointer of the thread to a singleton
> which later destroys the thread). In this example, its just registers a
> function in atexit() which will delete the thread.
> Notice that this call to atexit() is done within ANOTHER DLL (otbugdll.cpp).
> When the app exits, the atexit() is called and the thread is destroyed. But
> the problem is that it hangs at the call to m_block.release() in the
> destructor.
> If I instead call atexit() from the main app, everything works just fine.
> This means, that the call to delete for the thread is the same, its just
> initiated from an atexit() call done from main().
>
> What this does, is that we need to have a call:
> ThreadPool::instance()->shutdown();
> that HAVE to be called BEFORE the end of the scope of main. Really
> irritating.
> We cant use atexit() from within the library (because it is done from a
> separate lib/dll, which regenerates the problem).
>
> To build this, you need to set the OSG_DIR path to your OpenSceneGraph
> install, run cmake on it, and build the project.
> If SHOULD_HANG is defined it will...hang.
> http://www8.cs.umu.se/~andersb/otbug.zip
>
>
> I have done just about everything I can come up with to try to resolve this
> problem, but nothing works.
> I have tried to use a DllMain() function, which catches the events for
> attaching and detaching the dll, and doing the delete of the thread there. I
> have tried every combination of singletons, static variables etc, but it all
> fails.
> So the above example is not really exactly my original problem, but it
> reproduces the problem quite nicely. I cannot really see what the problem
> is.
> The flow of code is exactly the same no matter if SHOULD_HANG is defined or
> not.
> It might be a bug in how OpenThreads use the win32 threading API.
> OR it might be a limitation of the Win32 threading API.
> Thankful for any help on this matter.
> It has been on my mind now for more two years.
> /Anders
> --
>
>
> ___
> 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] [Linux] Could not open shared object file: No such file or directory

2010-12-03 Thread Robert Osfield
Hi Patrick,

On Fri, Dec 3, 2010 at 8:12 AM, Patrick Steffens
 wrote:
> Thanks. The plugin is now been found by the browser. Is there a possibility 
> to mage osg look into /usr/local/lib every time the system starts?
>
> I've done this before, but I don't really remember how I made it work ;-)

You can use the OSG_LIBRARY_PATH env var to point to the parent
directory of the osgPlugins-version directory, or set this at runtime
using osgDB::setLibraryFilePathList(..).  See include/osgDB/FileUtils.

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


Re: [osg-users] Graphic Context + Texture Memory

2010-12-03 Thread Robert Osfield
Hi Guy,

If you are using multiple graphics contexts then by default the
OSG/OpenGL will be creating OpenGL objects (like textures) on a per
context basis.  So one osg::Texture in the scene graph even if it's
rendered on two contexts you'll have two separate
TextureObjects/OpenGL texture objects.

As Jason mentions OpenGL and the OSG has support for sharing GL
objects between contexts, but there is no threading protection for
this so you'd have to render the two context single
threaded/sequentially.   There are also limits from the GL driver in
what type of contexts can be shared.

When using pbuffers for RTT the OSG will be default share the GL
objects and this is safe as the parent GraphicsWindow that requires
the RTT will have a it's GraphicsThread release the GraphicsWindow
context, make the pbuffer context current, do the RTT rendering,
release the pbuffer context, then make the original GraphicsWindow
context current again and then finishes rendering.  With this usage it
provides the two contexts are manage single threaded and everything is
safe.

In your own app the answer is likely to be just accept the duplication
of texture objects/VBO's/display lists, or run single threaded and
share GL objects between contexts via the GraphicsContext::Traits set
up, or avoid using multiple windows.  The OSG allows you to have
multiple Camera's and View's on a single window, and it's only a high
level viewer configuration change to swap between a single Context
with multiple Cameras/Views or one using multiple contexts.

Robert.

On Thu, Dec 2, 2010 at 10:18 PM, Guy Volckaert
 wrote:
> I have a newby question to ask... so please be gentil
>
> Let's say I have 2 cameras running in different draw threads. Each camera is 
> also associated with a different graphic context. If I load a 2D texture then 
> each context will have its own opengl texture object (created in the 
> Texture2D::Apply() function).  So far so good...
>
> My question is: will the opengl driver have 2 instance of the texture object 
> in memory and therefore occuping twice the amount necessary? Or is the driver 
> smart enough to somehow share the same memory space for both instances?
>
> I guess the answer is that each texture is represented in each graphic 
> context by a different opengl texture object, and thus will occupy N times 
> the required memory space, where N is the number of graphic context. Am I 
> understanding this right?
>
> Regards,
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=34460#34460
>
>
>
>
>
> ___
> 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] Postrendering Effects only with RTT?

2010-12-03 Thread Kim Bale
You can also look at the osgOcean source. All of those effects have been
implemented within OceanScene.cpp

Kim.


On 3 December 2010 09:01, Torben Dannhauer  wrote:

> Hi,
>
> osgPPU provides rendering effects you are searching for.
>
>
>
> Cheers,
> Torben
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=34472#34472
>
>
>
>
>
> ___
> 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] Question about setting speed/acceleration with AnimationPath

2010-12-03 Thread Robert Osfield
Hi Dat,

The AnimationPath assumes a constant speed between each control point
and animates accordingly.

I guess it shouldn't be be possible to come up with the maths so that
one assumes a constant acceleration between control points and then
integrates to get the actual position at a given time.  One would also
need to store the speed at the control point as the position, rotation
and scale.

I'm not really familiar with osgAnimation yet, perhaps it provides
support for what you are after.

Robert.

On Fri, Dec 3, 2010 at 12:44 AM, Nguyen Tien Dat  wrote:
> Dear all,
> I need to move an object along a line with the speed of 1m/s. The
> object starts from stationary (0m/s). I use AnimationPath like this:
>
>                osg::AnimationPath* animationPath = new osg::AnimationPath;
>        animationPath->setLoopMode(osg::AnimationPath::NO_LOOPING);
>
>                osg::Vec3 startPoint(startMat(3,0), startMat(3,1),
> startMat(3,2));
>        animationPath->insert(0.0,osg::AnimationPath::ControlPoint(startPoint
> , rotation));
>
>        osg::Vec3 endPoint(endMat(3,0), endMat(3,1), endMat(3,2));
>
>                float speed = 1.0; // (m/s)
>                float timeOfAnimation = distanceFromStartPointToEndPoint/speed;
>
>        
> animationPath->insert(timeOfAnimation,osg::AnimationPath::ControlPoint(endPoint
> , rotation));
>
>        matTransNode.setUpdateCallback(new 
> osg::AnimationPathCallback(animationPath));
>
> The animation works, but it seems to me that the speed instantly
> becomes 1m/s and there's no acceleration. So my question is: is there
> a way I can specify that, say, in the first second the acceleration is
> +1 m/s^2, and the next few seconds the acceleration is 0 m/s^2 (so
> that the speed is constant), and then in the last second the
> acceleration is -1 m/s^2?
>
> Thank you very much for your help.
> Best,
> Dat
> ___
> 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] Postrendering Effects only with RTT?

2010-12-03 Thread Torben Dannhauer
Hi,

osgPPU provides rendering effects you are searching for.



Cheers,
Torben

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





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


[osg-users] Postrendering Effects only with RTT?

2010-12-03 Thread Martin Großer
Hello,

if I want to create a blur effect or a focus effect, if is absolutely necessary 
to do it with Render To Texture? The question is: Do I have to create a plane 
with a texture or there are an other way to do that? And Do I have to bind a 
callback function to the plane for the resize event of the viewer?

Have someone implemented post rendering effects like blur, focus or glare 
before and can give me some helpful hints?

Cheers

Martin
-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] [Linux] Could not open shared object file: No such file or directory

2010-12-03 Thread Patrick Steffens
Hi,

Thanks. The plugin is now been found by the browser. Is there a possibility to 
mage osg look into /usr/local/lib every time the system starts?

I've done this before, but I don't really remember how I made it work ;-)

Greetz
Patrick

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





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