Re: [osg-users] About Changing Parental Nodes?

2008-07-24 Thread Vincent Bourdier
Hi,

When you put a node under a matrixTransform, this node will be deplaced and
transformed depending on the MatrixTransform.  This behavior is totaly
adapted to the scene graph.
If you want your node to stay a the same place, you will need to add it in
an other place, or you will have to move it first at the opposed
transformation of your matrixtransform nodes, and after that add it to
them...

Regards,
   Vincent

2008/7/24 Ümit Uzun [EMAIL PROTECTED]:

 Hi all,

 I have an model which illustrated at graphics.png image. I remove the 'yaw'
 group node and add under the
 'planetary-MatrixTransform-MatrixTranform-yaw' node.
 But when I am doing it I don't want to make change any components world
 position. But when I added the yaw group node under the planetary's
 MatrixTransform node it's position getting undesired change.
 What can I do for protect the nodes position when I am reorganizing the
 component's node on the scenegraph?

 Best Regars.

 Umit UZUN

 ___
 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] About Changing Parental Nodes?

2008-07-24 Thread Alberto Luaces
El Jueves 24 Julio 2008ES 09:39:40 Vincent Bourdier escribió:
 If you want your node to stay a the same place, you will need to add it in
 an other place, or you will have to move it first at the opposed
 transformation of your matrixtransform nodes, and after that add it to
 them...

...or leave the subgraph that you don't want to move where it is and put it 
under a MatrixTransform with the ABSOLUTE_RF parameter set instead of 
RELATIVE_RF.


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


Re: [osg-users] glPointSize no longer working for me?

2008-07-24 Thread David Spilling
I had something possibly similar a while ago - search the archives for GLSL
Shaders and Points (repost), or go to
http://osgcvs.no-ip.com/osgarchiver/archives/July2005/0003.html

It might be related to what you are doing.

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


Re: [osg-users] About Changing Parental Nodes?

2008-07-24 Thread David Spilling
If I understand your problem correctly, the general approach would be to
compute the coordinate system matrix local to a group prior to a move (with
computeWorldToLocal) - call it A - then to move the node, recompute the
coordinate system in the new location - call this B - and apply the correct
matrix - i.e. inverse(B) * A -  to the immediate parent transform to get the
correct positioning. In this way, when moving the object around in the
scenegraph, it won't move in the world frame.

In this case, the yaw group doesn't have a parent transform, so the initial
matrix is the identity. The destination matrix will be the transform of
planetary's MatrixTransform node, so you will need to apply the inverse of
this matrix to your yaw specific MatrixTransform.

I can't help but think that you must be able to persuade your 3DS model to
be in a much more useful structure - all this programmatic model hacking
(although useful for understanding OSG) seems quite clumsy...

Regards,

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


[osg-users] Running OSG application in Firefox

2008-07-24 Thread Rahul Jain
Hi all ,
I want to write a plugin so that i can embed my OSG application in
Firefox browser.  Have any one tried this before ?  Please suggest me
some pointers  to start with .
cheers
RJ
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] About Changing Parental Nodes?

2008-07-24 Thread Ümit Uzun
Hi there,

Firstly thanks for useful replies. I know, this programmatic operation is
clumsy but I don't know any way to reorganize my 3d model structure. So I am
trying to handle my model's components and then I will write the created
scene in osg format. Then I can traverse the scene easily.

I succeed placing the components on the right place by using InverseMatrix
like below,

--
   osg::ref_ptrosg::MatrixTransform
planetaryTransformNode1=dynamic_castosg::MatrixTransform*(planetarynode-getChild(0));
   osg::ref_ptrosg::MatrixTransform
planetaryTransformNode2=dynamic_castosg::MatrixTransform*(planetaryTransformNode1-getChild(0));

   osg::Matrixd mm1=planetaryTransformNode1-getInverseMatrix();
   osg::Matrixd mm2=planetaryTransformNode2-getInverseMatrix();

osg::ref_ptrosg::MatrixTransform additionalMT = new
osg::MatrixTransform(mm1 * mm2);

additionalMT-addChild(yawnode.get());

planetaryTransformNode2-addChild(additionalMT.get());
--

When I perform this way to the additive node's Matrix Trasform, it can place
right position on the screen.

In right there, I have some question about defining center to the newly
created MatrixTrasform node. Because when I try to rotate the yawnode around
the Zup axes, it is rotating around the vec3(0.0,0.0;0.0) pivot point. If I
use a PositionAttitudeTrasform, I can define new pivot point easly but what
about MatrixTransform pivot point definitoin? And how can I get the GEODE
nodes world coordinate matrix to defining pivot point for the
MatrixTransform node?

Another question is, As you see from the structure of models, There is a 2
Matrix Transform (3DSPIVOTPOINT: Rotate and 3DSPIVOTPOINT: Translate
pivotpoint to (world) origin). My planned structure, I will add one
MatrixTrasform for every node. Is it comes with unexpected error or
defectiveness in the future?

Thanks to everyone :)

Best Regards.

Umit UZUN

2008/7/24 David Spilling [EMAIL PROTECTED]:

 If I understand your problem correctly, the general approach would be to
 compute the coordinate system matrix local to a group prior to a move (with
 computeWorldToLocal) - call it A - then to move the node, recompute the
 coordinate system in the new location - call this B - and apply the correct
 matrix - i.e. inverse(B) * A -  to the immediate parent transform to get the
 correct positioning. In this way, when moving the object around in the
 scenegraph, it won't move in the world frame.

 In this case, the yaw group doesn't have a parent transform, so the initial
 matrix is the identity. The destination matrix will be the transform of
 planetary's MatrixTransform node, so you will need to apply the inverse of
 this matrix to your yaw specific MatrixTransform.

 I can't help but think that you must be able to persuade your 3DS model to
 be in a much more useful structure - all this programmatic model hacking
 (although useful for understanding OSG) seems quite clumsy...

 Regards,

 David



 ___
 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] Running OSG application in Firefox

2008-07-24 Thread Ümit Uzun
Hi Rahul,

I have no idea about this operation but It is amazing think:) If you can get
success please notify us.
Good Luck.

Umit UZUN


2008/7/24 Rahul Jain [EMAIL PROTECTED]:

 Hi all ,
 I want to write a plugin so that i can embed my OSG application in
 Firefox browser.  Have any one tried this before ?  Please suggest me
 some pointers  to start with .
 cheers
 RJ
 ___
 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] how to release loaded model

2008-07-24 Thread su hu
Hi all.

I need to release loaded model and reload other model. I did as follow:


osgViewer::ViewerViewer;
osg::ref_ptrosg::Group root   =  new osg::Group;
osg::ref_ptrosg::Group ModelRoot =  new osg::Group;
osg::ref_ptrosg::Node loadedModel;
...
Viewer.setSceneData(root.get());
root-addChild(ModelRoot.get());
...

//in frame loop
.
switch(CMD)
{
case LOAD_SCENE:
{

loadedModel = osgDB::readNodeFile(CMD_SceneFileName);

if (loadedModel.valid())
{
ModelRoot-addChild(loadedModel.get());
}
break;
}
case RELEASE_SCENE:
{
if(ModelRoot.valid())
{
ModelRoot-removeChildren(0,ModelRoot-getNumChildren());
}

loadedModel.release();

break;
}

}

...

The loadedModel is added to ModelRoot and is not added to any other group.

Models could be loaded and released. But I found used memory was not
reduced at all after RELEASE_SCENE was executed.  After loading and
releasing several times, used memory is more than 1GB and program is
freezed.  I want to know the reason and how to improve it.

Much appreciation to any reply.


Regards,

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


Re: [osg-users] Running OSG application in Firefox

2008-07-24 Thread Kim C Bale
This was mentioned a while ago, search the forum for Problems with
osgViewer and ActiveX, there was a chap that was trying to do it in IE
so I presume you could get some relevant info from him.

Regards,

Kim.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rahul
Jain
Sent: 24 July 2008 10:21
To: OpenSceneGraph Users
Subject: [osg-users] Running OSG application in Firefox

Hi all ,
I want to write a plugin so that i can embed my OSG application in
Firefox browser.  Have any one tried this before ?  Please suggest me
some pointers  to start with .
cheers
RJ
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g*
To view the terms under which this email is distributed, please go to 
http://www.hull.ac.uk/legal/email_disclaimer.html
*___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Robert: I figured it out :-) (was: Is it possible to know when the node-graph is 'dirty'?)

2008-07-24 Thread Viggo Løvli

Hi Robert :-D
 
Thanx a lot for pointing in the right direction!!!
 
