Re: [osg-users] 64-bit OSG

2007-12-01 Thread Aashish Chaudhary
I have been using 64 OSG on both linux and windows environment without any
issues.  For our modeler we had to build 64 bit OSG for Max OSG exporter on
his 64 bit machine.

As he had plenty of memory on his machine we were able to export large
dataset in a single step which was not possible earlier with his 32 bit
machine.

~Aashish


On Nov 29, 2007 7:05 PM, Donald Tidrow [EMAIL PROTECTED] wrote:



 Zach Deedler wrote:
  This site explains it all:
  http://en.wikipedia.org/wiki/64-bit
 
  2^32 = 4GB
  2^64 = 17,179,869,184GB or 16 exabytes
  (I was wrong before).
 
 Actually this depends on whether the CPU you're using can really address
 this much memory - I seem to recall that AMD cpu's are limited to 48-bit
 physical addresses.

  Some operating systems reserve portions of process address space for OS
 use,
  effectively reducing the total address space available for mapping
 memory
  for user programs. For instance, Windows XP DLLs and userland OS
 components
  are mapped into each process's address space, leaving only 2 to 3.8 GB
  (depending on the settings) address space available, even if the
 computer
  has 4 GB of RAM. This restriction is not present in 64-bit Windows.
 
  Not sure what linux does.  But, you can't get past the 4GB ceiling for a
  process on a 32-bit OS.

 Last I checked, Linux allowed 3GB/process of user-addressable memory
 running a 32-bit kernel.

 Another advantage that you can get from running in 64-bit mode, at least
 with x86-64 cpu's, is the use of twice as many processor registers (all
 64-bits wide).  This can sometimes speed up programs if you use the
 right optimization flags.

 Don

 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of Robert
  Balfour
  Sent: Thursday, November 29, 2007 9:54 AM
  To: OpenSceneGraph Users
  Subject: Re: [osg-users] 64-bit OSG
 
  Gordon Tomlinson wrote:
 
 Note on 32 bit even though the system may let you get to 3gb of memory
 
  seen
 
 Your addressable memory space per process will be limited to around
 1.8gb
 
  on
 
 a 32bit system
 
 
 
  Why is that?  And is that per process, or per thread?
 
 
  Bob.

 --
 A government that is big enough to give you all you want
 is big enough to take it all away.
   -- Barry Goldwater

 ++
 |  Don Tidrow|
 |  Visualization Software Engineer   |
 |  SAIC  |
 |  ph: 703-253-1094  |
 ++
 ___
 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] DynamicLibrary::failed loading

2007-12-01 Thread Paul Speed
I don't know if it matters in this case or not but on WinXP I had a 
problem with spaces in paths.  If I put OSG into a directly with a space 
in it and then added that directory to my path: I would be able to run 
osgviewer.exe but it would fail to find any of the DLLs.  Moving it to a 
directory without a space fixed it.

At the time, I couldn't find anything to make it work... but I didn't 
try very hard either (since I had a work-around).  It seemed like DLL 
resolution was done differently than exe path resolution.

I could have been out of my mind, too.
-Paul

