Re: [osg-users] transparency problem

2009-06-03 Thread su hu
Hi Robert,

There are lots of transparent objects/nodes in my scene.  I need to place
them in the depth sorted bin. How can I find out these transparent nodes
quickly?  Thanks a lot.

Regards,

Su Hu

2009/5/28 Tomlinson, Gordon gtomlin...@overwatch.textron.com

 Also make sure you multi-sampling turned on, this show up much more when
 multi-sampling is off


 Gordon
 Product Manager 3d
 __
 Gordon Tomlinson
 Email  : gtomlinson @ overwatch.textron.com
 __


 -Original Message-
 From: osg-users-boun...@lists.openscenegraph.org
 [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert
 Osfield
 Sent: Wednesday, May 27, 2009 11:08 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] transparency problem

 Hi J.P,

 On Wed, May 27, 2009 at 3:01 PM, J.P. Delport jpdelp...@csir.co.za
 wrote:
  What specifically is a part? Geode, Geometry, PrimitiveSet,
 Triangle?

 The transparent bin is sorted by the distance away from the eye of
 center of the drawables.  To get finner grained sorted you have to break
 the large drawable into smaller ones.  The drawables are usually
 osg::Geometry, so you'd break these into a series of smaller
 osg::Geometry.

 Robert.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
 ghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or%0Ag
 ___
 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] transparency problem

2009-05-27 Thread su hu
Hi Robert,

Thanks for your reply.

Our 3D modeler tell me that the same model is shown right in vega view. We
will break large objects up into small parts and try it again. Thanks a lot.

Regards,

Su Hu

2009/5/27 Robert Osfield robert.osfi...@gmail.com

 Hi Su Hu,

 You need to place transparent objects in the depth sorted bin,
 normally loaders will do this for you. There is a chance that these
 objects are already in the transparent bin but you have some very
 large transparent objects in the scene as well that are causing the
 depth sorting to perform poorly - if this is the case you need to
 break the large objects up into small parts to allow depth sorting to
 work correctly.

 Robert.

 On Wed, May 27, 2009 at 2:26 PM, su hu ttts...@gmail.com wrote:
  Hi all.
 
  Some transparent textures are used in our model.  When we render this
 model
  by osg v2.8, we find some problem as attached snapshot. We try to change
  orders(in model structure) of those transparent objects to get right
 result,
  but failed. Any special setting should be included in program?Thanks for
  your help.
 
  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] Can not create OpenGL texture in OSG

2009-04-16 Thread su hu
Thank you, ulrich.

Now I load texture files in camera callback and solve the problem.

I use ms3d models and render them by OpenGL.  So I have to load model and
texture files by myself.

Thanks for your help.

Su Hu




2009/4/16 Ulrich Hertlein u.hertl...@sandbox.de

 The reason for this is that you don't have a valid OpenGL context.

 But apart from that is there a reason why you're trying to create the
 texture yourself?
 Instead of using, say, OSG for that?

 /ulrich

 On 16/4/09 6:58 AM, su hu wrote:

 After glGenTextures, I use glGetError to get the error. The result is :
 GL_INVALID_OPERATION.
 ...
 2009/4/16 su hu ttts...@gmail.com mailto:ttts...@gmail.com

Hi all,

When I tried to create a texture by glGenTextures in OSG, I met a
problem.  glGenTextures can not create a texture object. Zero is
returned and no texture is created. Source codes are as follow:
 ...
else if(LoadTexture)
{
 GLuintTexID = 0;
 glGenTextures(1, TexID );
 
}

 ___
 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] Can not create OpenGL texture in OSG

2009-04-15 Thread su hu
Hi all,

When I tried to create a texture by glGenTextures in OSG, I met a problem.
glGenTextures can not create a texture object. Zero is returned and no
texture is created. Source codes are as follow:

while(!Viewer.done())
{
  ...
  if(Render)
  {
 
  Viewer.frame();
   }
   else if(LoadTexture)
   {
GLuintTexID = 0;
glGenTextures(1, TexID );

   }

   
}

Version of my osg is 2.8 for vs2005. OS is Win XP professional.  Graphics
card is ATI X1600.

Thanks for your help!

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


Re: [osg-users] Can not create OpenGL texture in OSG

2009-04-15 Thread su hu
After glGenTextures, I use glGetError to get the error. The result is :
GL_INVALID_OPERATION.

OpenGL manual (
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gentextures.html)gives
the reason as:

*GL_INVALID_OPERATION* is generated if *glGenTextures* is
  executed between the execution of *glBegin* and the
  corresponding execution of *glEnd*.


But I dont know how to do. Thanks for your help.


Su Hu