I can now enforce render-bin 10 to be rendered twice each frame with the needed 
stateset changes. No node-mask stuff is needed. This is a completely 
stand-alone fix :-)
 
This is what I did:
Camera is set up with a callback: 
camera.setPreDrawCallback( new MyCallback() );
 
The callback struct's operator () looks like this:
virtual void operator () (osg::RenderInfo renderInfo) const
{
osg::Camera* camera = renderInfo.getCurrentCamera();
if( !camera )
{
return;
}
 
osgViewer::Renderer* renderer = dynamic_castosgViewer::Renderer*( 
camera-getRenderer() );
if( !renderer )
{
return;
}
 
// HACK: This loop should not be here...
//   Need to figure out which scene-view that is used (0 or 1).
//   Renderer::draw() does it this way: sceneView = 
_drawQueue.takeFront()
//   _drawQueue is protected and not accessible through class 
methods.
//   This hack means we do the job below twice each frame.
//
for( int i=0; i2; i++ )
{
osgUtil::SceneView* sceneView = renderer-getSceneView( i );
if( !sceneView )
{
return;
}
 
osgUtil::RenderStage* renderStage = sceneView-getRenderStage();
if( !renderStage )
{
return;
}
 
osgUtil::RenderBin::RenderBinList binList = 
renderStage-getRenderBinList();
if( binList.find(10) != binList.end() )
{
// Clone bin 10
osgUtil::RenderBin* clonedBin = new osgUtil::RenderBin( 
*(binList[10].get()) );
 
// Clone the stateset
// TODO: Need to check that getStateSet does not return NULL.
osg::StateSet* stateSet = new osg::StateSet( 
*(clonedBin-getStateSet()) );
 
// Ensure the cloned stateset is used in the cloned bin
clonedBin-setStateSet( stateSet );
 
// Cloned bin shall not write to the depth-buffer
stateSet-setMode( GL_DEPTH_TEST, osg::StateAttribute::ON  | 
osg::StateAttribute::OVERRIDE );
stateSet-setAttributeAndModes( new 
osg::Depth(osg::Depth::LESS, 0.0, 1.0, false), osg::StateAttribute::ON | 
osg::StateAttribute::OVERRIDE );
 
// Ensure cloned bin is rendered before bin 10.
binList[9] = clonedBin;
}
}
}

 
I am not sure how to solve the 0..1 loop marked by // HACK: in the source. Do 
you know how I can know what SceneView that is used?
 
Do you see any other problems with this code?
 
Regards,
Viggo
 
 
 Date: Wed, 23 Jul 2008 15:01:50 +0100 From: [EMAIL PROTECTED] To: 
 osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Is it possible 
 to know when the node-graph is 'dirty'?  Hi Viggo,  I think you are on 
 totally wrong take w.r.t trying to track changes in the scene graph, for 
 what is effectively just a custom transparent renderbin setup, and has 
 little to do with the scene itself.  The way you should tackle it is to 
 customize the rendering backend so that the bins you require are built for 
 you. One one for instance would be to post process the RenderStage and its 
 contents after the CullVisitor has filled it in.  Robert. 
_
Windows Live Messenger - også på mobilen.
http://windowslivemobile.msn.com/Homepage.aspx?lang=nb-noocid=30032___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] OSG 2.4 and GCC 4.3

2008-07-24 Thread Robert Osfield
Hi Will,

Could you try out the svn trunk or one of the 2.5.5 release, as this
will have the most compile fixes in it.  We'll be releasing the stable
2.6 very soon, so what is in SVN is very close to stable state.  If
things don't compile perfectly under gcc 4.3 then please just send the
errors to the list and we can try to resolve them all before the
actual 2.6 release.

Robert.

On Wed, Jul 23, 2008 at 11:36 PM, Will Dicharry
[EMAIL PROTECTED] wrote:
 Hi,

 We are currently using OSG 2.2 in our projects.  I just moved to GCC 4.3 and
 am getting compile errors related to the stricter include rules that release
 implements.  I have seen some traffic in the archives discussing a possible
 fix in the 2.3 development series.  Did these fixes make it into 2.4?

 Thanks,
 Will

 ___
 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] osg::Image::update?

2008-07-24 Thread Robert Osfield
Hi Hartmut,

On Thu, Jul 24, 2008 at 3:10 AM, Hartmut Seichter
[EMAIL PROTECTED] wrote:
 I just realized the introduction of osg::Image::update(osg::NodeVisitor*)

 which is awsome (kindof - for now it just breaks the whole thing),

What do mean just breaks the whole thing?  Could you be very
specific.  It shouldn't change anything for conventional Texture/Image
usage.

 especially for osgART (http://osgart.org) ... I was wondering what your
 plans are with the implementation as the osgimagesequence is probably a work
 in progress

osgimagesequence is currently work in progress, it should be wrapped
up today though.  I have non paged and paged ImageSequence
functionality working, it just API refinement and better control of
looping.

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


Re: [osg-users] Slave Cameras projection matrices and aspect ratio

2008-07-24 Thread Robert Osfield
Hi Joseanibal,

Could you provide a Producer .cfg that you are having problem with.
Could you also please specify which versions of the OSG you've tried.

Robert.

On Thu, Jul 24, 2008 at 3:43 AM, Joseanibal Colon Ramos
[EMAIL PROTECTED] wrote:
 Hi Anyone,

 I need to fix this ASAP. I am using OSG 2.4+ with old Producer Config
 files. OSG creates slave cameras for my multiple window configuration (one
 for each). The resulting settings are not quite like specified in my
 configuration file. Field of Views are mostly OK, but it is altering the
 aspect ratios of the slave cams and providing me with an image slightly
 off from how it should be. I've tried setting the Slave cams' projection
 matrix, (setProjectionMatrixAsPerspective) with particular aspect ratios
 etc, but the aspect ratio value is being overriden somewhere and adjusted
 a little bit. However, the Master cam's aspect ratio is correct. How do I
 correctly set the Slave cam's aspect ratios?? and Why are the Producer
 Configuration files not doing what they used to in OSG 1.2  ?? Anyone
 please let me know soon, THANKS!

 -JCOLON


 ___
 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 to release loaded model

2008-07-24 Thread Robert Osfield
Hi Su,

You shouldn't be called ref_ptr.release() in this context, you should
be just setting the ref_ptr to null.

ref_ptr::release() is a specialist helper method with does an
unref_noDelete on the referenced object - it deliberately doesn't
delete the object that it's unrefecing.  This functionality is
required for functions that use ref_ptr locally but then have to
pass a C* point of the object.

Robert.

On Thu, Jul 24, 2008 at 10:45 AM, su hu [EMAIL PROTECTED] wrote:
 Hi all.

 I need to release loaded model and reload other model. I did as follow:


 osgViewer::ViewerViewer;
 osg::ref_ptrosg::Group root   =  new osg::Group;
 osg::ref_ptrosg::Group ModelRoot =  new osg::Group;
 osg::ref_ptrosg::Node loadedModel;
 ...
 Viewer.setSceneData(root.get()
 );
 root-addChild(ModelRoot.get());
 ...

 //in frame loop
 .
 switch(CMD)
 {
 case LOAD_SCENE:
 {

 loadedModel = osgDB::readNodeFile(CMD_SceneFileName);

 if (loadedModel.valid())
 {
 ModelRoot-addChild(loadedModel.get());
 }
 break;
 }
 case RELEASE_SCENE:
 {
 if(ModelRoot.valid())
 {
 ModelRoot-removeChildren(0,ModelRoot-getNumChildren());
 }

 loadedModel.release();

 break;
 }

 }

 ...

 The loadedModel is added to ModelRoot and is not added to any other group.

 Models could be loaded and released. But I found used memory was not
 reduced at all after RELEASE_SCENE was executed.  After loading and
 releasing several times, used memory is more than 1GB and program is
 freezed.  I want to know the reason and how to improve it.

 Much appreciation to any reply.


 Regards,

 Su Hu
 ___
 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] Robert: I figured it out :-) (was: Is it possible to know when the node-graph is 'dirty'?)

2008-07-24 Thread Robert Osfield
Hi Viggo,

I'd do this trick using a CullCallback on the topmost node of sub
graph that you won't to repeat rather than a pre draw callback.  The
CullVisitor keeps track of the current RenderStage.

Robert.