Mike Weiblen wrote:
 Interesting, thanks for the data.  This is exactly the kind of situation
 I had intended my installer would solve, this is good feedback.
 
 fyi, the osgDB library explicitly does the loading of the osgdb_*.dll
 plugins, which is why there aren't problems finding and the plugins are
 found in their magic directory, etc.  At issue is how the dependencies
 pulled in by the Windows runtime linker are found and loaded.
 
 (some backstory: this pathing garbage is all due to the licensing of the
 MS redist libraries.  Other dependency libraries don't limit how they're
 put in the filesystem, so they can be located whereever's convenient.
 The MS runtime redist requires their subdirectory structure and naming
 be preserved. :-P)
 
 I'd really like to understand the root cause here, so the installer will
 Just Work.  A couple more questiions:
 - this isn't Vista, is it?
 - exactly what's the machine config? (which OS, SP, etc?  32/64 bit?
 Is/was VS ever installed, which version?)
 - are you installing as admin or not?  
 - are you running as admin or not?
 - where is OSG being installed?  on a UNC share?  
 
 The official MS-sanctioned sure-fire solution is to run the redist
 installer to put the runtime libs in the public shared assembly
 directory:
 C:\Program Files\Microsoft Visual Studio
 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86\vcredist_x86.exe
 That will require admin permission, but should bypass the whole private
 assembly pathing issue.  If that doesn't work, there're bigger issues
 afoot.
 
 cheers
 -- mew
 
 
 
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf 
 Of Will Sistar
 Sent: Thursday, November 29, 2007 4:55 PM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] DynamicLibrary::failed loading

 Well, here is what I have done so far.  
 I used Depends and found that it couldn't find the two 
 microsoft dir, so I added that to my path as you mentioned.
 (still didn't work)
 Uninstalled OSG and then reinstalled making sure to add the 
 environment variables to the registry. (I believe I did 
 before)  Ran osgShell without any modifications and found 
 that it does in fact add %OSG_PATH% to the front of the 
 system path with the same directories listed as Mike 
 previously mentioned. 
 Tried osgviewer cow.osg again and it still didn't work.

 What is interesting is that when I manually load it doesn't 
 prepend the osgPlugins-2.2.0 to the filename and it finds 
 and uses it with no problems.  If I type in osgviewer -l 
 osgPlugins-2.2.0/osgdb_osg.dll cow.osg it finds the file but 
 still says it fails to load.  If it were a dependency problem 
 wouldn't it have a problem loading the dll regardless of how 
 it found it?  I am not saying it isn't a PATH issue but it 
 always seems to find the file, it just fails when it is 
 anywhere other than the \bin dir.  I tried putting it in the 
 \system32 directory and try to manually load it and it finds 
 it there but fails to load.  

 It works on one of my home pc just not my work one.

 Mike, this is where I started with setting up my env 
 variables.  I think I may have entered one of them wrong 
 before which is why I removed everything and started over.  I 
 then checked them against what you had in your email and they 
 matched. 
 http://www.openscenegraph.org/projects/osg/wiki/Support/Gettin
 gStartedstep 4. and
 http://www.openscenegraph.org/projects/osg/wiki/Support/Platfo
 rmSpecifics/VisualStudio 
 http://www.openscenegraph.org/projects/osg/wiki/Support/Platf
 ormSpecifics/VisualStudio Environment Variables


 ___
 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] Fade in fade out effect

2007-12-01 Thread maruti borker
Have used glAccum .. thanx Robert it worked :)

On Dec 1, 2007 12:30 AM, Robert Osfield [EMAIL PROTECTED] wrote:

 Hi Deepti,

 The easiest way to do this would be to use the accumulation buffer -
 if available, have a look at the osgmotionblurr example for
 inspiration.  If you don't have a accumulation buffer available then
 using two cameras for the two different views of the scenes, and have
 the first camera render to texture, then after the second camera/view
 has drawn draw over the use a full quad blending with the background.

 Robert.

 On Nov 30, 2007 5:29 PM, deepti g [EMAIL PROTECTED] wrote:
  Hi everyone
   I want to implement a fade in fade out option where
 one
  scene fades out and another scene comes into view.. Is there any such
 option
  for scene as FADE TEXT for text..Iam dint find a direct functionality to
 do
  this.Can anybody suggest me as to how to solve this?
 
  Thank You
  Deepti
 
  ___
  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




-- 
--
Maruti Borker
IIIT Hyderabad
Website:- http://students.iiit.ac.in/~maruti
Blog:- http://marutiborker.wordpress.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Mutex and ReentrantMutex

2007-12-01 Thread Robert Osfield
On Nov 30, 2007 10:16 PM, André Garneau [EMAIL PROTECTED] wrote:
 Hi Paul,

  1. I always understood reentrant to refer to code or an object that
 could
  be executed safely by multiple threads or processes. However, the
  ReentrantMutex would only be used for code that is safe for the _same_
  thread or process to execute concurrently, thus my confusion. Is the name
  reentrant appropriate here?

 I agree with you that re-entrant is a misnomer for this class. Some
 frameworks use the term recursive mutex (i.e. ACE, Boost) for such
 functionality, although this is still a debatable term for it.

The ReentrantMutex naming convention is inherited from another project
from a number of years back, can't remember the details now.

  2. A couple years back I simplified the Mutex class for Windows. As a
  result, it actually works somewhat like the ReentrantMutex. Mea culpa.

 IMHO, I think it's actually an excellent thing to have it this way. The cost
 of implementing counted lock acquisition is negligible and the savings in
 debugging and maintenance time more than outweigh this cost. However this
 does bring the issue of having possibly different behaviour when porting an
 application from Windows to other platforms.

Its absolute crucial that things behave the same on all platforms, the
implementations may vary, but the behaviour needs to be the same as
far as possible.  If some one want to volunteer a Win32 version then
I'm open.

Performance wise there isn't any critical points in the OSG that use
ReentrantMutex, so I don't see a strong need to trying to optimize it.
 I have found occasional problems with ReentrantMutext though, but
haven't yet pinpointed the cases where it fails clearly enough to know
the case/provide a fix.  So the code itself could do with improving...

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