2009/4/16 su hu ttts...@gmail.com

 Hi all,

 When I tried to create a texture by glGenTextures in OSG, I met a problem.
 glGenTextures can not create a texture object. Zero is returned and no
 texture is created. Source codes are as follow:

 while(!Viewer.done())
 {
   ...
   if(Render)
   {
  
   Viewer.frame();
}
else if(LoadTexture)
{
 GLuintTexID = 0;
 glGenTextures(1, TexID );
 
}


 }

 Version of my osg is 2.8 for vs2005. OS is Win XP professional.  Graphics
 card is ATI X1600.

 Thanks for your help!

 Su Hu


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


[osg-users] how to draw ms3d model

2009-03-20 Thread su hu
Hi all,

In our application, hundreds of human animated models should be loaded into
scene. We use ms3d format models.

Now we do it as follow:

1. load models
2. create a osg::Geode and add it to scene
3. add a osg::Drawable to this Geode
4. add a osg::NodeCallback to this Geode
5. calculate and update models in the NodeCallback
6. draw models in drawImplementation of the Drawable (using OpenGL).

Maybe there is better way to render ms3d model.  Could you please give me
some advice? Thanks for your helps.


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


Re: [osg-users] Edge blending

2008-10-15 Thread su hu
Hi Robert

Thanks for your reply.

I will see the osghud example and try your method. Thanks.

Best Regards,

Su Hu

2008/10/15 Robert Osfield [EMAIL PROTECTED]

 Hi Su Hu,

 I haven't personally implemented edge blending yet, but it should be
 straight forward.  All you need to do is render a alpha blending quad
 over the edge of window as a HUD. See the osghud example for
 inspiration.

 Robert.

 On Wed, Oct 15, 2008 at 9:18 AM, su hu [EMAIL PROTECTED] wrote:
  Hi all,
 
  I want to implement edge blending by osg, but I don't know which way is
  better. Our requirement of edge blending is simple: overlapped area of
 two
  screens is rectangular.
 
  If someone has done it, please give me some advice.
 
  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] moving models...

2008-08-02 Thread su hu
Shayne,

In my application, a global buffer is used to input data to osg thread from
other thread.

I used the method as same as Todd told you. setMatrix() is used to update
the matrix of that MatrixTransform node.


...

osg::ref_ptrosg::group root;
osg::ref_ptrosg::MatrixTransform MotionMatrix;
osg::ref_ptrosg::node MotionModelFile;   //your motion
model

...
root-addchild(MotionMatrix);

MotionMatrix-addchild(MotionModelFile);

...

 while((!Viewer.done)
 {
...

if(Update is
Needed)  //position
is changed or other
 MotionMatrix--setMatrix(osg::Matrix::translate(Pos));  //your
position data

...
   Viewer.frame();

...
}




su hu


2008/8/2, Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC 
[EMAIL PROTECTED]:

  This is probably a silly and simple question, but does anyone have an
 example of how to move a model explicitly without using a canned animation?
 Most of the examples I've seen, update the position in an animation using
 UpdateCallback.



 I have a position update coming from another process outside the scenegraph
 that I need to feed into the model to update its position. Do I need to use
 an UpdateCallback or a NodeVisitor approach?



 Any help would be most appreciated…



 Thanks,

 -Shayne

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


[osg-users] how to use OpenGL code in osg

2008-05-02 Thread su hu
Hi all,

I have some opengl codes and want to use these codes in osg program.

I do it as follow:

1. Add a geode to root scene and define a drawable (derived from
osg::Drawable).
2. The drawable is added as child of the geode. OpenGL code is added in
DrawCallback of the drawable(in drawImplementation).

But it seems that the DrawCallback function is called by osg only once. When
I add other node to root scene, the drawable will disappear.

Could you please tell me how to add opengl code to osg program?A simple
sample will be appreciated. Thanks a lot.

Regards,

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


Re: [osg-users] how to use OpenGL code in osg

2008-05-02 Thread su hu
Hi, bob

Thanks a lot.

Kind Regards,

Tiger Su


2008/5/2, Bob Kuehne [EMAIL PROTECTED]:

 hi su - we cover this (and more!) in the intermediate training course
 we teach. however, it's a pretty simple answer - the
 drawImplementation is only executed once, because it's converted to a
 display list the first time drawn. so, disable display lists on that
 drawable, and you'll be set!

 bob

 On May 2, 2008, at 5:13 AM, su hu wrote:

  Hi all,
 
  I have some opengl codes and want to use these codes in osg program.
 
  I do it as follow:
 
  1. Add a geode to root scene and define a drawable (derived from
  osg::Drawable).
  2. The drawable is added as child of the geode. OpenGL code is added
  in DrawCallback of the drawable(in drawImplementation).
 
  But it seems that the DrawCallback function is called by osg only
  once. When I add other node to root scene, the drawable will
  disappear.
 
  Could you please tell me how to add opengl code to osg program?A
  simple sample will be appreciated. Thanks a lot.
 
  Regards,
 
  t s
  ___
  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