On Thu, Jul 24, 2008 at 10:53 AM, Viggo Løvli [EMAIL PROTECTED] wrote:
 Hi Robert :-D

 Thanx a lot for pointing in the right direction!!!

 I can now enforce render-bin 10 to be rendered twice each frame with the
 needed stateset changes. No node-mask stuff is needed. This is a completely
 stand-alone fix :-)

 This is what I did:
 Camera is set up with a callback:
 camera.setPreDrawCallback( new MyCallback() );

 The callback struct's operator () looks like this:

 virtual void operator () (osg::RenderInfo renderInfo) const

 {

 osg::Camera* camera = renderInfo.getCurrentCamera();

 if( !camera )

 {

 return;

 }



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

 if( !renderer )

 {

 return;

 }



 // HACK: This loop should not be here...

 //   Need to figure out which scene-view that is used (0 or 1).

 //   Renderer::draw() does it this way: sceneView =
 _drawQueue.takeFront()

 //   _drawQueue is protected and not accessible through class
 methods.

 //   This hack means we do the job below twice each frame.

 //

 for( int i=0; i2; i++ )

 {

 osgUtil::SceneView* sceneView = renderer-getSceneView( i );

 if( !sceneView )

 {

 return;

 }



 osgUtil::RenderStage* renderStage = sceneView-getRenderStage();

 if( !renderStage )

 {

 return;

 }



 osgUtil::RenderBin::RenderBinList binList =
 renderStage-getRenderBinList();

 if( binList.find(10) != binList.end() )

 {

 // Clone bin 10

 osgUtil::RenderBin* clonedBin = new osgUtil::RenderBin(
 *(binList[10].get()) );



 // Clone the stateset

 // TODO: Need to check that getStateSet does not return
 NULL.

 osg::StateSet* stateSet = new osg::StateSet(
 *(clonedBin-getStateSet()) );



 // Ensure the cloned stateset is used in the cloned bin

 clonedBin-setStateSet( stateSet );



 // Cloned bin shall not write to the depth-buffer

 stateSet-setMode( GL_DEPTH_TEST, osg::StateAttribute::ON  |
 osg::StateAttribute::OVERRIDE );

 stateSet-setAttributeAndModes( new
 osg::Depth(osg::Depth::LESS, 0.0, 1.0, false), osg::StateAttribute::ON |
 osg::StateAttribute::OVERRIDE );



 // Ensure cloned bin is rendered before bin 10.

 binList[9] = clonedBin;

 }

 }

 }


 I am not sure how to solve the 0..1 loop marked by // HACK: in the source.
 Do you know how I can know what SceneView that is used?

 Do you see any other problems with this code?

 Regards,
 Viggo




 Date: Wed, 23 Jul 2008 15:01:50 +0100
 From: [EMAIL PROTECTED]
 To: osg-users@lists.openscenegraph.org
 Subject: Re: [osg-users] Is it possible to know when the node-graph is
 'dirty'?

 Hi Viggo,

 I think you are on totally wrong take w.r.t trying to track changes in
 the scene graph, for what is effectively just a custom transparent
 renderbin setup, and has little to do with the scene itself.

 The way you should tackle it is to customize the rendering backend so
 that the bins you require are built for you. One one for instance
 would be to post process the RenderStage and its contents after the
 CullVisitor has filled it in.

 Robert.



 
 Windows Live Hotmail på mobilen. Ha alltid e-posten din tilgjengelig.
 ___
 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 to release loaded model

2008-07-24 Thread su hu
Hi Robert,

I set ref_ptr to null. It works well. Thanks a lot.

Best Regards,

Su Hu

2008/7/24 Robert Osfield [EMAIL PROTECTED]:

 Hi Su,

 You shouldn't be called ref_ptr.release() in this context, you should
 be just setting the ref_ptr to null.

 ref_ptr::release() is a specialist helper method with does an
 unref_noDelete on the referenced object - it deliberately doesn't
 delete the object that it's unrefecing.  This functionality is
 required for functions that use ref_ptr locally but then have to
 pass a C* point of the object.

 Robert.

 On Thu, Jul 24, 2008 at 10:45 AM, su hu [EMAIL PROTECTED] wrote:
  Hi all.
 
  I need to release loaded model and reload other model. I did as follow:
 
 
  osgViewer::ViewerViewer;
  osg::ref_ptrosg::Group root   =  new osg::Group;
  osg::ref_ptrosg::Group ModelRoot =  new osg::Group;
  osg::ref_ptrosg::Node loadedModel;
  ...
  Viewer.setSceneData(root.get()
  );
  root-addChild(ModelRoot.get());
  ...
 
  //in frame loop
  .
  switch(CMD)
  {
  case LOAD_SCENE:
  {
 
  loadedModel = osgDB::readNodeFile(CMD_SceneFileName);
 
  if (loadedModel.valid())
  {
  ModelRoot-addChild(loadedModel.get());
  }
  break;
  }
  case RELEASE_SCENE:
  {
  if(ModelRoot.valid())
  {
  ModelRoot-removeChildren(0,ModelRoot-getNumChildren());
  }
 
  loadedModel.release();
 
  break;
  }
 
  }
 
  ...
 
  The loadedModel is added to ModelRoot and is not added to any other
 group.
 
  Models could be loaded and released. But I found used memory was not
  reduced at all after RELEASE_SCENE was executed.  After loading and
  releasing several times, used memory is more than 1GB and program is
  freezed.  I want to know the reason and how to improve it.
 
  Much appreciation to any reply.
 
 
  Regards,
 
  Su Hu
  ___
  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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] how to release loaded model

2008-07-24 Thread su hu
Hi Ümit

Thanks for you suggestion. There are several scene models in our application
and they are large. So we have to release them when we start a new scene.

Thanks again.

Kind Regards,

Su Hu

2008/7/24 Ümit Uzun [EMAIL PROTECTED]:

 Hi Su,

 I think you shoul use Switch node to change the model. It is so easy and
 useful. Look at the simple example.

 2008/7/24 su hu [EMAIL PROTECTED]:

 Hi all.

 I need to release loaded model and reload other model. I did as follow:


 osgViewer::ViewerViewer;
 osg::ref_ptrosg::Group root   =  new osg::Group;
 osg::ref_ptrosg::Group ModelRoot =  new osg::Group;
 osg::ref_ptrosg::Node loadedModel;
 ...
 Viewer.setSceneData(root.get());
 root-addChild(ModelRoot.get());
 ...

 //in frame loop
 .
 switch(CMD)
 {
 case LOAD_SCENE:
 {

 loadedModel = osgDB::readNodeFile(CMD_SceneFileName);

 if (loadedModel.valid())
 {
 ModelRoot-addChild(loadedModel.get());
 }
 break;
 }
 case RELEASE_SCENE:
 {
 if(ModelRoot.valid())
 {
 ModelRoot-removeChildren(0,ModelRoot-getNumChildren());
 }

 loadedModel.release();

 break;
 }

 }

 ...

 The loadedModel is added to ModelRoot and is not added to any other
 group.

 Models could be loaded and released. But I found used memory was not
 reduced at all after RELEASE_SCENE was executed.  After loading and
 releasing several times, used memory is more than 1GB and program is
 freezed.  I want to know the reason and how to improve it.

 Much appreciation to any reply.


 Regards,

 Su Hu

 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] New feature : osgconv --plugins and --formats ReaderWriter::supported*() API

2008-07-24 Thread Robert Osfield
Hi All,

I have just added some further options into osgconv, --format and
--plugin, which allow you to query the details on a specific plugin
i.e.

 osgconv --format obj

Will report:

Plugin osgPlugins-2.5.6/osgdb_obj.so
{
   ReaderWriter : Wavefront OBJ Reader
   {
   extensions : .objAlias Wavefront OBJ format
   options: noRotation  Do not do the default
rotate about X axis
   options: noTesselateLargePolygonsDo not do the default
tesselation of large polygons
   options: noTriStripPolygons  Do not do the default
tri stripping of polygons
   }
}

Tabbing doesn't look so good in email client... better in the console ;-)

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


Re: [osg-users] Robert: I figured it out :-) (was: Is it possible to know when the node-graph is 'dirty'?)

2008-07-24 Thread Viggo Løvli

Hi Robert,
 
I followed your advice added the code into the traverse function of my root 
node. 
Much of the code could now be removed,  and I got rid of the 0..1 loop-hack 
that I had to do earlier.
 
I think the new code looks very good. Do you see anything you would do 
differently?
 