Re: [osg-users] Is there a BUG in osg::Polytope::setToBoundingBox ?

2007-12-01 Thread Robert Osfield
Hi Wangray,

You were correct, there was a bug in Polytope::setBoundingBox, I
created a unit test in osgunittests and reproduced the bug you
illustrated, then reviewed the relevant code, fixed it and it now
passes the test.  The fix is now checked into SVN.  File also
attached.

Robert.

On Dec 1, 2007 4:16 AM, 锐王 [EMAIL PROTECTED] wrote:
 Hi all,

 I'm new here. Please don't mind of my ignorant and rudeness :)

 While reading the source code of osgUtil, I find that in the implement code
 of osg::Polytope::setToBoundingBox(...):
 ...
 _planeList.push_back(Plane(0.0,0.0,-1.0,bb.zMin())); // near plane
 _planeList.push_back(Plane(0.0,0.0,1.0,bb.zMax())); // far plane
  ...

 That means when Zmin=-1000 and Zmax=1000, The near and far plane of the
 plane list of Polytope will be the same except their normals. And a bug
 appeared when I write:
 ...
 osg::Polytope pt;
 pt.setToBoundingBox(osg::BoundingBox(-1000, -1000, -1000, 1000, 1000,
 1000));
 bool bContain = pt.contains(osg::Vec3(0, 0, 0));
 ...
 bContain will be set to false.

 Is there a bug in setToBoundingBox, or I just made a silly mistake myself?
 :P
 I'm using OSG 2.2 and VS2005.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




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


[osg-users] Getting world coord bounding box

2007-12-01 Thread Siddharth Palaniappan
Hi osg users,

I'm currently using openscenegraph for my class project to simulate traffic. I 
have a problem in that , i need to find collision detection between consecutive 
cars and stop the car if  there is a collision.  I have followed the 
osgExample- for animation. I have used an animationpath and 
animationpathcallback and i have implemented my own spline interpolation for 
the car to traverse on a spline. I tried to get the world coordinate of the 
bounding box like this..

* i have a class Vehicle that stores the node to which an openflight model is 
read into.

* the leaf node is the node having the vehicle, the parent node of this node is 
a transformation node which has an animationpathcallback set to, and this also 
has a parent node to initially set the location and orientation, (just like in 
the osgExample animation).

* i have a node visitor that traverses parents..so it goes from the current 
node to the root concatenating all the world coordinates.

* then i get the local bounding box of the node and get the minimum and maximum 
and multiply the world coord matrix with these points to form a new min and max 
point and create a new bounding box. I do this for every two node to check the 
intersection of two consecutive nodes. 


//getWorldCoords() - forwards to a nodevisitor to get world coords matrix.
osg::Matrixd* WorldCoordsMatrix = getWorldCoords(this-m_Vehicle) ;
osg::BoundingBox VehicleBBox ;

VehicleBBox.expandBy(m_Vehicle-getBound()) ;

//Convert the vehicle local coords to world coordinates.
osg::Vec3f MinPt(VehicleBBox.xMin() , VehicleBBox.yMin() , 
VehicleBBox.zMin()) ;
osg::Vec3f MaxPt(VehicleBBox.xMax() , VehicleBBox.yMax() , 
VehicleBBox.zMax()) ;

osg::Vec3f NewMinPt , NewMaxPt ;
NewMinPt = MinPt * (*WorldCoordsMatrix) ;
NewMaxPt = MaxPt * (*WorldCoordsMatrix) ;

this-m_VehicleBoundingBox = new osg::BoundingBox(NewMinPt , NewMaxPt) ;

I am not getting correct results. I get that the bounding boxes dont intersect 
at all or sometimes intersect at odd places. Please let me know if i'm doing 
something stupid or if i my understanding of anything wrong. 


Thank you,

Yours Sincerely,

Siddharth






  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] FBO resizing problem

2007-12-01 Thread Himar Carmona
Hi Robert,

 i only resize (i.e. recreate) the FBO when a resize operation is performed
(when it is detected as finished). 99% of the time this will not happen.
Really, my app performance is dropping due to the readback operation every
frame. In my case this is acceptable, as i don't need constant frame rate
(i'm rendering on demand, my app is a CAD like one). OSG is so fast doing
its work, that the response time is good enough.

  This is my workaround to the problem i mentioned in my post:

   osgViewer::Renderer* renderer =
(osgViewer::Renderer*)camera-getRenderer();

renderer-getSceneView(0)-getRenderStage()-setCameraRequiresSetUp(true);

renderer-getSceneView(0)-getRenderStage()-setFrameBufferObject(NULL);

  These lines force the RenderStage to recreate the FBO, but this only
happens when the resize operation ends.

  Your idea is better of course. But my app must be able to handle a
multimonitor system. How can i determine in this situation what is the
largest region i need? Is this region independent of the multimonitor
configuration?


Thank you for your advices, Robert. I really appreciate them.
Himar.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Getting world coord bounding box

2007-12-01 Thread Daniel Holz
hi,

don't you have to multiply the matrix from the left side with the 
vector, like this:
M * x = x',
whereas M is your 'WorldCoordsMatrix', x is your local BBox vector and 
x' is the same in world coords.

hope this helps.

daniel

Siddharth Palaniappan wrote:
 Hi osg users,

 I'm currently using openscenegraph for my class project to simulate traffic. 
 I have a problem in that , i need to find collision detection between 
 consecutive cars and stop the car if  there is a collision.  I have followed 
 the osgExample- for animation. I have used an animationpath and 
 animationpathcallback and i have implemented my own spline interpolation for 
 the car to traverse on a spline. I tried to get the world coordinate of the 
 bounding box like this..

 * i have a class Vehicle that stores the node to which an openflight model is 
 read into.

 * the leaf node is the node having the vehicle, the parent node of this node 
 is a transformation node which has an animationpathcallback set to, and this 
 also has a parent node to initially set the location and orientation, (just 
 like in the osgExample animation).

 * i have a node visitor that traverses parents..so it goes from the current 
 node to the root concatenating all the world coordinates.

 * then i get the local bounding box of the node and get the minimum and 
 maximum and multiply the world coord matrix with these points to form a new 
 min and max point and create a new bounding box. I do this for every two node 
 to check the intersection of two consecutive nodes. 


 //getWorldCoords() - forwards to a nodevisitor to get world coords matrix.
 osg::Matrixd* WorldCoordsMatrix = getWorldCoords(this-m_Vehicle) ;
 osg::BoundingBox VehicleBBox ;

 VehicleBBox.expandBy(m_Vehicle-getBound()) ;

 //Convert the vehicle local coords to world coordinates.
 osg::Vec3f MinPt(VehicleBBox.xMin() , VehicleBBox.yMin() , 
 VehicleBBox.zMin()) ;
 osg::Vec3f MaxPt(VehicleBBox.xMax() , VehicleBBox.yMax() , 
 VehicleBBox.zMax()) ;

 osg::Vec3f NewMinPt , NewMaxPt ;
 NewMinPt = MinPt * (*WorldCoordsMatrix) ;
 NewMaxPt = MaxPt * (*WorldCoordsMatrix) ;

 this-m_VehicleBoundingBox = new osg::BoundingBox(NewMinPt , NewMaxPt) ;

 I am not getting correct results. I get that the bounding boxes dont 
 intersect at all or sometimes intersect at odd places. Please let me know if 
 i'm doing something stupid or if i my understanding of anything wrong. 


 Thank you,

 Yours Sincerely,

 Siddharth






   
 
 Never miss a thing.  Make Yahoo your home page. 
 http://www.yahoo.com/r/hs
 ___
 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] Getting world coord bounding box

2007-12-01 Thread Siddharth Palaniappan
Hi daniel,

I read thru this at the osg site :

http://www.openscenegraph.org/projects/osg/wiki/Support/Maths/MatrixTransformations

In the end , robert says ways are defined ... i initially multiplied the matrix 
on the left side. But after reading this i changed it...am i wrong ?

Siddharth

- Original Message 
From: Daniel Holz [EMAIL PROTECTED]
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Sent: Saturday, December 1, 2007 2:35:52 PM
Subject: Re: [osg-users] Getting world coord bounding box


hi,

don't you have to multiply the matrix from the left side with the 
vector, like this:
M * x = x',
whereas M is your 'WorldCoordsMatrix', x is your local BBox vector and 
x' is the same in world coords.

hope this helps.

daniel