The new code looks like this:
void MyRootNodeClass::traverse( osg::NodeVisitor nv )
{
osg::Group::traverse( nv );
 
// Clone render-bin 10 if this is a cull visitor
if( nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR )
{
osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*( nv );
if( cv )
{
// Act if we have a RenderStage pointer
if( osgUtil::RenderStage* renderStage = cv-getRenderStage() )
{
// Get the render-bin list
osgUtil::RenderBin::RenderBinList binList = 
renderStage-getRenderBinList();
if( binList.find(10) != binList.end() )
{
// Clone bin 10
osgUtil::RenderBin* clonedBin = new osgUtil::RenderBin( 
*(binList[10].get()) );
 
// Clone the state-set
osg::StateSet* originalStateSet = clonedBin-getStateSet();
osg::StateSet* stateSet = (originalStateSet) ? new 
osg::StateSet( *(originalStateSet) ) : new osg::StateSet();
 
// Ensure the cloned state-set is used in the cloned bin
clonedBin-setStateSet( stateSet );
 
// Cloned bin shall not write to the depth-buffer
stateSet-setMode( GL_DEPTH_TEST, osg::StateAttribute::ON  
| osg::StateAttribute::OVERRIDE );
stateSet-setAttributeAndModes( new 
osg::Depth(osg::Depth::LESS, 0.0, 1.0, false), osg::StateAttribute::ON | 
osg::StateAttribute::OVERRIDE );
 
// Ensure cloned bin is rendered before bin 10.
binList[9] = clonedBin;
}
}
}
}
}

 
Regards,
Viggo Date: Thu, 24 Jul 2008 11:19:21 +0100 From: [EMAIL PROTECTED] To: 
osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Robert: I figured 
it out :-) (was: Is it possible to know when the node-graph is 'dirty'?)  Hi 
Viggo,  I'd do this trick using a CullCallback on the topmost node of sub 
graph that you won't to repeat rather than a pre draw callback. The 
CullVisitor keeps track of the current RenderStage.  Robert. 
_
Hold kontakten med Windows Live Messenger.
http://clk.atdmt.com/GBL/go/msnnkdre001003gbl/direct/01/___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Render to texture and ClearColor

2008-07-24 Thread David _

Hi

i´m currently rendering to a texture using a slave camera

my problem is that i can´t set the clear color to alpha. Each time the slave 
camera renders a new frame i get a nice blue background instead of the 
transparent background i´m looking for

i´ve tried with values of 0.0, 0.5 add 1.0 for alpha

camera-setClearMask( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

 camera-setClearColor(osg::Vec4(0.0f,0.0f,1.0f,0.0f));

camera-setColorMask(true, true, true, true);


i´ve created the texture2d attached to the camera from and osg::image with 
GL_RGBA and GL_UNSIGNED_BYTE formats and also i´ve tried by creating the 
texture2d with no parameters and setting later the 
texture-setInternalFormat(GL_RGBA)

any idea of what i´m doing wrong???

thanks in advance






_
Herramientas para combatir la crisis. MSN Dinero
http://dinero.es.msn.com/___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Robert: I figured it out :-) (was: Is it possible to know when the node-graph is 'dirty'?)

2008-07-24 Thread Robert Osfield
Hi Viggo,

You could possible experiment with reuse the bin rather than cloning
it.  Inserting a two bins for bin 9 and 10, then have the original
transparent bin nested within them. I can't recall the exact details
but I think I've tried a trick like this in the past.  This would also
allow you to reuse a fixed StateSet on every frame rather than
creating one.

Robert.

On Thu, Jul 24, 2008 at 12:41 PM, Viggo Løvli [EMAIL PROTECTED] wrote:
 Hi Robert,

 I followed your advice added the code into the traverse function of my root
 node.
 Much of the code could now be removed,  and I got rid of the 0..1
 loop-hack that I had to do earlier.

 I think the new code looks very good. Do you see anything you would do
 differently?

 The new code looks like this:

 void MyRootNodeClass::traverse( osg::NodeVisitor nv )

 {

 osg::Group::traverse( nv );



 // Clone render-bin 10 if this is a cull visitor

 if( nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR )

 {

 osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*( nv
 );

 if( cv )

 {

 // Act if we have a RenderStage pointer

 if( osgUtil::RenderStage* renderStage = cv-getRenderStage() )

 {

 // Get the render-bin list

 osgUtil::RenderBin::RenderBinList binList =
 renderStage-getRenderBinList();

 if( binList.find(10) != binList.end() )

 {

 // Clone bin 10

 osgUtil::RenderBin* clonedBin = new osgUtil::RenderBin(
 *(binList[10].get()) );



 // Clone the state-set

 osg::StateSet* originalStateSet =
 clonedBin-getStateSet();

 osg::StateSet* stateSet = (originalStateSet) ? new
 osg::StateSet( *(originalStateSet) ) : new osg::StateSet();



 // Ensure the cloned state-set is used in the cloned bin

 clonedBin-setStateSet( stateSet );



 // Cloned bin shall not write to the depth-buffer

 stateSet-setMode( GL_DEPTH_TEST,
 osg::StateAttribute::ON  | osg::StateAttribute::OVERRIDE );

 stateSet-setAttributeAndModes( new
 osg::Depth(osg::Depth::LESS, 0.0, 1.0, false), osg::StateAttribute::ON |
 osg::StateAttribute::OVERRIDE );



 // Ensure cloned bin is rendered before bin 10.

 binList[9] = clonedBin;

 }

 }

 }

 }

 }


 Regards,
 Viggo

 Date: Thu, 24 Jul 2008 11:19:21 +0100

 From: [EMAIL PROTECTED]
 To: osg-users@lists.openscenegraph.org
 Subject: Re: [osg-users] Robert: I figured it out :-) (was: Is it possible
 to know when the node-graph is 'dirty'?)

 Hi Viggo,

 I'd do this trick using a CullCallback on the topmost node of sub
 graph that you won't to repeat rather than a pre draw callback. The
 CullVisitor keeps track of the current RenderStage.

 Robert.



 
 Få Hotmail du også. Windows Live Hotmail nå med 5000 MB gratis
 lagringsplass.
 ___
 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] Render to texture and ClearColor

2008-07-24 Thread Robert Osfield
Dous you FBO have an alpha channel

On Thu, Jul 24, 2008 at 12:42 PM, David _ [EMAIL PROTECTED] wrote:
 Hi

 i´m currently rendering to a texture using a slave camera

 my problem is that i can´t set the clear color to alpha. Each time the slave
 camera renders a new frame i get a nice blue background instead of the
 transparent background i´m looking for

 i´ve tried with values of 0.0, 0.5 add 1.0 for alpha

 camera-setClearMask( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
 camera-setClearColor(osg::Vec4(0.0f,0.0f,1.0f,0.0f));
 camera-setColorMask(true, true, true, true);

 i´ve created the texture2d attached to the camera from and osg::image with
 GL_RGBA and GL_UNSIGNED_BYTE formats and also i´ve tried by creating the
 texture2d with no parameters and setting later the
 texture-setInternalFormat(GL_RGBA)

 any idea of what i´m doing wrong???

 thanks in advance






 
 ¿Quieres los emoticonos y guiños más divertidos? Descárgate Internet
 Explorer 7, y consigue contenidos exclusivos cada semana. ¡Gratis! ¿Quieres
 los emoticonos y guiños más divertidos?
 ___
 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] Render to texture and ClearColor

2008-07-24 Thread David _

ok, i solved it with this instruction

camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

don´t know what it exactly does, but it´s working now as i want it to.  

An explanation of what this isntruction do will be welcome