Siddharth Palaniappan wrote:
 Hi osg users,

 I'm currently using openscenegraph for my class project to simulate
 traffic. I have a problem in that , i need to find collision detection
 between consecutive cars and stop the car if  there is a collision.  I
 have followed the osgExample- for animation. I have used an
 animationpath and animationpathcallback and i have implemented my own spline
 interpolation for the car to traverse on a spline. I tried to get the world
 coordinate of the bounding box like this..

 * i have a class Vehicle that stores the node to which an openflight
 model is read into.

 * the leaf node is the node having the vehicle, the parent node of
 this node is a transformation node which has an animationpathcallback set
 to, and this also has a parent node to initially set the location and
 orientation, (just like in the osgExample animation).

 * i have a node visitor that traverses parents..so it goes from the
 current node to the root concatenating all the world coordinates.

 * then i get the local bounding box of the node and get the minimum
 and maximum and multiply the world coord matrix with these points to
 form a new min and max point and create a new bounding box. I do this for
 every two node to check the intersection of two consecutive nodes. 


 //getWorldCoords() - forwards to a nodevisitor to get world
 coords matrix.
 osg::Matrixd* WorldCoordsMatrix = getWorldCoords(this-m_Vehicle)
 ;
 osg::BoundingBox VehicleBBox ;

 VehicleBBox.expandBy(m_Vehicle-getBound()) ;

 //Convert the vehicle local coords to world coordinates.
 osg::Vec3f MinPt(VehicleBBox.xMin() , VehicleBBox.yMin() ,
 VehicleBBox.zMin()) ;
 osg::Vec3f MaxPt(VehicleBBox.xMax() , VehicleBBox.yMax() ,
 VehicleBBox.zMax()) ;

 osg::Vec3f NewMinPt , NewMaxPt ;
 NewMinPt = MinPt * (*WorldCoordsMatrix) ;
 NewMaxPt = MaxPt * (*WorldCoordsMatrix) ;

 this-m_VehicleBoundingBox = new osg::BoundingBox(NewMinPt ,
 NewMaxPt) ;

 I am not getting correct results. I get that the bounding boxes dont
 intersect at all or sometimes intersect at odd places. Please let me
 know if i'm doing something stupid or if i my understanding of anything
 wrong. 


 Thank you,

 Yours Sincerely,

 Siddharth






  
 

 Never miss a thing.  Make Yahoo your home page. 
 http://www.yahoo.com/r/hs
 ___
 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





  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Getting world coord bounding box

2007-12-01 Thread Siddharth Palaniappan
Hi Daniel,

Sorry for the misunderstanding...yes you're right, it has to be done on the 
left side. But i still dont get any valid results. Can you suggest how i can 
test if the world coordinates of the box after multiplication is correct or not?

Thank you,

Siddharth

- Original Message 
From: Siddharth Palaniappan [EMAIL PROTECTED]
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Sent: Saturday, December 1, 2007 2:41:19 PM
Subject: Re: [osg-users] Getting world coord bounding box


Hi daniel,

I read thru this at the osg site :

http://www.openscenegraph.org/projects/osg/wiki/Support/Maths/MatrixTransformations

In the end , robert says ways are defined ... i initially multiplied
 the matrix on the left side. But after reading this i changed it...am i
 wrong ?

Siddharth

- Original Message 
From: Daniel Holz [EMAIL PROTECTED]
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Sent: Saturday, December 1, 2007 2:35:52 PM
Subject: Re: [osg-users] Getting world coord bounding box


hi,

don't you have to multiply the matrix from the left side with the 
vector, like this:
M * x = x',
whereas M is your 'WorldCoordsMatrix', x is your local BBox vector and 
x' is the same in world coords.

hope this helps.

daniel

Siddharth Palaniappan wrote:
 Hi osg users,

 I'm currently using openscenegraph for my class project to simulate
 traffic. I have a problem in that , i need to find collision detection
 between consecutive cars and stop the car if  there is a collision.  I
 have followed the osgExample- for animation. I have used an
 animationpath and animationpathcallback and i have implemented my own
 spline
 interpolation for the car to traverse on a spline. I tried to get the
 world
 coordinate of the bounding box like this..

 * i have a class Vehicle that stores the node to which an openflight
 model is read into.

 * the leaf node is the node having the vehicle, the parent node of
 this node is a transformation node which has an animationpathcallback
 set
 to, and this also has a parent node to initially set the location and
 orientation, (just like in the osgExample animation).

 * i have a node visitor that traverses parents..so it goes from the
 current node to the root concatenating all the world coordinates.

 * then i get the local bounding box of the node and get the minimum
 and maximum and multiply the world coord matrix with these points to
 form a new min and max point and create a new bounding box. I do this
 for
 every two node to check the intersection of two consecutive nodes. 


 //getWorldCoords() - forwards to a nodevisitor to get world
 coords matrix.
 osg::Matrixd* WorldCoordsMatrix = getWorldCoords(this-m_Vehicle)
 ;
 osg::BoundingBox VehicleBBox ;

 VehicleBBox.expandBy(m_Vehicle-getBound()) ;

 //Convert the vehicle local coords to world coordinates.
 osg::Vec3f MinPt(VehicleBBox.xMin() , VehicleBBox.yMin() ,
 VehicleBBox.zMin()) ;
 osg::Vec3f MaxPt(VehicleBBox.xMax() , VehicleBBox.yMax() ,
 VehicleBBox.zMax()) ;

 osg::Vec3f NewMinPt , NewMaxPt ;
 NewMinPt = MinPt * (*WorldCoordsMatrix) ;
 NewMaxPt = MaxPt * (*WorldCoordsMatrix) ;

 this-m_VehicleBoundingBox = new osg::BoundingBox(NewMinPt ,
 NewMaxPt) ;

 I am not getting correct results. I get that the bounding boxes dont
 intersect at all or sometimes intersect at odd places. Please let me
 know if i'm doing something stupid or if i my understanding of
 anything
 wrong. 


 Thank you,

 Yours Sincerely,

 Siddharth






  

 

 Never miss a thing.  Make Yahoo your home page. 
 http://www.yahoo.com/r/hs
 ___
 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






  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org





  

Be a better pen pal. 
Text or chat with friends inside Yahoo! Mail. See how.  
http://overview.mail.yahoo.com/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Getting world coord bounding box

2007-12-01 Thread Daniel Holz
hi siddharth,

i just started being confused reading the link you sent me when i got 
this new email of yours :)
if i am in a situation like this what i usually do is i draw what i 
can't see. in your case it is the bounding box PRIOR to your 
transformation to world coordinates and the one AFTER transforming. just 
render to boxes or render spheres in two different colors marking the 
positions of the corners.
i am sure, having something visually, you will be able to figure out the 
problem.

cheers,
daniel

Siddharth Palaniappan wrote:
 Hi Daniel,

 Sorry for the misunderstanding...yes you're right, it has to be done on the 
 left side. But i still dont get any valid results. Can you suggest how i can 
 test if the world coordinates of the box after multiplication is correct or 
 not?

 Thank you,

 Siddharth

 - Original Message 
 From: Siddharth Palaniappan [EMAIL PROTECTED]
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Sent: Saturday, December 1, 2007 2:41:19 PM
 Subject: Re: [osg-users] Getting world coord bounding box


 Hi daniel,

 I read thru this at the osg site :

 http://www.openscenegraph.org/projects/osg/wiki/Support/Maths/MatrixTransformations

 In the end , robert says ways are defined ... i initially multiplied
  the matrix on the left side. But after reading this i changed it...am i
  wrong ?

 Siddharth

 - Original Message 
 From: Daniel Holz [EMAIL PROTECTED]
 To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
 Sent: Saturday, December 1, 2007 2:35:52 PM
 Subject: Re: [osg-users] Getting world coord bounding box


 hi,

 don't you have to multiply the matrix from the left side with the 
 vector, like this:
 M * x = x',
 whereas M is your 'WorldCoordsMatrix', x is your local BBox vector and 
 x' is the same in world coords.

 hope this helps.

 daniel

 Siddharth Palaniappan wrote:
   
 Hi osg users,

 I'm currently using openscenegraph for my class project to simulate
 
  traffic. I have a problem in that , i need to find collision detection
  between consecutive cars and stop the car if  there is a collision.  I
  have followed the osgExample- for animation. I have used an
  animationpath and animationpathcallback and i have implemented my own
  spline
  interpolation for the car to traverse on a spline. I tried to get the
  world
  coordinate of the bounding box like this..
   
 * i have a class Vehicle that stores the node to which an openflight
 
  model is read into.
   
 * the leaf node is the node having the vehicle, the parent node of
 
  this node is a transformation node which has an animationpathcallback
  set
  to, and this also has a parent node to initially set the location and
  orientation, (just like in the osgExample animation).
   
 * i have a node visitor that traverses parents..so it goes from the
 
  current node to the root concatenating all the world coordinates.
   
 * then i get the local bounding box of the node and get the minimum
 
  and maximum and multiply the world coord matrix with these points to
  form a new min and max point and create a new bounding box. I do this
  for
  every two node to check the intersection of two consecutive nodes. 
   
 //getWorldCoords() - forwards to a nodevisitor to get world
 
  coords matrix.
   
 osg::Matrixd* WorldCoordsMatrix = getWorldCoords(this-m_Vehicle)
 
  ;
   
 osg::BoundingBox VehicleBBox ;

 VehicleBBox.expandBy(m_Vehicle-getBound()) ;

 //Convert the vehicle local coords to world coordinates.
 osg::Vec3f MinPt(VehicleBBox.xMin() , VehicleBBox.yMin() ,
 
  VehicleBBox.zMin()) ;
   
 osg::Vec3f MaxPt(VehicleBBox.xMax() , VehicleBBox.yMax() ,
 
  VehicleBBox.zMax()) ;
   
 osg::Vec3f NewMinPt , NewMaxPt ;
 NewMinPt = MinPt * (*WorldCoordsMatrix) ;
 NewMaxPt = MaxPt * (*WorldCoordsMatrix) ;

 this-m_VehicleBoundingBox = new osg::BoundingBox(NewMinPt ,
 
  NewMaxPt) ;
   
 I am not getting correct results. I get that the bounding boxes dont
 
  intersect at all or sometimes intersect at odd places. Please let me
  know if i'm doing something stupid or if i my understanding of
  anything
  wrong. 
   
 Thank you,

 Yours Sincerely,

 Siddharth






  
 

  
 
   
 Never miss a thing.  Make Yahoo your home page. 
 http://www.yahoo.com/r/hs
 ___
 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





 
   
 
 Never miss a thing.  Make Yahoo your home page. 
 