thanks



 Date: Thu, 24 Jul 2008 12:53:07 +0100
 From: [EMAIL PROTECTED]
 To: osg-users@lists.openscenegraph.org
 Subject: Re: [osg-users] Render to texture and ClearColor
 
 Dous you FBO have an alpha channel
 
 On Thu, Jul 24, 2008 at 12:42 PM, David _ [EMAIL PROTECTED] wrote:
  Hi
 
  i´m currently rendering to a texture using a slave camera
 
  my problem is that i can´t set the clear color to alpha. Each time the slave
  camera renders a new frame i get a nice blue background instead of the
  transparent background i´m looking for
 
  i´ve tried with values of 0.0, 0.5 add 1.0 for alpha
 
  camera-setClearMask( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
  camera-setClearColor(osg::Vec4(0.0f,0.0f,1.0f,0.0f));
  camera-setColorMask(true, true, true, true);
 
  i´ve created the texture2d attached to the camera from and osg::image with
  GL_RGBA and GL_UNSIGNED_BYTE formats and also i´ve tried by creating the
  texture2d with no parameters and setting later the
  texture-setInternalFormat(GL_RGBA)
 
  any idea of what i´m doing wrong???
 
  thanks in advance
 
 
 
 
 
 
  
  ¿Quieres los emoticonos y guiños más divertidos? Descárgate Internet
  Explorer 7, y consigue contenidos exclusivos cada semana. ¡Gratis! ¿Quieres
  los emoticonos y guiños más divertidos?
  ___
  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

_
Hazte tu propia televisión a la carta. Música, noticias, estrenos, cine, humor 
y viajes en MSN Vídeo
http://video.msn.com/?mkt=es-es___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Render to texture and ClearColor

2008-07-24 Thread David _

i guess i spoke too fast. I get transparency no, but it´s not exactly what i 
want

how do i know what kind of FBO i´m using???

From: [EMAIL PROTECTED]
To: osg-users@lists.openscenegraph.org
Date: Thu, 24 Jul 2008 14:00:56 +0200
Subject: Re: [osg-users] Render to texture and ClearColor








ok, i solved it with this instruction

camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

don´t know what it exactly does, but it´s working now as i want it to.  

An explanation of what this isntruction do will be welcome

thanks



 Date: Thu, 24 Jul 2008 12:53:07 +0100
 From: [EMAIL PROTECTED]
 To: osg-users@lists.openscenegraph.org
 Subject: Re: [osg-users] Render to texture and ClearColor
 
 Dous you FBO have an alpha channel
 
 On Thu, Jul 24, 2008 at 12:42 PM, David _ [EMAIL PROTECTED] wrote:
  Hi
 
  i´m currently rendering to a texture using a slave camera
 
  my problem is that i can´t set the clear color to alpha. Each time the slave
  camera renders a new frame i get a nice blue background instead of the
  transparent background i´m looking for
 
  i´ve tried with values of 0.0, 0.5 add 1.0 for alpha
 
  camera-setClearMask( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
  camera-setClearColor(osg::Vec4(0.0f,0.0f,1.0f,0.0f));
  camera-setColorMask(true, true, true, true);
 
  i´ve created the texture2d attached to the camera from and osg::image with
  GL_RGBA and GL_UNSIGNED_BYTE formats and also i´ve tried by creating the
  texture2d with no parameters and setting later the
  texture-setInternalFormat(GL_RGBA)
 
  any idea of what i´m doing wrong???
 
  thanks in advance
 
 
 
 
 
 
  
  ¿Quieres los emoticonos y guiños más divertidos? Descárgate Internet
  Explorer 7, y consigue contenidos exclusivos cada semana. ¡Gratis! ¿Quieres
  los emoticonos y guiños más divertidos?
  ___
  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

¡Atrévete con Abecedario, el juego del momento! Invita a tus contactos de 
Messenger y demuéstrales lo que sabes demuéstrales lo que sabes

_
Tu mejor plan para el fin de semana y toda la actualidad del mundo del corazón. 
Entra en MSN Entretenimiento
http://entretenimiento.es.msn.com/___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Freetype Plugin not found

2008-07-24 Thread Ariasgore
I have already read about cmakes problem when it comes to freetype, but I 
checked my osgPlugins-2.4.0 folder, there is a osg_freetyped.dll in it. 
Whilte trying to load a file, I get the  Warning: Could not find plugin to 
read objects from file ...
I recompiled osg_freetyped.dll and also a freetype.dll from 2.3.7 source, 
put that into output directory.
Basically I can load png files, so the folders are found but not with 
freetype.
I set OSG_NOTIFY_LEVEL to DEBUG but unfortunately didnt get more error 
messages :/
My suspicition is that there is something wrong rather with 
osg_freetyped.dll than with freetype.dll itself because if osg cannot locate 
the osg_x.dll I get the warning from above, but if the plugin itself is 
missing - eg. libpngd.dll I get an additional windows error which is here 
not present.


Thanks 


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


[osg-users] transparency becomes dark

2008-07-24 Thread Dieter Pfeffer
Hi


I am trying to set the object transparency from 1.0 - 0.0 and vice versa;
but when I start changing the alpha of the material the object becomes dark.

I have changed the material parameters but without success; when I look in
the loaded model (for example cow.osg) for material, the material is always
null.

I have modified the osgviewer example and attached it.

Could s.o. give me a hint what I am doing wrong ?


Thanks

Dieter



Unclassified Mail



Disclaimer:

This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please 
notify the sender and delete this e-mail. Any unauthorized copying, disclosure
or distribution of the material in this e-mail is strictly forbidden.

Considering the inherent risks of the use of e-mail communication, 
Thales Nederland BV shall not be liable for any damage derived from it. 

Thales Nederland BV is seated in Hengelo (Ov.), the Netherlands, 
and registered at the Chamber of Commerce under number 06061578.

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
 *
 * This application is open source and may be redistributed and/or modified   
 * freely and without restriction, both in commericial and non commericial 
applications,
 * as long as this copyright notice is maintained.
 * 
 * This application 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.
*/

#include osgDB/ReadFile
#include osgUtil/Optimizer
#include osg/CoordinateSystemNode

#include osg/Switch
#include osgText/Text

#include osgViewer/Viewer
#include osgViewer/ViewerEventHandlers

#include osgGA/TrackballManipulator
#include osgGA/FlightManipulator
#include osgGA/DriveManipulator
#include osgGA/KeySwitchMatrixManipulator
#include osgGA/StateSetManipulator
#include osgGA/AnimationPathManipulator
#include osgGA/TerrainManipulator
#include osg/Material
#include osg/BlendFunc 
#include iostream


int doAlpha;
float currentAlpha;
osg::ref_ptrosg::Node loadedModel;

void  setAlpha()
{
if ( doAlpha == 1)
 currentAlpha +=.01;
if  ( doAlpha == 2)
 currentAlpha -=.01;
 
if (loadedModel.valid())
{
osg::StateSet *ss = loadedModel -getOrCreateStateSet();
 
osg::Material* blendMaterial = 0;
 
blendMaterial = 
(osg::Material*)(ss-getAttribute(osg::StateAttribute::MATERIAL));

if(blendMaterial ==0)
{
blendMaterial = new osg::Material();
  
}
 
if (doAlpha == 1)
{
if (currentAlpha 1.0)
{
blendMaterial-setAlpha( 
osg::Material::FRONT_AND_BACK, currentAlpha);
 
}
else
{
blendMaterial-setAlpha( 
osg::Material::FRONT_AND_BACK, 1.0);
doAlpha = 0;
}
}
else if (doAlpha == 2)
{
if (currentAlpha   .0)
{
blendMaterial-setAlpha( 
osg::Material::FRONT_AND_BACK, currentAlpha);
}
else
{
blendMaterial-setAlpha( 
osg::Material::FRONT_AND_BACK, 0.0);
doAlpha = 0;
}
}
osg::BlendFunc *bl = new osg::BlendFunc();
bl-setFunction(osg::BlendFunc::SRC_ALPHA, 
osg::BlendFunc::ONE_MINUS_SRC_ALPHA); 
 
ss-setAttributeAndModes(bl, osg::StateAttribute::ON 
|osg::StateAttribute::OVERRIDE);
 
ss-setMode(GL_BLEND, osg::StateAttribute::ON 
|osg::StateAttribute::OVERRIDE);
ss-setAttributeAndModes(blendMaterial ,osg::StateAttribute::ON 
|osg::StateAttribute::OVERRIDE);
ss-setRenderingHint(osg::StateSet::TRANSPARENT_BIN);

loadedModel-setStateSet( ss );  // not neccessary
 
if (currentAlpha =1 )
{
 doAlpha = 0;

 ss-setMode(GL_BLEND, osg::StateAttribute::OFF);
 
ss-setAttributeAndModes(blendMaterial,osg::StateAttribute::OFF);
}
if (currentAlpha  0)
 doAlpha = 1;
 
}
}
int main(int argc, char** argv)
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(argc,argv);


arguments.getApplicationUsage()-setApplicationName(arguments.getApplicationName());


Re: [osg-users] Freetype Plugin not found

2008-07-24 Thread Ariasgore

I got the following output for the freetype dll, which is somehow confusing:

'05. Text.exe': Loaded 'osgPlugins-2.4.0\osgdb_freetyped.dll', Symbols 
loaded.
LDR: LdrpWalkImportDescriptor() failed to probe 
osgPlugins-2.4.0\osgdb_freetyped.dll for its manifest, ntstatus 0xc0150002

'05. Text.exe': Unloaded osgPlugins-2.4.0\osgdb_freetyped.dll'

Whats that? a dynamic linked library without an manifest? 


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


Re: [osg-users] Freetype Plugin not found

2008-07-24 Thread Gordon Tomlinson

Are you using Visual Studio 2005 ? 

You can get this type message if you have VS2005 installed but not the
VS2005 SP! patch 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ariasgore
Sent: Thursday, July 24, 2008 8:42 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Freetype Plugin not found

I got the following output for the freetype dll, which is somehow confusing:

'05. Text.exe': Loaded 'osgPlugins-2.4.0\osgdb_freetyped.dll', Symbols
loaded.
LDR: LdrpWalkImportDescriptor() failed to probe
osgPlugins-2.4.0\osgdb_freetyped.dll for its manifest, ntstatus 0xc0150002
'05. Text.exe': Unloaded osgPlugins-2.4.0\osgdb_freetyped.dll'

Whats that? a dynamic linked library without an manifest? 

___
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] Freetype Plugin not found

2008-07-24 Thread Gordon Tomlinson
Also make sure in your projects that the manifests are being embedded the
doe need to be imbedded

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ariasgore
Sent: Thursday, July 24, 2008 8:42 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Freetype Plugin not found

I got the following output for the freetype dll, which is somehow confusing:

'05. Text.exe': Loaded 'osgPlugins-2.4.0\osgdb_freetyped.dll', Symbols
loaded.
LDR: LdrpWalkImportDescriptor() failed to probe
osgPlugins-2.4.0\osgdb_freetyped.dll for its manifest, ntstatus 0xc0150002
'05. Text.exe': Unloaded osgPlugins-2.4.0\osgdb_freetyped.dll'

Whats that? a dynamic linked library without an manifest? 

___
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 to release loaded model

2008-07-24 Thread Jean-Sébastien Guay

Hello Robert,


ref_ptr::release() is a specialist helper method with does an
unref_noDelete on the referenced object - it deliberately doesn't
delete the object that it's unrefecing.  This functionality is
required for functions that use ref_ptr locally but then have to
pass a C* point of the object.


I have seen this confusion before from people used to Win32 
programming... In MFC (I believe), calling release() on something means 
you don't want to use it anymore, and you want it to release its 
resources (kind of like calling delete on a pointer, but it's a C API so 
there are no destructors, hence the release() function). So it means 
exactly the opposite of what it means in OSG.


Kind of ironic, but perhaps that just means that people need to read the 
API documentation a bit before using a method in their code, because it 
might not do what they assume it does.


J-S
--
__
Jean-Sebastien Guay[EMAIL PROTECTED]
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Freetype Plugin not found

2008-07-24 Thread Ariasgore

Hello,
I am always using VS 2008 (which is 9.0)
I have read about that problem, the manifest is included, everything is 
compiled on the same machine with the same VS Version.
BUT I found a weird solution to this on this page - 
http://forums.msdn.microsoft.com/en-US/vcgeneral/thread/3f2869ca-2c07-49a8-a443-52720b10ea09/
I set the manifest ID to 1 (was 2) after compiling the dll and that worked! 
I actually do not understand why and am exploring this situation.


--
From: Gordon Tomlinson [EMAIL PROTECTED]
Sent: Thursday, July 24, 2008 2:49 PM
To: 'OpenSceneGraph Users' osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Freetype Plugin not found


Also make sure in your projects that the manifests are being embedded the
doe need to be imbedded

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ariasgore
Sent: Thursday, July 24, 2008 8:42 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Freetype Plugin not found

I got the following output for the freetype dll, which is somehow 
confusing:


'05. Text.exe': Loaded 'osgPlugins-2.4.0\osgdb_freetyped.dll', Symbols
loaded.
LDR: LdrpWalkImportDescriptor() failed to probe
osgPlugins-2.4.0\osgdb_freetyped.dll for its manifest, ntstatus 0xc0150002
'05. Text.exe': Unloaded osgPlugins-2.4.0\osgdb_freetyped.dll'

Whats that? a dynamic linked library without an manifest?

___
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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Robert: I figured it out :-) (was: Is it possible to know when the node-graph is 'dirty'?)