Re: [osg-users] OsgViewer in form, aspect ratio issue and error on close

2007-12-01 Thread Himar Carmona
 Hi,

 i'm also using .NET (with C++/CLI) and i'm also new with OSG (a few moths
like you). Perhaps that can help you:

1) the projectionMatrix is recomputed in
GraphicsContext::resizedImplementation (which GraphicsWindow derives from).
You can override it (setResizedCallback), or look at how it is done.The code
use the traits structure to calculate the aspect ratio. Be sure you are
initializing the traits correctly.

Another way is setting the viewer with setUpViewerAsEmbeddedInWindow. There
are messages in the lists archives explaining it. I remember at least one. I
recommend you to look at the examples of osgViewerXXX. (osgviewerGLUT,
osgViewerQT, ...) osgviewerMFC is perhaps not the best one.
setUpViewerAsEmbeddedInWindow looks like the best method to separate the
viewer from the GUI framework.

2) It seems that the window Handle is being released before you close the
GraphicsContext. On .NET, Form::OnClosed, is called AFTER the window has
been destroyed, so it seems a 'tempo' error. Try OnClosing instead. This is
called before the window handle is released.Beware which one you use. If
this is not the problem, try setting the threadingModel of the viewer to
SingleThreaded and see if it is some threading issue.

Hope this helps.
Himar.


2007/11/30, Miao [EMAIL PROTECTED]:

 hi Christophe,

  1) it seems that the aspect ratio used for the rendering is based on the
  ratio of the form size.
 About your first problem,when i reuse code of  osgviewerMFC ,
 I met the same problem.
 I found  in  osgViewer::Viewer's base class osg::view 's constructor ,
 it'll new a master camera and set ProjectionMatrix with screen ratio.
 and when you add camera with  addSlave() , it will call the updateSlave(),
 and set ProjectionMatrix using master camera' projection.

 so my solution is set projection matrix to own camera,
 and using setCamera() to set master camera  instead of using addSlave().
 i am not sure it is a good solution or not, but i works.

 by the way, i use  osg 2.2 .
 Hope it also works with osg2.0.

 some code from osg::View
 View::View(): Object(true)
 {
..
   _camera = new osg::Camera;
   _camera-setView(this);

   double height = osg::DisplaySettings::instance()-getScreenHeight();
   double width = osg::DisplaySettings::instance()-getScreenWidth();
   double distance = osg::DisplaySettings::instance()-getScreenDistance();
   double vfov = osg::RadiansToDegrees(atan2(height/2.0f,distance)*2.0);
   _camera-setProjectionMatrixAsPerspective( vfov, width/height,
 1.0f,1.0f);
   _camera-setClearColor(osg::Vec4f(0.2f, 0.2f, 0.4f, 1.0f));
 
 }

 void View::updateSlave(unsigned int i)
 {
   if (i = _slaves.size() || !_camera) return;

   Slave slave = _slaves[i];

   if (slave._camera-getReferenceFrame()==osg::Transform::RELATIVE_RF)
   {
slave._camera-setProjectionMatrix(_camera-getProjectionMatrix() *
 slave._projectionOffset);
slave._camera-setViewMatrix(_camera-getViewMatrix() *
 slave._viewOffset);
   }

   slave._camera-inheritCullSettings(*_camera);
   if (slave._camera-getInheritanceMask() 
 osg::CullSettings::CLEAR_COLOR)
 slave._camera-setClearColor(_camera-getClearColor());
 }

 Miao

 - Original Message -
 From: LOREK Christophe [EMAIL PROTECTED]
 To: osg-users@lists.openscenegraph.org
 Sent: Friday, November 30, 2007 12:10 AM
 Subject: [osg-users] OsgViewer in form, aspect ratio issue and error on
 close


  hi everyone,
 
  I'm new to this mailing list, although I have been using OpenSceneGraph
  for a couple of monthes.
 
  I'm using the OsgViewer from OSG 2.0 and I would like to have it use a
  .NET form for display (using managed C++, not C#). I followed  the
  advice given by Glenn Waldron in his reply to Romain Blanchais on the
  20th of November, where he gave the following sample code :
 
  HWND hwnd = (HWND)control-Handle.ToPointer();
 
  osg::ref_ptrosg::GraphicsContext::Traits traits =
 new osg::GraphicsContext::Traits();
 
  traits-inheritedWindowData = new
  osgViewer::GraphicsWindowWin32::WindowData( hwnd );
  traits-setInheritedWindowPixelFormat = true;
  traits-doubleBuffer = true;
  traits-windowDecoration = false;
  traits-sharedContext = 0;
  traits-supportsResize = true;
 
  RECT rect;
  GetWindowRect( hwnd, rect );
  traits-x = 0;
  traits-y = 0;
  traits-width = rect.right - rect.left;
  traits-height = rect.bottom - rect.top;
 
  osg::ref_ptrosg::GraphicsContext gc =
  osg::GraphicsContext::createGraphicsContext(
 traits.get() );
 
  viewer = new osgViewer::Viewer();
 
  osg::ref_ptrosg::Camera cam = new osg::Camera();
  cam-setGraphicsContext( gc.get() );
  cam-setViewport( new osg::Viewport( traits-x, traits-y,
  traits-width, traits-height ) );
  viewer-addSlave( cam.get() );
 
  I have succeeded in obtaining a rendering of the OsgViewer in my form,
  but I have the following issues :
 
  1) it seems that the aspect ratio used for the rendering is based on the
  ratio of the form size.
  This is troublesome as I would 