2008-07-24 Thread Viggo Løvli

Hi Robert,
 
I have changed the code a bit.
 
Now I create my statset (_myPreCreatedStateSet) at class construction.
I no longer clone bin 10.
I now only do this inside the inner check:
 
if( binList.find(10) != binList.end() )
{
binList[9] = new osgUtil::RenderBin();
binList[9]-setStateSet( _myPreCreatedStateSet );
(binList[9]-getRenderBinList())[9] = binList[10];
}

 
The only thing that annoy me now is the call to new().
Creating one bin as a member variable in my class and using it instead of the 
call to new cause the system to crash. Double buffering I guess.
So maybe I can fix this by having two RenderBin instances in my class, and use 
them every other call?
 
But, I suspect that it may not be enough? Would I need two per cull call that 
is ran per frame? Say that I in the future render with 4 different cameras and 
cull the world 4 times. Would I then need 4*2 bin instances to use instead of 
calling new()?
 
 
Regards,
Viggo
 Date: Thu, 24 Jul 2008 12:52:06 +0100 From: [EMAIL PROTECTED] To: 
 osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Robert: I 
 figured it out :-) (was: Is it possible to know when the node-graph is 
 'dirty'?)  Hi Viggo,  You could possible experiment with reuse the bin 
 rather than cloning it. Inserting a two bins for bin 9 and 10, then have the 
 original transparent bin nested within them. I can't recall the exact 
 details but I think I've tried a trick like this in the past. This would 
 also allow you to reuse a fixed StateSet on every frame rather than 
 creating one.  Robert. 
_
Windows Live Messenger - også på mobilen.
http://windowslivemobile.msn.com/Homepage.aspx?lang=nb-noocid=30032___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Shapefiles Coordinate System Conversions

2008-07-24 Thread Greg Myers
Hello all,

 

I am brand new to OSG and I am still wading through all the information and
examples learning as much as I can.  I am working on my latest exercise in
which I am overylaying a shapefile onto a terrain database that I have.  The
shapefile consists of bodies of water (lakes) in California.  I created the
terrain database using osgdem and some DTED data that I have for a small
portion of California.  I know that the shapefile consists of lat, lon,
height data ( thanks to osgconv ) and I wanted to convert those data to
x,y,z coordinates in the coordinate system of the terrain.  I did this by
using a node visitor for the shapefile node after reading it in with
readNodeFile.  I accessed the ArrayData via the Geode instance and then
looped through the data using the ellipsoid model from the terrain's
coordinate system to convert the lat,long,height data.  Then all I had to do
was the overlay stuff and add it to the root node.

 

Anyway, what I really want to know is if there is a better solution for
converting the lat,long,height data or am I on track?

 

Any existing examples or code snippets would be much appreciated.

 

Thanks,

Greg

 

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


Re: [osg-users] New feature : osgconv --plugins and --formatsReaderWriter::supported*() API

2008-07-24 Thread Paul Martz
Hi Robert -- This change appears to have introduced a build problem on VS
2005...

PluginQuery.cpp
c:\osgdev\osg\applications\osgconv\pluginquery.cpp(149) : error C4716:
'osgDB::outputPluginDetails' : must return a value

Not sure whether you need this to return true or false, so I'll let you
submit the change.

Thanks, nice feature.
   -Paul


 Hi All,
 
 I have just added some further options into osgconv, --format 
 and --plugin, which allow you to query the details on a 
 specific plugin i.e.
 
  osgconv --format obj
 
 Will report:
 
 Plugin osgPlugins-2.5.6/osgdb_obj.so
 {
ReaderWriter : Wavefront OBJ Reader
{
extensions : .objAlias 
 Wavefront OBJ format
options: noRotation  Do not do the default
 rotate about X axis
options: noTesselateLargePolygonsDo not do the default
 tesselation of large polygons
options: noTriStripPolygons  Do not do the default
 tri stripping of polygons
}
 }
 
 Tabbing doesn't look so good in email client... better in the 
 console ;-)
 
 Robert.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce
negraph.org

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


Re: [osg-users] Robert: I figured it out :-) (was: Is it possible to know when the node-graph is 'dirty'?)

2008-07-24 Thread Robert Osfield
On Thu, Jul 24, 2008 at 3:08 PM, Viggo Løvli [EMAIL PROTECTED] wrote:
 The only thing that annoy me now is the call to new().
 Creating one bin as a member variable in my class and using it instead of
 the call to new cause the system to crash. Double buffering I guess.
 So maybe I can fix this by having two RenderBin instances in my class, and
 use them every other call?

 But, I suspect that it may not be enough? Would I need two per cull call
 that is ran per frame? Say that I in the future render with 4 different
 cameras and cull the world 4 times. Would I then need 4*2 bin instances to
 use instead of calling new()?

The OSG's rendering backend is both very dynamic (created on demand on
each frame) and flexible (it can be a huge range of bin
configurations, potentially different on each frame) and the threading
and multiple graphics context rendering are all thrown into this mix.
This makes reuse of data something you have to be very careful about,
in your case you'd either need to create on each new frame or
multi-buffer.

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


[osg-users] problems with checking for OpenGL extensions

2008-07-24 Thread Steffen Kim
Hi,