[osg-users] a bug in void osg::Polytope::setToBoundingBox ( const BoundingBox bb ) [inline]

2007-12-01 Thread 祝清鲁
osg-users,您好!
does something wrong in the following code? 
void setToBoundingBox(const BoundingBox bb)
{
_planeList.clear();
_planeList.push_back(Plane(1.0,0.0,0.0,-bb.xMin())); // left plane.
_planeList.push_back(Plane(-1.0,0.0,0.0,bb.xMax())); // right plane.
_planeList.push_back(Plane(0.0,1.0,0.0,-bb.yMin())); // bottom 
plane.
_planeList.push_back(Plane(0.0,-1.0,0.0,bb.yMax())); // top plane.
_planeList.push_back(Plane(0.0,0.0,-1.0,bb.zMin())); // near plane
_planeList.push_back(Plane(0.0,0.0,1.0,bb.zMax())); // far plane
setupMask();
}
when I want to create a boundingbox with the two point V_min(20,20,20), 
V_max(100,100,100) correctly, I must use like that
osg::Polytope pt;
pt.setToBoundingBox(osg::BoundingBox(20,20,100,100,100,-20));

May be the code shuoud change to:

void setToBoundingBox(const BoundingBox bb)
{
_planeList.clear();
_planeList.push_back(Plane(1.0,0.0,0.0,-bb.xMin())); // left plane.
_planeList.push_back(Plane(-1.0,0.0,0.0,bb.xMax())); // right plane.
_planeList.push_back(Plane(0.0,1.0,0.0,-bb.yMin())); // bottom 
plane.
_planeList.push_back(Plane(0.0,-1.0,0.0,bb.yMax())); // top plane.
_planeList.push_back(Plane(0.0,0.0,1.0,-bb.zMin())); // near plane
_planeList.push_back(Plane(0.0,0.0,-1.0,bb.zMax())); // far plane
setupMask();
}

ps: this bug is pointed by array(who translated the 
OpenSceneGraph_Quick_Start_Guide to Chinese).

致
礼!


祝清鲁
[EMAIL PROTECTED]
  2007-12-02
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] License issue with .net loader?

2007-12-01 Thread Robert Balfour
Is there a potential license issue with the .net osg plugin?

In the ReaderWriterNET plugin source directory, the sockstream.cpp
component file has a header comment referencing the GPL license, which
is much more limiting that the OSG LGPL(+relaxed for static linking)
type license?

Bob.
-- 
Robert E. Balfour, Ph.D.
Exec. V.P.  CTO,  BALFOUR Technologies LLC
960 South Broadway, Suite 108, Hicksville NY 11801
Phone: (516)513-0030  Fax: (516)513-0027  email: [EMAIL PROTECTED]
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org