I've got another problem with using OpenGL-code in connection with 
OpenSceneGraph.

I have an OpenGL-API that I use in my OSG-application. This API won't work when 
there are some required OpenGl-extensions missing. Instead it will list the 
missing extensions. 
In my application it does just that because it cannot find some of them.

Strange thing is that when running the example-programs that came with the API 
outside of my program everything works just fine. Also according to OpenGL 
Extension Viewer my hardware should support these features.

I read that there is also an OSG-function to test on extensions but since I 
have no influence on the API I have to find out why its internal checks fail 
when used in my application.

Does anyone have an idea why these problems possibly occur and what I have to 
change or do about it to make it work?
I thought the provided extensions just depend on the graphics driver... is this 
wrong? Could there be some conflicts with the libraries I'm using?

If this already has been answered somewhere I'm sorry. I read through some 
posts concerning extensions but nothing seemed to fit to my problem.

Thanks in advance,
Steffen


___
Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage
kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=00

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


Re: [osg-users] Shapefiles Coordinate System Conversions

2008-07-24 Thread Robert Osfield
Hi Greg,

It sounds like you are on track.

At tip for geospatial data  - With the .shp plugin in SVN head, and
2.5.x dev series the plugin supports loaded the geometry as doubles
rather than the default of floats.  You can enable this by using the
ReaderWriter::Options object passed in with your readNodeFile call, on
this options object you set the options string via
options-setOptionString(double);

Loading the vertex data as double helps with precision tremendously,
but for rendering it totally kills performance as the graphics hard
can't handle doubles, so the OpenGL driver has to convert to floats on
each time you render the vertex data, so load the data, project into
the appropriate coordinates system, then place with a local orign with
a MatrixTransform above it to place it in its original place, and then
convert the vertex data to floats.  This way you can maintain a good
balance between precision and performance.

Robert.

On Thu, Jul 24, 2008 at 3:19 PM, Greg Myers [EMAIL PROTECTED] wrote:
 Hello all,



 I am brand new to OSG and I am still wading through all the information and
 examples learning as much as I can.  I am working on my latest exercise in
 which I am overylaying a shapefile onto a terrain database that I have.  The
 shapefile consists of bodies of water (lakes) in California.  I created the
 terrain database using osgdem and some DTED data that I have for a small
 portion of California.  I know that the shapefile consists of lat, lon,
 height data ( thanks to osgconv ) and I wanted to convert those data to
 x,y,z coordinates in the coordinate system of the terrain.  I did this by
 using a node visitor for the shapefile node after reading it in with
 readNodeFile.  I accessed the ArrayData via the Geode instance and then
 looped through the data using the ellipsoid model from the terrain's
 coordinate system to convert the lat,long,height data.  Then all I had to do
 was the overlay stuff and add it to the root node.



 Anyway, what I really want to know is if there is a better solution for
 converting the lat,long,height data or am I on track?



 Any existing examples or code snippets would be much appreciated.



 Thanks,

 Greg



 ___
 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] New feature : osgconv --plugins and --formatsReaderWriter::supported*() API

2008-07-24 Thread Robert Osfield
Thanks for the note, I've added in both a return true and a return false ;-)

On Thu, Jul 24, 2008 at 3:27 PM, Paul Martz [EMAIL PROTECTED] wrote:
 Hi Robert -- This change appears to have introduced a build problem on VS
 2005...

 PluginQuery.cpp
 c:\osgdev\osg\applications\osgconv\pluginquery.cpp(149) : error C4716:
 'osgDB::outputPluginDetails' : must return a value

 Not sure whether you need this to return true or false, so I'll let you
 submit the change.

 Thanks, nice feature.
   -Paul


 Hi All,

 I have just added some further options into osgconv, --format
 and --plugin, which allow you to query the details on a
 specific plugin i.e.

  osgconv --format obj

 Will report:

 Plugin osgPlugins-2.5.6/osgdb_obj.so
 {
ReaderWriter : Wavefront OBJ Reader
{
extensions : .objAlias
 Wavefront OBJ format
options: noRotation  Do not do the default
 rotate about X axis
options: noTesselateLargePolygonsDo not do the default
 tesselation of large polygons
options: noTriStripPolygons  Do not do the default
 tri stripping of polygons
}
 }

 Tabbing doesn't look so good in email client... better in the
 console ;-)

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

 ___
 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] problems with checking for OpenGL extensions

2008-07-24 Thread Robert Osfield
Hi Steffen,

To find out what extensions the OSG is seeing enable verbose debugging via:

   export OSG_NOTIFY_LEVEL=DEBUG
   osgviewer cow.osg

Then it'll list, among lots of other stuff, the extensions supported.

Robert.

On Thu, Jul 24, 2008 at 5:59 PM, Steffen Kim [EMAIL PROTECTED] wrote:
 Hi,

 I've got another problem with using OpenGL-code in connection with 
 OpenSceneGraph.

 I have an OpenGL-API that I use in my OSG-application. This API won't work 
 when there are some required OpenGl-extensions missing. Instead it will list 
 the missing extensions.
 In my application it does just that because it cannot find some of them.

 Strange thing is that when running the example-programs that came with the 
 API outside of my program everything works just fine. Also according to 
 OpenGL Extension Viewer my hardware should support these features.

 I read that there is also an OSG-function to test on extensions but since I 
 have no influence on the API I have to find out why its internal checks fail 
 when used in my application.

 Does anyone have an idea why these problems possibly occur and what I have to 
 change or do about it to make it work?
 I thought the provided extensions just depend on the graphics driver... is 
 this wrong? Could there be some conflicts with the libraries I'm using?

 If this already has been answered somewhere I'm sorry. I read through some 
 posts concerning extensions but nothing seemed to fit to my problem.

 Thanks in advance,
 Steffen


 ___
 Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage
 kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=00

 ___
 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] Default vertex shader

2008-07-24 Thread Denis Nikolskiy

Hello Jean-Sebastien,

I followed your advice. Everything works well. Thanks a lot for  
clarifying those things and for your help.


Denis

On Jul 23, 2008, at 4:58 AM, Jean-Sébastien Guay wrote:


Hello Denis,

When I added vertex shader, the object was not shadowed properly  
(with the same exact fragment shader). I suspect I'm doing  
something wrong with the texture coordinates in a vertex shader. I  
looked in ShadowMap.cpp, it has only fragment shaders. Do you know  
where can I find default vertex shader?


When you start using a shader for one part of the pipeline (vertex  
or fragment) you need to do everything that that part of the  
pipeline used to do (and which is needed by your rendering). In the  
case of shadows, you'll notice that the code in ShadowMap.cpp adds  
an osg::TexGen that calculates some texture coordinates for texture  
unit 1. But that's the fixed pipeline, so you will need to  
calculate texture coordinates for unit 1 as glTexGen would in your  
vertex shader now that it has replaced the fixed-function vertex  
processing.


Something like this should work, though you should probably have  
finer control over when these are calculated or not:


gl_TexCoord[1].s = dot( ecPosition, gl_EyePlaneS[1] );
gl_TexCoord[1].t = dot( ecPosition, gl_EyePlaneT[1] );
gl_TexCoord[1].p = dot( ecPosition, gl_EyePlaneR[1] );
gl_TexCoord[1].q = dot( ecPosition, gl_EyePlaneQ[1] );

Note that ecPosition is:

vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;

I also assume you're transforming your texture coordinates for  
texture unit 0 properly:


gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;

Just assigning gl_MultiTexCoord0 to gl_TexCoord[0] will work until  
you try to use a texture matrix (osg::TexMat)...


I highly recommend you get/read the Orange Book, as this is all  
given there. You can also download the ShaderGen program from  
3DLabs (now hosted on http://mew.cx/glsl since 3DLabs removed it  
from their site) which can generate shaders that emulate the fixed  
pipeline. Note that for speed, you should probably only use the  
features you need in your shaders, so I am not recommending that  
you generate a shader that does *all* of what the fixed pipeline  
would do... Just use what ShaderGen produces as a guide.


Hope this helps,

J-S
--
__
Jean-Sebastien Guay[EMAIL PROTECTED]
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users- 
openscenegraph.org




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


Re: [osg-users] Default vertex shader

2008-07-24 Thread Jean-Sébastien Guay

Hi Denis,

I followed your advice. Everything works well. Thanks a lot for 
clarifying those things and for your help.


Glad I could help,

J-S
--
__
Jean-Sebastien Guay[EMAIL PROTECTED]
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Slave Cameras projection matrices and aspect ratio

2008-07-24 Thread Joseanibal Colon Ramos
Thanks Robert,

Here is the Producer config file I am using:

***
Camera Camera-1
{
RenderSurface Window-1
{
 Visual  { SetSimple }
 Screen 0;
 WindowRect 0 30 426 341;
 Border on;
 InputRectangle -1.0 1.0 -1.0 1.0;
}

Offset {
   Rotate 42.4 0 1 0;
}
}

Camera Camera-2
{
RenderSurface Window-2
{
Visual  { SetSimple }
Screen 0;
WindowRect 426 30 426 341;
Border on;
 InputRectangle -1.0 1.0 -1.0 1.0;
}

Offset {
Rotate 0.0 0 1 0;
}
}


Camera Camera-3
{
RenderSurface Window-3
{
Visual  { SetSimple }
Screen 0;
WindowRect 852 30 426 341;
Border on;
 InputRectangle -1.0 1.0 -1.0 1.0;
}

Offset {
Rotate -42.4 0 1 0;
}
}


InputArea
{
RenderSurface Window-1 ;
RenderSurface Window-2 ;
RenderSurface Window-3 ;
}
***

I have tested and compared it with OSG 2.4 and OSG 1.2 with (very)
slightly different results. I need the results to be exactly the same as
in OSG 1.2.

My understanding is that the InputArea is no longer required, but is is
still there for backwards compatibility with OSG 1.2 . For each
RenderSurface block I used to have a Lens configuration block like this
one:
 Lens {
Perspective 42.4 45.0 1.0 100.0;
}
but I no longer use it because I set the parameters in my code as:

vwr.getCamera()-setProjectionMatrixAsPerspective(VerticalFOV, AspectRatio,
NearClip, FarClip);  //for the master cam.

I've tried doing it for each of the Slave cams as well:
vwr.getSlave(int i)._camera-setProjectionMat. (same thing) . but it
doesn't change anything.

In this example:
AspectRatio = 1.33
VerticalFOV = 42.4/AspectRatio
NearClip = doesn't matter right now
FarClip = doesn't matter right now




Whe I run my program (version OSG 2.4) I get the following runtime values:

Master cam: (fov, aspect, near, far)31.807951987997, 1.333, 0.02, 199.

Slave cam # 0 (fov, aspect, near, far): 31.8079530956935,
1.31249230769231, 305.702400933255, 70223.0343790709

Slave cam # 1 (fov, aspect, near, far): 31.8079530956935,
1.31249230769231, 443.807876894962, 43394.6435810508

Slave cam # 2 (fov, aspect, near, far): 31.8079530956935,
1.31249230769231, 292.024441391996, 54427.4475917436

You may ignore the Near/Far values. You can notice how the slave cams
manipulated the aspect ratio slightly. The VerticalFOV seems right.





When I run OSG 1.2 I get this:
(no master cam concept)

camera 0 FOV(h,v) = 42.4,31.808
 aspect_ratio : 1.36129

camera 1 FOV(h,v) = 42.4,31.808
 aspect_ratio : 1.36129

camera 2 FOV(h,v) = 42.4,31.808
 aspect_ratio : 1.36129

I don't know how the aspect ration became that value either, because the
aspect ratio should have been forced to 1.33. Anyways this works fine.

I'd like to get the OSG 1.2 results, although none of these numbers quite
make sense to me, and the corresponding values of each version are very
close. I'll also provide the projection matrices which are a bit off as
well:

OSG2.4:
Slave cam 0:
projectionMatrix : {
2.67399874028772 0 0 0
0 3.50960277740655 0 0
0 0 -1.00874468153415 -1
0 0 -614.078072006898 0
}
Slave cam 1:
projectionMatrix : {
2.67399874028772 0 0 0
0 3.50960277740655 0 0
0 0 -1.02066585525608 -1
0 0 -896.787423135345 0
}
Slave cam2:
projectionMatrix : {
2.67399874028772 0 0 0
0 3.50960277740655 0 0
0 0 -1.01078866385069 -1
0 0 -587.199436318357 0
}

What they should be: (OSG 1.2):
Cam 0:
2.57815,0,0,0
0,3.5096,0,0
0,0,-1,-1
0,0,-20,0

Cam 1:
2.57815,0,0,0
0,3.5096,0,0
0,0,-1,-1
0,0,-20,0

Cam2:
2.57815,0,0,0
0,3.5096,0,0
0,0,-1,-1
0,0,-20,0

(all the same). In OSG 2.4, if I hard-code my Master cam's
projectionMatrix to be like the one printed out in OSG 1.2 I get the good
image result.

The big question is: What parameter is off? Why? and How do I fix it?
Any help with anything here mentioned will be VERY welcomed!!
Thanks,

-Jose








On Thu, July 24, 2008 3:12 am, Robert Osfield wrote:
 Hi Joseanibal,

 Could you provide a Producer .cfg that you are having problem with.
 Could you also please specify which versions of the OSG you've tried.

 Robert.

 On Thu, Jul 24, 2008 at 3:43 AM, Joseanibal Colon Ramos
 [EMAIL PROTECTED] wrote:
 Hi Anyone,

 I need to fix this ASAP. I am using OSG 2.4+ with old Producer Config
 files. OSG creates slave cameras for my multiple window configuration
 (one
 for each). The resulting settings are not quite like specified in my
 configuration file. Field of Views are mostly OK, but it is altering the
 aspect ratios of the slave cams and providing me with an image slightly
 off from how it should be. I've tried setting the Slave 

Re: [osg-users] Shapefiles Coordinate System Conversions

2008-07-24 Thread Greg Myers
Thanks for the tips Robert.  I'll give them a shot.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert
Osfield
Sent: Thursday, July 24, 2008 10:03 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Shapefiles  Coordinate System Conversions

Hi Greg,

It sounds like you are on track.

At tip for geospatial data  - With the .shp plugin in SVN head, and
2.5.x dev series the plugin supports loaded the geometry as doubles
rather than the default of floats.  You can enable this by using the
ReaderWriter::Options object passed in with your readNodeFile call, on
this options object you set the options string via
options-setOptionString(double);

Loading the vertex data as double helps with precision tremendously,
but for rendering it totally kills performance as the graphics hard
can't handle doubles, so the OpenGL driver has to convert to floats on
each time you render the vertex data, so load the data, project into
the appropriate coordinates system, then place with a local orign with
a MatrixTransform above it to place it in its original place, and then
convert the vertex data to floats.  This way you can maintain a good
balance between precision and performance.

Robert.

On Thu, Jul 24, 2008 at 3:19 PM, Greg Myers [EMAIL PROTECTED] wrote:
 Hello all,



 I am brand new to OSG and I am still wading through all the information
and
 examples learning as much as I can.  I am working on my latest exercise in
 which I am overylaying a shapefile onto a terrain database that I have.
The
 shapefile consists of bodies of water (lakes) in California.  I created
the
 terrain database using osgdem and some DTED data that I have for a small
 portion of California.  I know that the shapefile consists of lat, lon,
 height data ( thanks to osgconv ) and I wanted to convert those data to
 x,y,z coordinates in the coordinate system of the terrain.  I did this by
 using a node visitor for the shapefile node after reading it in with
 readNodeFile.  I accessed the ArrayData via the Geode instance and then
 looped through the data using the ellipsoid model from the terrain's
 coordinate system to convert the lat,long,height data.  Then all I had to
do
 was the overlay stuff and add it to the root node.



 Anyway, what I really want to know is if there is a better solution for
 converting the lat,long,height data or am I on track?



 Any existing examples or code snippets would be much appreciated.



 Thanks,

 Greg



 ___
 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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] help me!

2008-07-24 Thread monkeymonkey
hi!Thank you for your answer!
I try it as you say,
but not right also,i think because Texture Coord output of osgExp is not 
right,they are between 0 and 1,it should be 0 to 3.
i change it , it is OK!, so it is the really reason.
I must change osgExp scource code,and recompile it? how to do it?



 From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org Date: Wed, 
 23 Jul 2008 09:57:33 +0200 Subject: Re: [osg-users] help me!  Hi,  El 
 Miércoles 23 Julio 2008ES 08:48:19 monkeymonkey escribió:  hi! i 
 use Texture UV repeat 3.0 in 3dsMax8,but when i output it to ive,then use  
 osgViewer to look,texture is not right.   it seem that repeat is not work! 
 why? osgExp is not surport Texture UV repeat? how to make it?  
 Convert your .ive to .osg with osgconv, then look for the wrap parameter in 
  the file like  wrap_s,t,... REPEAT  If there is something other word 
 than REPEAT, change it.  Alberto 
 ___ osg-users mailing list 
 osg-users@lists.openscenegraph.org 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_
MSN史诗巨片横空出世,精彩抢先看!
http://im.msn.cn/___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org