[osg-users] Geometry

2008-04-18 Thread Vincent Bourdier
Hi All,

I've a new problem, which is about Geometries.

this is simple : I've a node, already with a texture, and I want to put a
second texture on it. BUT, the second texture have to be well positioned on
the node, without depending on the Geometry's texture coordinates...

I've tried osg::TexGen and osg::TextureCubeMap but the second texture is
never put correctly on the node...

How can I get the texture coordinates ? or how can I put the second texture
right on the node ?
Thanks.

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


[osg-users] geometry

2010-06-23 Thread Gianni Ambrosio
Hi,
what's wrong in the following code?


Code:
osg::Geometry* createPyramid(const osg::Matrixd& iTransform, const osg::Vec4& 
iColor)
{
   osg::Geometry* geom = new osg::Geometry;

   osg::Vec3Array* vertices = new osg::Vec3Array(5+2);
   (*vertices)[0].set(iTransform.preMult(osg::Vec3d(8.0f, 0.0f, 0.0f)));
   (*vertices)[1].set(iTransform.preMult(osg::Vec3d(0.0f, 8.0f, 0.0f)));
   (*vertices)[2].set(iTransform.preMult(osg::Vec3d(-8.0f, 0.0f, 0.0f)));
   (*vertices)[3].set(iTransform.preMult(osg::Vec3d(0.0f, -8.0f, 0.0f)));
   (*vertices)[4].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f)));

   (*vertices)[5].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f))); 
//4line
   (*vertices)[6].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, -50.0f))); 
//4line

   osg::UByteArray* indices = new osg::UByteArray(18);
   (*indices)[0]=0;  (*indices)[1]=1;  (*indices)[2]=4;
   (*indices)[3]=1;  (*indices)[4]=2;  (*indices)[5]=4;
   (*indices)[6]=2;  (*indices)[7]=3;  (*indices)[8]=4;
   (*indices)[9]=3;  (*indices)[10]=0; (*indices)[11]=4;
   (*indices)[12]=1; (*indices)[13]=0; (*indices)[14]=3;
   (*indices)[15]=2; (*indices)[16]=1; (*indices)[17]=3;

   geom->setVertexArray(vertices);
   geom->setVertexIndices(indices);

   osg::Vec4Array* colors = new osg::Vec4Array;
   colors->push_back(iColor);
   geom->setColorArray(colors);
   geom->setColorBinding(osg::Geometry::BIND_OVERALL);

   geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, 
indices->size()));

   geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 5, 2)); 
//4line

   return geom;
}



I added the three "//4line" lines of code to explain my problem. In this case I 
would add a line starting from the top of the pyramid downwards but I just see 
the pyramid instead.

Regards
Gianni

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





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


Re: [osg-users] Geometry

2008-04-18 Thread Brian R Hill
Vincent,

I'm not sure what you're trying to do. The second texture will only look
right on the geometry if you define the texture coordinates to make it
right.

Each texture has it's own texture coordinates:
osg::Geometry::setTexCoordArray(texture unit, texture coordinate array)

The first texture should use texture unit 0 and the second should use
texture unit 1.

Brian

[EMAIL PROTECTED] wrote: -


To: osg 
From: "Vincent Bourdier" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
Date: 04/18/2008 10:17AM
Subject: [osg-users] Geometry

Hi All,

I've a new problem, which is about Geometries.

this is simple : I've a node, already with a texture, and I want to put a
second texture on it. BUT, the second texture have to be well positioned on
the node, without depending on the Geometry's texture coordinates...

I've tried osg::TexGen and osg::TextureCubeMap but the second texture is
never put correctly on the node...

How can I get the texture coordinates ? or how can I put the second texture
right on the node ?
Thanks.

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

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.


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


Re: [osg-users] Geometry

2008-04-18 Thread Vincent Bourdier
Brian,
ok so if I understand well, i can set a second array of coordinate of
texture. but for that I need the geometry... and i only can get the drawable
from a geode... so how can I get the geometry ?

thanks for help.

Vincent.

2008/4/18, Brian R Hill <[EMAIL PROTECTED]>:
>
> Vincent,
>
> I'm not sure what you're trying to do. The second texture will only look
> right on the geometry if you define the texture coordinates to make it
> right.
>
> Each texture has it's own texture coordinates:
> osg::Geometry::setTexCoordArray(texture unit, texture coordinate array)
>
> The first texture should use texture unit 0 and the second should use
> texture unit 1.
>
> Brian
>
> [EMAIL PROTECTED] wrote: -
>
>
> To: osg 
> From: "Vincent Bourdier" <[EMAIL PROTECTED]>
> Sent by: [EMAIL PROTECTED]
> Date: 04/18/2008 10:17AM
> Subject: [osg-users] Geometry
>
>
> Hi All,
>
> I've a new problem, which is about Geometries.
>
> this is simple : I've a node, already with a texture, and I want to put a
> second texture on it. BUT, the second texture have to be well positioned
> on
> the node, without depending on the Geometry's texture coordinates...
>
> I've tried osg::TexGen and osg::TextureCubeMap but the second texture is
> never put correctly on the node...
>
> How can I get the texture coordinates ? or how can I put the second
> texture
> right on the node ?
> Thanks.
>
> Regards,
>Vincent.
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> This is a PRIVATE message. If you are not the intended recipient, please
> delete without copying and kindly advise us by e-mail of the mistake in
> delivery. NOTE: Regardless of content, this e-mail shall not operate to
> bind CSC to any order or other contract unless pursuant to explicit
> written
> agreement or government initiative expressly permitting the use of e-mail
> for such purpose.
>
> 
>
> ___
> 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] Geometry

2008-04-18 Thread Jean-Sébastien Guay
Bonjour Vincent,

> this is simple : I've a node, already with a texture, and I want to put 
> a second texture on it. BUT, the second texture have to be well 
> positioned on the node, without depending on the Geometry's texture 
> coordinates...

Geometry can (and should) have texture coordinates for each texture unit 
you want to use. In your case you want to use units 0 and 1, so you 
should have texture coordinates for units 0 and 1.

> I've tried osg::TexGen and osg::TextureCubeMap but the second texture is 
> never put correctly on the node...

 Option 1 

osg::TexGen generates texture coordinates in a few different modes. It 
might be what you want, but it might not. See glTexGen (search Google or 
consult the red book) for a description of the different modes TexGen 
supports. In your case, if your first texture (unit 0) is applied 
correctly and you want to generate texture coordinates on unit 1 using a 
TexGen, you should use:

   osg::ref_ptr texgen = new osg::TexGen;
   texgen->setMode(  );
   geometry->getOrCreateStateSet()->setTextureAttributeAndModes(1,
   texgen.get(), osg::StateAttribute::ON);

The "1" there specifies the texture unit you want the TexGen to affect.

Then you would add your texture as you normally do, but to unit 1 as well.

   osg::ref_ptr texture = new osg::Texture2D(
   osgDB::readImageFile("blah.jpg"));
   geometry->getOrCreateStateSet()->setTextureAttributeAndModes(1,
   texture.get(), osg::StateAttribute::ON);

 Option 2 

But as I said, TexGen only generates texture coordinates in a few 
specific modes. If you want something else, you'll have to make texture 
coordinates in your modeling program, or programmatically... For example:

   osg::ref_ptr texcoordsUnit1 = new osg::Vec2Array;

   // Populate the Vec2Array with texture coordinates, normally as
   // many Vec2 instances as you have vertices in your geometry.

   geomtry->setTexCoordArray(1, texcoordsUnit1.get());

Again, assigned to unit 1.

 Option 3 

You could also use the same texture coordinates on unit 1 as on unit 0:

   geometry->setTexCoordArray(1, geometry->getTexCoordArray(0));

(I think that should work, never tested it, but if it doesn't work you 
could clone the texcoord array from unit 0 and then assign it to unit 1)

So you see, lots of options. It all depends on what you want as your 
texture coordinates!

Hope this helps, and hope it was comprehensible... :-)

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

2008-04-18 Thread Jean-Sébastien Guay
Bonjour Vincent,

> ok so if I understand well, i can set a second array of coordinate of 
> texture. but for that I need the geometry... and i only can get the 
> drawable from a geode... so how can I get the geometry ?

Use a NodeVisitor to get to the geode you want (only you can know which 
one you want, either by name or any other trait, or just find any 
geode), and then get its drawables and check to see if they're instances 
of osg::Geometry.

Check the examples for uses of NodeVisitor to find a node.

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

2008-04-18 Thread Vincent Bourdier
Hi Jean-Sébastien,

This is a very clear and complete explanation.

I'll will try all these to get the best in my case.

thanks a lot for these quick answers !!

Regards,
   Vincent.

2008/4/18, Jean-Sébastien Guay <[EMAIL PROTECTED]>:
>
> Bonjour Vincent,
>
>
> > ok so if I understand well, i can set a second array of coordinate of
> > texture. but for that I need the geometry... and i only can get the
> > drawable from a geode... so how can I get the geometry ?
>
>
> Use a NodeVisitor to get to the geode you want (only you can know which
> one you want, either by name or any other trait, or just find any
> geode), and then get its drawables and check to see if they're instances
> of osg::Geometry.
>
> Check the examples for uses of NodeVisitor to find a node.
>
>
> 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] Geometry

2008-04-18 Thread Brian R Hill
Vincent,

The geode can have any number of drawables associated with it. You need to
know which one you are interested in.

for (unsigned int ii=0; iigetNumDrawables(); ++ii)
{
   osg::Geometry * geom = dynamic_cast(geode->getDrawable(ii));
   if (geom)
   {
  // do your stuff here
   }
}


Brian
[EMAIL PROTECTED] wrote: -


To: "OpenSceneGraph Users" 
From: "Vincent Bourdier" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
Date: 04/18/2008 10:32AM
Subject: Re: [osg-users] Geometry

Brian,
ok so if I understand well, i can set a second array of coordinate of
texture. but for that I need the geometry... and i only can get the
drawable from a geode... so how can I get the geometry ?

thanks for help.

Vincent.


2008/4/18, Brian R Hill < [EMAIL PROTECTED] >:
Vincent,

I'm not sure what you're trying to do. The second texture will only look
right on the geometry if you define the texture coordinates to make it
right.

Each texture has it's own texture coordinates:
osg::Geometry::setTexCoordArray(texture unit, texture coordinate array)

The first texture should use texture unit 0 and the second should use
texture unit 1.

Brian

- [EMAIL PROTECTED] wrote: -


To: osg < osg-users@lists.openscenegraph.org >
From: "Vincent Bourdier" < [EMAIL PROTECTED] >
Sent by: [EMAIL PROTECTED]
Date: 04/18/2008 10:17AM
Subject: [osg-users] Geometry


Hi All,

I've a new problem, which is about Geometries.

this is simple : I've a node, already with a texture, and I want to put a
second texture on it. BUT, the second texture have to be well positioned on
the node, without depending on the Geometry's texture coordinates...

I've tried osg::TexGen and osg::TextureCubeMap but the second texture is
never put correctly on the node...

How can I get the texture coordinates ? or how can I put the second texture
right on the node ?
Thanks.

Regards,
   Vincent.

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


This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.



___
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

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.


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


[osg-users] Geometry Instancing

2008-08-25 Thread GMD GammerMaxyandex.ru
How should I make visualization of many objects-links (Geometry Instancing)?
How can I use extetion OpenGL EXT_draw_instanced for that?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Geometry shader

2007-10-26 Thread Ralph Kern
Hi,

does anybody already got some of the new geometry shader extension
EXT_geometry_shader4 working with OSG?

see tutorial at http://appsrv.cse.cuhk.edu.hk/~ymxie/Geometry_Shader/

Seems it should be possible to implement it straight forward in the OSG
core.

Regards Ralph

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


[osg-users] Geometry-Intersector

2007-10-28 Thread Andreas Goebel
Hello group, dear Robert,

Robert wrote a very fine PlaneIntersector to intersect planes with 
arbitrary nodes.

What I think is especially cool is that one gets the intersection as a 
group of connected polylines.

Are there plans for a geometry-intersector, that (as the name suggests) 
intersects a whole geometry with a node?

One approach would be to intersect each triangle with the node and then 
glue together the intersections as done in the planeIntersector.

I have the feeling that starting this from the planeIntersector as a 
base would not be exceedingly difficult, but still difficult for me (as 
I do not fully understand all of the planeIntersector code).

This "brute-force" - approach would be quite slow, I guess. Are there 
other strategies for doing mesh / mesh intersections?


Regards,

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


[osg-users] Geometry kernels?

2009-01-07 Thread Cory Riddell
I'm looking for comments and suggestions for using OSG with a geometry 
engine like ACIS, Parasolid, or Open Cascade. Can they work well 
together? Is it a useful combination? The application is CAD-like and 
involves interactively building up a model from discrete components.


I found OSG when looking for HOOPS competitors. Is it fair to compare 
HOOPS with OSG?


Thanks,
Cory


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


Re: [osg-users] geometry

2010-06-23 Thread Trajce (Nick) Nikolov
Hi Gianni,

here is working code snippet with the line

*osg::Geometry* createPyramid(const osg::Matrixd& iTransform, const
osg::Vec4& iColor)*
*{*
*  osg::Geometry* geom = new osg::Geometry;*
*
*
*  osg::Vec3Array* vertices = new osg::Vec3Array(5+2);*
*  (*vertices)[0].set(iTransform.preMult(osg::Vec3d(8.0f, 0.0f, 0.0f)));*
*  (*vertices)[1].set(iTransform.preMult(osg::Vec3d(0.0f, 8.0f, 0.0f)));*
*  (*vertices)[2].set(iTransform.preMult(osg::Vec3d(-8.0f, 0.0f, 0.0f)));*
*  (*vertices)[3].set(iTransform.preMult(osg::Vec3d(0.0f, -8.0f, 0.0f)));*
*  (*vertices)[4].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f)));*
*
*
*  (*vertices)[5].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f)));
//4line*
*  (*vertices)[6].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, -50.0f)));
//4line*
*
*
*  osg::UByteArray* indices = new osg::UByteArray(20);*
*  (*indices)[0]=0;  (*indices)[1]=1;  (*indices)[2]=4;*
*  (*indices)[3]=1;  (*indices)[4]=2;  (*indices)[5]=4;*
*  (*indices)[6]=2;  (*indices)[7]=3;  (*indices)[8]=4;*
*  (*indices)[9]=3;  (*indices)[10]=0; (*indices)[11]=4;*
*  (*indices)[12]=1; (*indices)[13]=0; (*indices)[14]=3;*
*  (*indices)[15]=2; (*indices)[16]=1; (*indices)[17]=3;*
*
*
*  (*indices)[18]=5;*
*  (*indices)[19]=6;*
*
*
*  geom->setVertexArray(vertices);*
*  geom->setVertexIndices(indices);*
*
*
*  osg::Vec4Array* colors = new osg::Vec4Array;*
*  colors->push_back(iColor);*
*  geom->setColorArray(colors);*
*  geom->setColorBinding(osg::Geometry::BIND_OVERALL);*
*
*
*  geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,
0, indices->size()-2));*
*
*
*  geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,
indices->size()-2, 2)); //4line*
*
*
*  return geom;*
*}*
-Nick


On Wed, Jun 23, 2010 at 5:32 PM, Gianni Ambrosio  wrote:

> Hi,
> what's wrong in the following code?
>
>
> Code:
> osg::Geometry* createPyramid(const osg::Matrixd& iTransform, const
> osg::Vec4& iColor)
> {
>   osg::Geometry* geom = new osg::Geometry;
>
>   osg::Vec3Array* vertices = new osg::Vec3Array(5+2);
>   (*vertices)[0].set(iTransform.preMult(osg::Vec3d(8.0f, 0.0f, 0.0f)));
>   (*vertices)[1].set(iTransform.preMult(osg::Vec3d(0.0f, 8.0f, 0.0f)));
>   (*vertices)[2].set(iTransform.preMult(osg::Vec3d(-8.0f, 0.0f, 0.0f)));
>   (*vertices)[3].set(iTransform.preMult(osg::Vec3d(0.0f, -8.0f, 0.0f)));
>   (*vertices)[4].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f)));
>
>   (*vertices)[5].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, 25.0f)));
> //4line
>   (*vertices)[6].set(iTransform.preMult(osg::Vec3d(0.0f, 0.0f, -50.0f)));
> //4line
>
>   osg::UByteArray* indices = new osg::UByteArray(18);
>   (*indices)[0]=0;  (*indices)[1]=1;  (*indices)[2]=4;
>   (*indices)[3]=1;  (*indices)[4]=2;  (*indices)[5]=4;
>   (*indices)[6]=2;  (*indices)[7]=3;  (*indices)[8]=4;
>   (*indices)[9]=3;  (*indices)[10]=0; (*indices)[11]=4;
>   (*indices)[12]=1; (*indices)[13]=0; (*indices)[14]=3;
>   (*indices)[15]=2; (*indices)[16]=1; (*indices)[17]=3;
>
>   geom->setVertexArray(vertices);
>   geom->setVertexIndices(indices);
>
>   osg::Vec4Array* colors = new osg::Vec4Array;
>   colors->push_back(iColor);
>   geom->setColorArray(colors);
>   geom->setColorBinding(osg::Geometry::BIND_OVERALL);
>
>   geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,
> 0, indices->size()));
>
>   geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 5,
> 2)); //4line
>
>   return geom;
> }
>
>
>
> I added the three "//4line" lines of code to explain my problem. In this
> case I would add a line starting from the top of the pyramid downwards but I
> just see the pyramid instead.
>
> Regards
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29322#29322
>
>
>
>
>
> ___
> 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] geometry

2010-06-23 Thread Gianni Ambrosio
Thanks Nick for the code.

Now I would like to understand why I must add the indices in this case since 
for a simple line I just need to insert the vertices in the geometry node.
In fact I would like to add the line to the geometry outside of the 
createPyramid method, where the line is created without the use of indices, 
just vertices.

Regards
Gianni

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





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


Re: [osg-users] geometry

2010-06-23 Thread Trajce (Nick) Nikolov
I think you can not mix index based geometry with non-index based geometry
within one geometry (I might be wrong here! ). If you want to draw a line
outside the pyramid, then attach another geometry to the geode doing just
the line in a way you want. Are yo after drawing an arrow? If so, your
approach will rebuild the arrow geometry for each matrix transform -
change.
-Nick


On Wed, Jun 23, 2010 at 6:08 PM, Gianni Ambrosio  wrote:

> Thanks Nick for the code.
>
> Now I would like to understand why I must add the indices in this case
> since for a simple line I just need to insert the vertices in the geometry
> node.
> In fact I would like to add the line to the geometry outside of the
> createPyramid method, where the line is created without the use of indices,
> just vertices.
>
> Regards
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29326#29326
>
>
>
>
>
> ___
> 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] geometry

2010-06-23 Thread Gianni Ambrosio
OK, thanks Nick for the explanation & suggestion. At first I started adding the 
geometry to a geode separately but I would like to add the entire arrow to the 
geode instead of adding the two parts. I mean somethig like that:

osg::Geode g;
g->addDrawable(createArrow());

osg::Geometry* createArrow()
{
   // here use createPyramid() and then add the line
}

Is it possible? I dont like to do as follows:

osg::Geode g;
g->addDrawable(createPyramid());
g->addDrawable(createLine());

I mean, I would like to create the arrow as a single geometry but calling the 
createPyramid() method.

Regards
Gianni

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





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


Re: [osg-users] geometry

2010-06-23 Thread Trajce (Nick) Nikolov
Here is what I would do:

1) Create the whole arrow in one geometry including the line - by default
let say make it fixed pointing up (0,0,1). Here is your createArrow thing
that will give you the whole arrow
2) Add MatrixTransform on top of this geometry - with this, you can control
the position, direction and scale
3) Use quaternions for the arrow orientation osg::Quat

This way would not need to rebuilt it for each change

or

build the arrow completely in geometry shader - you would need to pass only
a line this way - only two vertices

-Nick


On Wed, Jun 23, 2010 at 6:32 PM, Gianni Ambrosio  wrote:

> OK, thanks Nick for the explanation & suggestion. At first I started adding
> the geometry to a geode separately but I would like to add the entire arrow
> to the geode instead of adding the two parts. I mean somethig like that:
>
> osg::Geode g;
> g->addDrawable(createArrow());
>
> osg::Geometry* createArrow()
> {
>   // here use createPyramid() and then add the line
> }
>
> Is it possible? I dont like to do as follows:
>
> osg::Geode g;
> g->addDrawable(createPyramid());
> g->addDrawable(createLine());
>
> I mean, I would like to create the arrow as a single geometry but calling
> the createPyramid() method.
>
> Regards
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29328#29328
>
>
>
>
>
> ___
> 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] geometry

2010-06-23 Thread Gianni Ambrosio
Nick, I didn't get the second solution, anyway I think my case is a little bit 
particular. I don't need to move the arrow around but it is just part of a 
cross axes I have to add to the scene. It is fixed under a separate camera. So 
the transformation you can see as first parameter of createPyramid() method is 
just to generalize the creation of the three axes (X, Y and Z).

Gianni

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





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


Re: [osg-users] geometry

2010-06-23 Thread Trajce (Nick) Nikolov
ah .. ok

-Nick


On Wed, Jun 23, 2010 at 11:18 PM, Gianni Ambrosio wrote:

> Nick, I didn't get the second solution, anyway I think my case is a little
> bit particular. I don't need to move the arrow around but it is just part of
> a cross axes I have to add to the scene. It is fixed under a separate
> camera. So the transformation you can see as first parameter of
> createPyramid() method is just to generalize the creation of the three axes
> (X, Y and Z).
>
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=29338#29338
>
>
>
>
>
> ___
> 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] Geometry colorArray

2010-08-19 Thread Emilie Deschamps
Hi,

My question may be obvious but I can't figure it out. Here's my problem:

I have a (rig)geometry, with a vertexArray, a normalArray, and a colorArray 
(bind per vertex). Somewhere else in my code, I keep pointers to some of those 
values (a subset of vertices, a part of my geometry). When I modify a vertex or 
a normal by thoses pointers, my geometry get updated as expected. But when I 
modify a color, nothing happens !! What am I missing ?

Thank you!

Cheers,
Emilie

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





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


[osg-users] geometry indexes?

2012-01-16 Thread Akilan Thangamani
Hi

Is there any easy way to find vertices's index for the shapes like Cone, Cube 
etc., in osg::shape?
Otherwise, should it be done thru graph note book only?

Thanks

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





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


[osg-users] Geometry sharing

2012-12-05 Thread Ale Maro
Hi,

I have my own data structure to manage mesh geometry. Is there a way share it 
with OSG to avoid vertex list duplication?

Thank you!

Cheers,
Ale

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





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


Re: [osg-users] Geometry Instancing

2008-08-26 Thread Robert Osfield
Hi ???  Could you please sign your posts with the name you wish to be
addressed as.

On Mon, Aug 25, 2008 at 6:35 PM, GMD GammerMaxyandex.ru
<[EMAIL PROTECTED]> wrote:
> How should I make visualization of many objects-links (Geometry Instancing)?
> How can I use extetion OpenGL EXT_draw_instanced for that?

Right now you'd have to implement your own custom Drawable to do instancing.

It would be a good feature to get integrated into osg::Geometry
itself, but I've only briefly looked at the extension so can't say off
the top of my head the most efficient way to implement it.  Perhaps
other will have suggestions.

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


[osg-users] Geometry merging problem

2008-10-01 Thread Bilal Zeidan

Hi all,
I am trying to merge two geometry objects that have two different 
textures by using the merging function:
bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& 
lhs,osg::Geometry& rhs)
After calling this function, one of these objects looses its own 
texture. In fact it inherits the texture of the other object. did anyone 
already try this function or know how to merge two geometry objects 
correctly ?


thanks.

The following snippet code shows how I did the merging:
osg::ref_ptr  mergeGeoms(osg::Geometry *g1,osg::Geometry *g2)
{
 osgUtil::Optimizer::MergeGeometryVisitor::mergeGeometry(*g1,*g2);
 return g1;
}

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


[osg-users] Geometry::getOrCreateVertexBufferObject() - bug?

2007-10-09 Thread Christian Muschick
Hello!

While browsing the source I noticed this line in Geometry.cpp (line 
1060, rev 7375):

if (!array->getVertexBufferObject()) vbo = array->getVertexBufferObject();

As far as I can see, there never is anything assigned to vbo but the 
NULL pointer, so a new vertex buffer object is always created later in 
the function. The same thing happens in getOrCreateElementBufferObject.

Could somebody familiar with what should happen take a look at this?

regards
cm

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


Re: [osg-users] Geometry-Intersector

2007-10-28 Thread Robert Osfield
HI Andreas,

Personally I have no plans for geometry-intersector.

Robert.

On 10/28/07, Andreas Goebel <[EMAIL PROTECTED]> wrote:
> Hello group, dear Robert,
>
> Robert wrote a very fine PlaneIntersector to intersect planes with
> arbitrary nodes.
>
> What I think is especially cool is that one gets the intersection as a
> group of connected polylines.
>
> Are there plans for a geometry-intersector, that (as the name suggests)
> intersects a whole geometry with a node?
>
> One approach would be to intersect each triangle with the node and then
> glue together the intersections as done in the planeIntersector.
>
> I have the feeling that starting this from the planeIntersector as a
> base would not be exceedingly difficult, but still difficult for me (as
> I do not fully understand all of the planeIntersector code).
>
> This "brute-force" - approach would be quite slow, I guess. Are there
> other strategies for doing mesh / mesh intersections?
>
>
> Regards,
>
> Andreas
> ___
> 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] Geometry shader

2007-12-15 Thread sherman wilcox
I have a recent need for this as well. Anyone done this yet?

On Oct 26, 2007 3:05 AM, Ralph Kern <[EMAIL PROTECTED]> wrote:
> Hi,
>
> does anybody already got some of the new geometry shader extension
> EXT_geometry_shader4 working with OSG?
>
> see tutorial at http://appsrv.cse.cuhk.edu.hk/~ymxie/Geometry_Shader/
>
> Seems it should be possible to implement it straight forward in the OSG
> core.
>
> Regards Ralph
>
> ___
> 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] Geometry shader

2007-12-15 Thread Gerrick Bivins
Hello,
I'll chime in here and say we'll be needing this soon too. I'd be willing to
help implementit with some guidance.
biv

On Dec 15, 2007 1:27 PM, sherman wilcox <[EMAIL PROTECTED]> wrote:

> I have a recent need for this as well. Anyone done this yet?
>
> On Oct 26, 2007 3:05 AM, Ralph Kern <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > does anybody already got some of the new geometry shader extension
> > EXT_geometry_shader4 working with OSG?
> >
> > see tutorial at http://appsrv.cse.cuhk.edu.hk/~ymxie/Geometry_Shader/
> >
> > Seems it should be possible to implement it straight forward in the OSG
> > core.
> >
> > Regards Ralph
> >
> > ___
> > 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] Geometry shader

2007-12-16 Thread Ralph Kern
Mike Weiblen announced a geometry shader implementation for OSG 2.4, so
I guess we'll get it in the next weeks. (Thanks in advance, Mike!)

see
http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/21843/focus=21938

regards Ralph

Gerrick Bivins schrieb:
> Hello,
> I'll chime in here and say we'll be needing this soon too. I'd be
> willing to help implement
> it with some guidance. 
> biv
> 
> On Dec 15, 2007 1:27 PM, sherman wilcox <
> [EMAIL PROTECTED]
> > wrote:
> 
> I have a recent need for this as well. Anyone done this yet?
> 
> On Oct 26, 2007 3:05 AM, Ralph Kern
> <[EMAIL PROTECTED]
> > wrote:
> > Hi,
> >
> > does anybody already got some of the new geometry shader extension
> > EXT_geometry_shader4 working with OSG?
> >
> > see tutorial at http://appsrv.cse.cuhk.edu.hk/~ymxie/Geometry_Shader/
> >
> > Seems it should be possible to implement it straight forward in
> the OSG
> > core.
> >
> > Regards Ralph
> >
> > ___
> > 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] Geometry kernels?

2009-01-07 Thread Sukender
Hi Cory,

What do you mean by "geometry engine"? I guess you'll be able to easily create 
a kind of exporter that converts your geometry to an OSG/OpenGL one. Perhaps 
geometries would even be directly read and added to Geodes.
I don't know HOOPS, but be aware that OSG is "only" (!) a scene graph (with 
many features and plugins), but not a CAD/infrastructure/mining/whatever 
software.

Please tell us if you find useful things.

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/


Le Wed, 07 Jan 2009 16:44:15 +0100, Cory Riddell  a écrit:

> I'm looking for comments and suggestions for using OSG with a geometry
> engine like ACIS, Parasolid, or Open Cascade. Can they work well
> together? Is it a useful combination? The application is CAD-like and
> involves interactively building up a model from discrete components.
>
> I found OSG when looking for HOOPS competitors. Is it fair to compare
> HOOPS with OSG?
>
> Thanks,
> Cory

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


Re: [osg-users] Geometry kernels?

2009-01-08 Thread Cory Riddell




The geometry engine is the software that you use to do things like fuse
or intersect solids, sweep 2d shapes along a curve to generate a 3d
shape, etc... From these you get faces. lines and points that you pass
on to something else (like OpenGL) to render.

Open Cascade is free and quite good. The ACIS kernel is what is at the
heart of AutoCAD. Parasolid drives Solidworks. I was looking for advice
on using one of these geometry toolkits with OSG. I assumed it was a
common configuration, but I think I might be wrong about that.

Cory

Sukender wrote:

  Hi Cory,

What do you mean by "geometry engine"? I guess you'll be able to easily create a kind of exporter that converts your geometry to an OSG/OpenGL one. Perhaps geometries would even be directly read and added to Geodes.
I don't know HOOPS, but be aware that OSG is "only" (!) a scene graph (with many features and plugins), but not a CAD/infrastructure/mining/whatever software.

Please tell us if you find useful things.

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/


Le Wed, 07 Jan 2009 16:44:15 +0100, Cory Riddell  a écrit:

  
  
I'm looking for comments and suggestions for using OSG with a geometry
engine like ACIS, Parasolid, or Open Cascade. Can they work well
together? Is it a useful combination? The application is CAD-like and
involves interactively building up a model from discrete components.

I found OSG when looking for HOOPS competitors. Is it fair to compare
HOOPS with OSG?

Thanks,
Cory

  
  
___
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] Geometry kernels?

2009-01-08 Thread Sukender
Hi Cory,

Well, as I said, I'm not the one which can best answer you. However, I think 
using generated geometries in OSG is rather simple. It depends of course on how 
they are stored.

I suppose that a low-level code that adds each triangle into a geode would 
certainly not be very efficient, but at least would be the simplest and the 
less error-prone code that works with almost everything. Maybe you could try. 
If you write a kind of importer for files generated by a "geometry engine", 
think about proposing your work as a plugin (such as "osgDB_OpenCascadeFormat" 
if such a format exists).

But maybe your "geometry engine" can export models to a common format, 
supported by OSG? This would be a very simple solution, IMHO.

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/


Le Thu, 08 Jan 2009 16:07:10 +0100, Cory Riddell  a écrit:

> The geometry engine is the software that you use to do things like fuse or
> intersect solids, sweep 2d shapes along a curve to generate a 3d shape, etc...
> From these you get faces. lines and points that you pass on to something else 
> (like
> OpenGL) to render.
>
> Open Cascade is free and quite good. The ACIS kernel is what is at the heart 
> of
> AutoCAD. Parasolid drives Solidworks. I was looking for advice on using one of
> these geometry toolkits with OSG. I assumed it was a common configuration, 
> but I
> think I might be wrong about that.
>
> Cory
>
> Sukender wrote:
>
> Hi Cory,
>
> What do you mean by "geometry engine"? I guess you'll be able to easily 
> create a kind of exporter that converts your geometry to an OSG/OpenGL one. 
> Perhaps geometries would even be directly read and added to Geodes.
> I don't know HOOPS, but be aware that OSG is "only" (!) a scene graph (with 
> many features and plugins), but not a CAD/infrastructure/mining/whatever 
> software.
>
> Please tell us if you find useful things.
>
> Sukender
> PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
>
>
> Le Wed, 07 Jan 2009 16:44:15 +0100, Cory Riddell  a écrit:
>
> 
>
> I'm looking for comments and suggestions for using OSG with a geometry
> engine like ACIS, Parasolid, or Open Cascade. Can they work well
> together? Is it a useful combination? The application is CAD-like and
> involves interactively building up a model from discrete components.
>
> I found OSG when looking for HOOPS competitors. Is it fair to compare
> HOOPS with OSG?
>
> Thanks,
> Cory
> 
>
>
> ___
> 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] Geometry kernels?

2009-01-09 Thread hanne...@gmx.at

to mary http://www.opencascade.org/ with osg is a GREAT idea!

if someone want to try a cad program based on opencascade try 
http://www.salome-platform.org

SALOME-MECA-2008.1-GPL Salome-Meca-2008 contains the newly integrated software 
suite combining Salome v.3.2.9 Pre-Post processor  & Code-Aster v9.2 FE solver 
and  includes the new Code-Aster module for Salome and its new Analysis Wizards.
http://www.caelinux.com/CMS/index.php?option=com_content&task=view&id=44&Itemid=40

http://caelinux.com/
a linux distribution for cad and cae.

i think if osg would be used there it would be a great benefit for osg and for 
cad/cae. think about the simulation market...

best regards
hannes

Cory Riddell wrote:

The geometry engine is the software that you use to do things like
fuse or intersect solids, sweep 2d shapes along a curve to generate a
3d shape, etc... From these you get faces. lines and points that you
pass on to something else (like OpenGL) to render.

Open Cascade is free and quite good. The ACIS kernel is what is at
the heart of AutoCAD. Parasolid drives Solidworks. I was looking for
advice on using one of these geometry toolkits with OSG. I assumed it
was a common configuration, but I think I might be wrong about that.

Cory

Sukender wrote:

Hi Cory,

What do you mean by "geometry engine"? I guess you'll be able to
easily create a kind of exporter that converts your geometry to an
OSG/OpenGL one. Perhaps geometries would even be directly read and
added to Geodes. I don't know HOOPS, but be aware that OSG is
"only" (!) a scene graph (with many features and plugins), but not
a CAD/infrastructure/mining/whatever software.

Please tell us if you find useful things.

Sukender PVLE - Lightweight cross-platform game engine -
http://pvle.sourceforge.net/


Le Wed, 07 Jan 2009 16:44:15 +0100, Cory Riddell
 a écrit:



I'm looking for comments and suggestions for using OSG with a
geometry engine like ACIS, Parasolid, or Open Cascade. Can they
work well together? Is it a useful combination? The application
is CAD-like and involves interactively building up a model from
discrete components.

I found OSG when looking for HOOPS competitors. Is it fair to
compare HOOPS with OSG?

Thanks, Cory



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

2009-07-16 Thread Ulrich Hertlein

Hi Cheng,

On 16/7/09 3:55 AM, Cheng Guan wrote:

I've a problem with geometry drawing on top of a terrain. I enable 
GL_DEPTH_TEST and
part of the geometry get culled (see figure 1) but I can the full circle 
rendered if I
keep moving my eye point (see figure 2). If I disable the GL_DEPTH_TEST, the 
circle
will show even when I'm behind it. I tried switching off small feature culling 
Code:
viewer->getCamera()->setCullingMode(viewer->getCamera()->getCullingMode()&
~osg::CullSettings::SMALL_FEATURE_CULLING);


That is not a culling problem but a depth buffer problem.  Your two geometries are too 
close together and in certain situations the depth buffer precision isn't good enough.


What do you mean by "will show even when I'm behind it"?

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


Re: [osg-users] Geometry Culling

2009-07-16 Thread Cheng Guan

Ulrich Hertlein wrote:
> Hi Cheng,
> 
> On 16/7/09 3:55 AM, Cheng Guan wrote:
> 
> > I've a problem with geometry drawing on top of a terrain. I enable 
> > GL_DEPTH_TEST and
> > part of the geometry get culled (see figure 1) but I can the full circle 
> > rendered if I
> > keep moving my eye point (see figure 2). If I disable the GL_DEPTH_TEST, 
> > the circle
> > will show even when I'm behind it. I tried switching off small feature 
> > culling Code:
> > viewer->getCamera()->setCullingMode(viewer->getCamera()->getCullingMode()&
> > ~osg::CullSettings::SMALL_FEATURE_CULLING);
> > 
> 
> That is not a culling problem but a depth buffer problem.  Your two 
> geometries are too 
> close together and in certain situations the depth buffer precision isn't 
> good enough.
> 
> What do you mean by "will show even when I'm behind it"?
> 
> Cheers,
> /ulrich
> ___
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  --
> Post generated by Mail2Forum


Hi Ulrich,

Thanks for the reply :) I'm actually drawing 1 geometry, figure 1 shows the 
view from 1 view point and figure 2 is when I keep moving my view point until 
I'm able to see the whole circle rendered correctly. Is my geometry z-fighting 
with the terrain?


> What do you mean by "will show even when I'm behind it"?


Sorry for the confusion, what I meant is I do not want my geometry to render 
when it is blocked by another object. With GL_DEPTH_TEST disabled, it will be 
rendered every time.

Cheers,
CG

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





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


Re: [osg-users] Geometry Culling

2009-07-18 Thread Cheng Guan
Hi all,

I've uploaded a video http://www.youtube.com/watch?v=X4xgFzaBBWs to show the 
problem I'm facing when rendering a geometry. Any advices?

Thank you!

Cheers,
CG[/url]

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





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


Re: [osg-users] Geometry Culling

2009-07-20 Thread Jean-Sébastien Guay

Hi CG,


I've uploaded a video http://www.youtube.com/watch?v=X4xgFzaBBWs to show the 
problem I'm facing when rendering a geometry. Any advices?


Yes, that's most definitely z-fighting. Try moving the geometry higher 
above the terrain, or setting the near and far planes as close to each 
other as you can. (generally OSG's 
COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES will do this, but it might have 
trouble in some cases so you can disable automatic near/far calculation 
and just set them yourself).


Hope this helps,

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


Re: [osg-users] Geometry Culling

2009-07-26 Thread Cheng Guan

Skylark wrote:
> Hi CG,
> 
> 
> > I've uploaded a video http://www.youtube.com/watch?v=X4xgFzaBBWs to show 
> > the problem I'm facing when rendering a geometry. Any advices?
> > 
> 
> Yes, that's most definitely z-fighting. Try moving the geometry higher 
> above the terrain, or setting the near and far planes as close to each 
> other as you can. (generally OSG's 
> COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES will do this, but it might have 
> trouble in some cases so you can disable automatic near/far calculation 
> and just set them yourself).
> 
> Hope this helps,
> 
> J-S
> -- 
> __
> Jean-Sebastien Guay
> http://www.cm-labs.com/
> http://whitestar02.webhop.org/
> ___
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  --
> Post generated by Mail2Forum


Hi J-S,

Thanks for the help, I will try it out :)

Cheers,
CG

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





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


[osg-users] Geometry to raster

2009-09-22 Thread Geraud De Magneval
Hi,

I have a scene with an osg::Box, and I'd like to obtain a "raster" 
representation of my scene like this:


Code:

--
--
--
--
--



I was thinking using LineSegments to find out the intersections with the 
geometry object of the scene.
And the result will probably be:

Code:

--
--
*--*--
--
--



My problem is how I could fill the cells that are inside of the box?

I am new in OSG, and I am not sure I am using the correct approach, and I 
could'nt find anything about "Vector to Raster" in osg.

Thanks a lot for help.

Regards,
Géraud
Code:




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





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


[osg-users] geometry shader example?

2010-03-22 Thread Yanling Liu
Hello, please forget me if this is a dummy question.

Is there OSG geometry shader example available? Didn't find such an example
in OSG 2.8.2 source tree examples folder (or I missed it).

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


Re: [osg-users] Geometry colorArray

2010-08-19 Thread Tom Pearce
Hi Emilie,

I don't have much experience with doing what you're trying to do, but do you 
have the data variance on your geometry set to dynamic?  When I've forgotten to 
do this in the past various things I've tried to modify dynamically weren't 
applied, I can't recall if position (for example) worked but not color - it 
could have been that nothing was updating right and completely different from 
your case... but perhaps a hint?

Cheers,
Tom

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





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


Re: [osg-users] Geometry colorArray

2010-08-19 Thread J.P. Delport

Hi,

have you tried callind ->dirty() on the array? Are you using VBOs or 
display lists?


jp

On 19/08/10 22:18, Emilie Deschamps wrote:

Hi,

My question may be obvious but I can't figure it out. Here's my problem:

I have a (rig)geometry, with a vertexArray, a normalArray, and a colorArray 
(bind per vertex). Somewhere else in my code, I keep pointers to some of those 
values (a subset of vertices, a part of my geometry). When I modify a vertex or 
a normal by thoses pointers, my geometry get updated as expected. But when I 
modify a color, nothing happens !! What am I missing ?

Thank you!

Cheers,
Emilie

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





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



--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Re: [osg-users] Geometry colorArray

2010-08-20 Thread Emilie Deschamps
Hi,

Thanks for your advices :) I was setting the dataVariance of my normal and 
vertex array to Dynamic, but not on my color array.

To get it works I also call dirty on my color array (before I was trying to 
call "dirtyDisplayList" on my geometry instead of "dirty" on my color Array, 
which hasn't worked).

Now everything works fine :)
Thanks again!

Cheers,
Emilie

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





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


[osg-users] Geometry Drawing Performance

2010-09-14 Thread Frank Sullivan
Hello everybody,

Can I trouble you with some questions about performance? My situation is 
basically this. I have a list of 54 drawables that I'm generating in-code. Not 
all of them are necessarily displayed on the screen at any given time, and in 
some cases, a certain drawables might be drawn more than once (accomplished by 
adding a second MatrixTransform parent above the associated Geode).

In any case, I went for a naive implementation at first. Each drawable was an 
osg::Geometry object attached to an osg::Geode (which again, may have one or 
more osg::MatrixTransforms as parents). Each osg::Geometry had its own 
Vec3Array as a vertex array. The performance wasn't bad. It was around 700fps 
in wireframe mode on my machine. But I figured I could do better.

So, I groups all of the verts for these 54 drawables into a single Vec3Array 
that all of the osg::Geometry objects shared. The primitive set (an 
osg::DrawArrays) would specify which subset of the vertex array to draw.

I figured this would help because it would eliminate a lot of useless VBO 
bindings (or whatever else is going on under the hood). However, this actually 
cut the frame rate by about a third. 

This confused me, but in a way it made sense. My new "master vertex array" has 
well over a million verts! So maybe the memory requirements of this outweighs 
the savings I get from reducing VBO bindings?

So anyway, I figured it might be a good idea to try to index this geometry, to 
cut down on the number of verts in the vertex array. Doing this, I was actually 
able to cut down the number of verts to just over two thousand. That's a 
savings of 99.84%!

Of course, now I've got 54 separate primitive sets (I had to use 
osg::DrawElements, because it doesn't look like osg::DrawArrays supposed 
indexed geometry). But since these primitive sets are essentially vectors of 
USHORTs (rather than vectors of Vec3's), I'm still saving a significant amount 
of memory (about 725,00 bytes for the Vec3's and USHORTS versus about 16 
million bytes for the huge Vec3Array).

Yet, the frame rate remains at about 220fps, which is significantly lower than 
the naive method involving 54 separate Vec3Arrays totaling 1.4 million verts!

I still have a ways to go. I'm thinking about seeing if I can use a triangle 
strip instead of GL_TRIANGLES, to save even more on memory used for verts. 
However, the logic for building the meshes with triangle strips will be much 
tougher, and will likely require smart use of degenerate triangles. 

I'm happy to do the work, but before I do, I just want to make sure that there 
isn't something that I'm missing. I tried setting the data variance of the 
osg::Geometry objects to Static, hoping that perhaps if I signal to OSG that I 
have no intention of changing those objects, it could put it in a 
more-efficient memory pool (perhaps). However, that didn't seem to affect the 
frame rate.

Any advice at all would be greatly appreciated.

Cheers,
Frank

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





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


Re: [osg-users] geometry indexes?

2012-01-17 Thread Robert Osfield
HI Akilan,

On 17 January 2012 05:04, Akilan Thangamani  wrote:
> Is there any easy way to find vertices's index for the shapes like Cone, Cube 
> etc., in osg::shape?
> Otherwise, should it be done thru graph note book only?

The osg::Shape subclasses don't have any vertices they are just
primitive shapes.  In rendering and intersection testing vertices are
created on the fly and never stored.

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


[osg-users] Geometry topology serialization

2014-01-24 Thread Émeric MASCHINO
Hi,

The OpenSceneGraph 3.0 Beginner's Guide states that "OSG doesn't
support algorithmic topology functionalities at present, probably
because it seems a little weird for a rendering API to implement
this."
I'm fine with this.
Now, I've written a ReaderWriter plugin to read a custom file format
that encompasses such topological informations, e.g. triangle/quad
indices of the geometry defining regions on the model.
Is osg::Object::set/getUserData adequate to serialize such topological
informations in order to later display them (e.g. displaying regions
of the model with different colors) or am I better developping my own
interface?
I've seen the osgUtil::EdgeCollector in OSG documentation, but it
seems to do the reverse, i.e. extract topological informations of a
geometry (edges, vertices, triangles) whereas I know them beforehand.
And this won't tell what's the best practice to later store the
results of osgUtil::EdgeCollector.

Thanks,

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


[osg-users] geometry and normals

2014-07-23 Thread Gianni Ambrosio
Hi All,
I need to draw a surface. Looking at OSG examples I implemented it this way:


Code:

   osg::Geometry* geometry = getGeometry();
   osg::Vec3Array* vertices = new osg::Vec3Array;
   GraphicVectorPtr graphicVector = road->graphicVector();
   size_t count = graphicVector->count();
   size_t addedPoints = 0;
   vertices->reserve(count * 3);
   for (size_t i = 0; ipush_back(osg::Vec3(item.points[0], item.points[1], 
item.points[2]));
 vertices->push_back(osg::Vec3(item.points[3], item.points[4], 
item.points[5]));
 vertices->push_back(osg::Vec3(item.points[6], item.points[7], 
item.points[8]));
 addedPoints+=3;
  }
   }
   geometry->setVertexArray(vertices);
   geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 
0, addedPoints));




Now, first of all I would like to know if this is correct. I mean I want to 
draw triangles and I don't want to waste memory.

The problem is that I see a basically flat surface. I tried then with a 
SmoothingVisitor on the geometry and the flat surface problem is solved. So I 
guess it was related to normals not set, right?

Now, since I don't like so much how the surface is rendered with the 
SmoothingVisitor, is there a way of render the surface as it is drawn?

Regards,
Gianni

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





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


Re: [osg-users] Geometry sharing

2012-12-12 Thread Robert Osfield
Hi Ale,

On 26 November 2012 10:41, Ale Maro  wrote:

> I have my own data structure to manage mesh geometry. Is there a way share
> it with OSG to avoid vertex list duplication?
>

You could implement your own osg::Array subclass.  See how the osg::Array
subclasses like Vec3Array are implemented for inspiration.

The other alternative just use osg::Vec3Array in your own mesh
representation.  The OSG uses forms that are very closely mapped to OpenGL
making it efficient to pass data to OpenGL.

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


[osg-users] Geometry Merging Problem

2013-02-19 Thread Adam Stambler
Hi All,

I believe I am having trouble with OSG automatically optimizing my sets of
Geometry.

I am visualizing a 3D reconstruction using OSG.  Each part of the
reconstruction is put into its own OSG Geometry and Geode.  All of the
parts are then put a group and saved to an .ive file.  In another
application, I load the ive and try and select each reconstructed Geode
node.  When I click on one part ,   parts are selected.  It looks like
Geometry in a few  nodes have been automatically merged.

My question is:  is there any automatic optimization somewhere?  Perhaps
things are optimized when they are made IVE file?  Either I implemented
something incorrectly (very possible) or something modifies my scene
graph.  I am not explicitly calling osgUtil::Optimizer.

Thanks for any insight,
Adam
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Geometry merging problem

2008-10-01 Thread Paul Martz
A single Geometry can only have one StateSet and can't change OpenGL state
within a Geometry, so I'm not sure how you expected this to work. Other than
building a texture atlas, your best bet would be to leave them as two
separate Geometries.
   -Paul
 


> 
> Hi all,
> I am trying to merge two geometry objects that have two 
> different textures by using the merging function:
> bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry&
> lhs,osg::Geometry& rhs)
> After calling this function, one of these objects looses its 
> own texture. In fact it inherits the texture of the other 
> object. did anyone already try this function or know how to 
> merge two geometry objects correctly ?
> 
> thanks.
> 
> The following snippet code shows how I did the merging:
> osg::ref_ptr  mergeGeoms(osg::Geometry 
> *g1,osg::Geometry *g2) {
>   osgUtil::Optimizer::MergeGeometryVisitor::mergeGeometry(*g1,*g2);
>   return g1;
> }
> 
> ___
> 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] geometry shader support submitted.

2008-01-07 Thread Mike Weiblen
Hi all,

I've just posted an initial implementation of OSG geometry shaders to
the osg-submissions list.

Included is a simple example "osgshaders2": the app sends 8 points at
corners of a cube, the geom shader generates animated line segment
crosshairs at those corners.

Things yet to be done (I cannot commit to these, so pls contribute):
- fully implement the non-square matrices in osg::Uniform
- implement the adjacency types in DrawPrimitives
- .osg file read/write support
- .ive file read/write support
- longer term: OSG could probably do some really smart/cool stuff, above
and beyond basic GL wrapping, in somehow associating geom shaders with
the corresponding DrawPrimitive.

Cheers
-- mew

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


Re: [osg-users] Geometry to raster

2009-09-22 Thread Jean-Sébastien Guay

Hello Geraud,


I have a scene with an osg::Box, and I'd like to obtain a "raster" 
representation of my scene like this:

[...]

I was thinking using LineSegments to find out the intersections with the 
geometry object of the scene.
And the result will probably be:

[...]

My problem is how I could fill the cells that are inside of the box?


Why would you think you would get an empty box? The box has 6 faces, so 
it's closed, and thus the intersector should find intersections over the 
whole face that's facing the camera (where the rays are being shot 
from). But:



I am new in OSG, and I am not sure I am using the correct approach, and I could'nt find 
anything about "Vector to Raster" in osg.


I would do this as a Render-to-Texture (RTT) pass. Just set up your 
camera in ortho mode (I think that's what you're looking for, as opposed 
to perspective) and set it up to render to texture and attach an 
osg::Image of the appropriate dimensions to it. After the next frame the 
image will represent your object rasterized. This better utilizes the 
graphics hardware, as line segment intersections all happen on the CPU.


Then if all you want is to know if the object is present or not in a 
given pixel you can reduce the bit depth of the texture target (you 
would just need one bit but that's not an option, the lowest bit depth 
you can use is GL_LUMINANCE which is 8 bits).


Many OSG examples demonstrate RTT, have a look through their code to see 
examples of this.


Hope this helps,

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


Re: [osg-users] Geometry to raster

2009-09-22 Thread Geraud De Magneval
Hello Jean-Sébastien,

You are right when you said:

> 
> The box has 6 faces, so it's closed, and thus the intersector should find 
> intersections over the whole face that's facing the camera (where the rays 
> are being shot from). 
> 


I was thinking with 2D in mind and only thinking in intersecting my box with 
segment in X, Y forgotting the z.

Anaway I will have a look to Render To Texture examples, that seems to be more 
appropriate.

Thanks a lot.

Géraud

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





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


Re: [osg-users] geometry shader example?

2010-03-22 Thread Wang Rui
Hi Yanglin,

See osggeometryshaders for details. Of course you missed it. :)

Wang Rui


2010/3/22 Yanling Liu :
> Hello, please forget me if this is a dummy question.
>
> Is there OSG geometry shader example available? Didn't find such an example
> in OSG 2.8.2 source tree examples folder (or I missed it).
>
> Thanks,
> Yanling
>
> ___
> 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] Geometry Drawing Performance

2010-09-14 Thread Frank Sullivan
Hello again,

There is something else that I thought of. Here is a diagram of what one of 
these drawables might look like:

 http://imgur.com/lefTl.gif

Because of the way that this drawable is generated (by recursively subdividing 
a quad), the indices are not necessarily in an order that is cache-friendly. 
For instance, the triangle in green is composed of indices 8, 12, 41. This may 
cause OpenGL to have to jump around the VBO in a random access fashion. Could 
this cause the lower frame rates when compared to my naive brute force method?

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





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


Re: [osg-users] Geometry Drawing Performance

2010-09-14 Thread Frank Sullivan
Another thing,

Looking at the GL Trace output in glslDevil, it looks like my program is using 
vertex arrays. I can't tell for sure, but I think it is using vertex arrays 
because I don't see any calls to glBindBuffer and the pointer used in 
glVertexPointer looks like an actual pointer to data (035ce860) rather than an 
offset into a VBO. 

Is there any way to force OSG to use VBOs? I'm using 2.8.2.

Thanks again,
Frank

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





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


Re: [osg-users] Geometry Drawing Performance

2010-09-14 Thread Roland Smeenk
Hi Frank,

you layout doesn't really look cache friendly. Take a look at the optimizer and 
it's options especially INDEX_MESH, VERTEX_POSTTRANSFORM and 
VERTEX_PRETRANSFORM. 

http://www.openscenegraph.org/projects/osg/wiki/Support/UserGuides/OptimizerOptions

And of course make sure your Geometry drawables are using the fast path.

--
Roland

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





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


Re: [osg-users] Geometry Drawing Performance

2010-09-15 Thread Robert Osfield
HI Frank,

On Tue, Sep 14, 2010 at 8:10 PM, Frank Sullivan
 wrote:
> In any case, I went for a naive implementation at first. Each drawable was an 
> osg::Geometry object attached to an osg::Geode (which again, may have one or 
> more osg::MatrixTransforms as parents). Each osg::Geometry had its own 
> Vec3Array as a vertex array. The performance wasn't bad. It was around 700fps 
> in wireframe mode on my machine. But I figured I could do better.

I'm sorry but you lots my on this thread when you said you had 700fps,
that's 10 times more than vsync, so already plenty fast enough.

Is there a reason why 700fps isn't more than good enough?

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


Re: [osg-users] Geometry Drawing Performance

2010-09-15 Thread Frank Sullivan
Hi guys,

The 700fps is just in wireframe mode with nothing else being drawn. Eventually 
I'll have to put it in a scene, and apply a special shader effect to it, which 
could reduce the frame rate. I don't know exactly what the frame rate will be, 
but I thought it might be fruitful (partially for curiosity's sake) to try some 
optimizations.

rosme, thanks very much for your help. It appears that those features have been 
added since the 2.8.3 tag. Do you think I should update from the trunk to get 
the newest stuff? Or is there a better/safer procedure that I should follow?

Frank

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





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


Re: [osg-users] Geometry Drawing Performance

2010-09-16 Thread Robert Osfield
HI Frank,

On Wed, Sep 15, 2010 at 7:12 PM, Frank Sullivan
 wrote:
> The 700fps is just in wireframe mode with nothing else being drawn. 
> Eventually I'll have to put it in a scene, and apply a special shader effect 
> to it, which could reduce the frame rate. I don't know exactly what the frame 
> rate will be, but I thought it might be fruitful (partially for curiosity's 
> sake) to try some optimizations.

Premature optimizations are something that you should avoid, you'll
often be chasing completely irrelevant bottlenecks.  I would strongly
recommend just implementing things in the way that you find easiest to
manage and using known standard fast paths and creating a well
balanced scene graph, just be sensible, then do some basic performance
testing it all looks good then move on.   If you were getting 50hrz
already then you have a problem, but at 700fps it suggests that things
are doing just fine and nothing to worry about.

As you implemented your shaders and introduce more data keep doing
benchmark tests.  I would suggest building up a family of animation
paths that make the camera follow paths that are representative of
application usage, then use these paths in your benchmarking so you
got a consistent base on which to compare.  As you progress you'll be
able to monitor how your app is doing and spot when things start to go
wrong, and if/when they do then you start looking into fixing the
problems that arise.

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


[osg-users] Geometry nodes with VBO

2011-06-23 Thread Joan Navarro
Hi,

I have a scene with a lot of .ive objects. I'm trying to get better frame 
rates. Now I want to apply the VBO technique to the ive model. For this goal, I 
traverse the object until I visit the geometry node (geom).

At this point I write the following orders:

geom->setUseDisplayList (false);
geom->setUseVertexBufferObjects(true);

As result the frame rate decreases. 

Is this the correct way to use VBO's with the .ive?

Can I make something to improve my program with this technique?

Thank you!

Cheers,
Joan

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





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


[osg-users] Geometry in a Geode

2014-02-25 Thread Quentin
Hi,
I'm trying to add some Geometry in the same geode but just one is display, how 
to display some geometry in a geode?

Thank you!

Cheers,
Quentin

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





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


Re: [osg-users] geometry and normals

2014-07-23 Thread Robert Osfield
Hi Gianni,

The SmoothingVisititor is really just a fallback for when no normals are
provided with a model, the best way to get the precisely the result you
want is to provider per vertex normals.

As for memory/GL efficiency, the most efficient way to the geometry to the
GPU is to use index primitives via the osg::DrawElements* primitive set,
this allows you to share vertex, normal, texture coordinate data etc.

Robert.


On 23 July 2014 13:59, Gianni Ambrosio  wrote:

> Hi All,
> I need to draw a surface. Looking at OSG examples I implemented it this
> way:
>
>
> Code:
>
>osg::Geometry* geometry = getGeometry();
>osg::Vec3Array* vertices = new osg::Vec3Array;
>GraphicVectorPtr graphicVector = road->graphicVector();
>size_t count = graphicVector->count();
>size_t addedPoints = 0;
>vertices->reserve(count * 3);
>for (size_t i = 0; i   const GraphicItem& item = (*graphicVector)[i];
>   if (item.points.size() == 9) {
>  vertices->push_back(osg::Vec3(item.points[0], item.points[1],
> item.points[2]));
>  vertices->push_back(osg::Vec3(item.points[3], item.points[4],
> item.points[5]));
>  vertices->push_back(osg::Vec3(item.points[6], item.points[7],
> item.points[8]));
>  addedPoints+=3;
>   }
>}
>geometry->setVertexArray(vertices);
>geometry->addPrimitiveSet(new
> osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, addedPoints));
>
>
>
>
> Now, first of all I would like to know if this is correct. I mean I want
> to draw triangles and I don't want to waste memory.
>
> The problem is that I see a basically flat surface. I tried then with a
> SmoothingVisitor on the geometry and the flat surface problem is solved. So
> I guess it was related to normals not set, right?
>
> Now, since I don't like so much how the surface is rendered with the
> SmoothingVisitor, is there a way of render the surface as it is drawn?
>
> Regards,
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=60407#60407
>
>
>
>
>
> ___
> 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] geometry and normals

2014-07-23 Thread Gianni Ambrosio
Hi Robert,
just because I had in mind a thread in this forum where it seems, on the 
contrary, that was NOT recommended for GL efficiency. Do you mean something 
like the code inside "createBackground()" of osggeometry.cpp example?

polyGeom->setVertexArray(new osg::Vec3Array(numCoords,myCoords));
... 
polyGeom->addPrimitiveSet(new 
osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP,numIndices,myIndices));

so, basically the same content of a obj/wavefront file?

Regards,
Gianni

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





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


Re: [osg-users] geometry and normals

2014-07-23 Thread Robert Osfield
HI Gianni,


On 23 July 2014 16:25, Gianni Ambrosio  wrote:

> Hi Robert,
> just because I had in mind a thread in this forum where it seems, on the
> contrary, that was NOT recommended for GL efficiency.


What isn't recommend is using the deprecated
osg::Geometry::setVertex/Color/Normal/etc./Indices(..) functionality,
sharing vertices via vertex indices isn't supported by OpenGL and has to be
simulated by caching vertex data on the CPU and then send this as a buffer.
 In OSG-3.2 these methods are deprecated and will be removed completely
from OSG-3.4 onwards.



> Do you mean something like the code inside "createBackground()" of
> osggeometry.cpp example?
>
> polyGeom->setVertexArray(new osg::Vec3Array(numCoords,myCoords));
> ...
> polyGeom->addPrimitiveSet(new
> osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP,numIndices,myIndices));
>

Using DrawElementsUShort is the correct way to provide indices and is fully
supported by OpenGL and is the recommend way to provide primitive data
where vertices can be shared.

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


Re: [osg-users] geometry and normals

2014-07-23 Thread Gianni Ambrosio
Thank you Robert for explanation and clarification.

Gianni

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





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


Re: [osg-users] geometry and normals

2014-07-24 Thread Gianni Ambrosio
Hi Robert,
one more question.

I would like to implement a method in my core class to get vertices and indices 
to use both in osg geometry and in a wavefront writer. The problem is the array 
type. I don't want to write the same code twice one for the wavefront writer 
and one for osg geometry just because they use different array/vector types.
The wavefront writer can use C arrays or std::vectors. 
I see that a C array can be used in a DrawElementsUShort constructor.
On the other side setVertexArray gets an osg::Array as parameter. I'm trying to 
understand how to use a C array or a std::vector instead.

In any case at a certain point I have memory allocation for vertices and 
indices twice (the array I created and the copy for osg geometry).

Regards,
Gianni

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





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


Re: [osg-users] geometry and normals

2014-07-24 Thread Robert Osfield
HI Giannu,

I can't work out what your "one more question" is, I've re-read what you
written and am just as confused.

Robert.


On 24 July 2014 11:43, Gianni Ambrosio  wrote:

> Hi Robert,
> one more question.
>
> I would like to implement a method in my core class to get vertices and
> indices to use both in osg geometry and in a wavefront writer. The problem
> is the array type. I don't want to write the same code twice one for the
> wavefront writer and one for osg geometry just because they use different
> array/vector types.
> The wavefront writer can use C arrays or std::vectors.
> I see that a C array can be used in a DrawElementsUShort constructor.
> On the other side setVertexArray gets an osg::Array as parameter. I'm
> trying to understand how to use a C array or a std::vector instead.
>
> In any case at a certain point I have memory allocation for vertices and
> indices twice (the array I created and the copy for osg geometry).
>
> Regards,
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=60430#60430
>
>
>
>
>
> ___
> 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] geometry and normals

2014-07-24 Thread Gianni Ambrosio
OK, is there a way to pass a C array to geometry->setVertexArray()?

Gianni

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





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


Re: [osg-users] geometry and normals

2014-07-24 Thread Trajce Nikolov NICK
Hi Gianni,

this is more into STL programming. This link explains cheap conversion
between C array and STL vector

http://stackoverflow.com/questions/1733143/converting-between-c-stdvector-and-c-array-without-copying

Nick


On Thu, Jul 24, 2014 at 1:28 PM, Gianni Ambrosio 
wrote:

> OK, is there a way to pass a C array to geometry->setVertexArray()?
>
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=60432#60432
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



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


Re: [osg-users] geometry and normals

2014-07-24 Thread Gianni Ambrosio
Hi Nick,
no this is not a problem of converting C arrays to stl vectors. I'm going to 
explain the case in detail soon ..

Gianni

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





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


Re: [osg-users] geometry and normals

2014-07-24 Thread Gianni Ambrosio
Here I am with an example that explains my scenario.
I commented the code with questions, hoping this is clearer.


Code:

// This is a core road that contains all data and must not know of OSG at all
class Road
{
// This method builds vertices and indexes based on the internal data
// It must not use osg::Arrays but C arrays or std::vectors
void getPointsAndConnections(float*& oPoints, int& oPointSize, int*& 
oConnections, int& oConnectionSize);
}

// This class can not use OSG classes either (so no osg::Array here)
class WaveFrontWriter
{
// This method is pleased to use getPointsAndConnection() since it 
returns useful data.
// Here I can use a C array of an std::vector, not osg::Array
void write(Road* road) {
road->getPointsAndConnections(vertices, vsize, indices, isize);
// here vertices, vsize, indices, isize are used for writing 
the file ...
}
}

// Here is the 3D representation of the road
class OsgRoad
{
// This method is also pleased to use getPointsAndConnection() of Road 
core class
void draw(Road* road) {
road->getPointsAndConnections(vertices, vsize, indices, isize);
osg::Geometry* geometry = new osg::Geometry();
// how to use incoming C arrays (or std::vectors would be also 
nice) in the following call?
geometry->setVertexArray();
// the following call luckily accepts C arrays but ...
// 1) does it make a copy of the passed C array? (if so, that 
means memory duplication in my case)
// 2) if not, is it responsible of deallocation?
addPrimitiveSet(new 
osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES, isize, indices));
}
}




Thank you in advance.
Gianni

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





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


Re: [osg-users] geometry and normals

2014-07-24 Thread Robert Osfield
HI Gianni,

An osg::Array subclass like Vec3Array "is a" std::vector<> so you can use
all your usual std::vector<> access methods and code for it.  Sample
applies to DrawElementsUShort.

The easist way to manage things would be simply have your road code build
it using osg::Vec3Array, or get it to fill in the std::vector<> passed in
from external OSG glue code that passes in the std::vector<> from the
Vec3Array, i.e.


void MyClass::MyMethodPopulatingVertexData(std::vector& vertices)
{
fill in data
}

myobject->MyMethodPopulatingVertexArray(*vec3Array);

If don't want to even integrate the std::vector but have your own
equivilant to Vec3 then you'll end up needing to copy the data across to
Vec3Array yourself or go the more complicated route of implementing your
own osg::Array subclass to integrate your own data.  The later requires
more work to glue it together though, you'll need to look at existing
osg::Array subclasses for guidance on how to do this.

Robert.

On 24 July 2014 13:54, Gianni Ambrosio  wrote:

> Here I am with an example that explains my scenario.
> I commented the code with questions, hoping this is clearer.
>
>
> Code:
>
> // This is a core road that contains all data and must not know of OSG at
> all
> class Road
> {
> // This method builds vertices and indexes based on the internal
> data
> // It must not use osg::Arrays but C arrays or std::vectors
> void getPointsAndConnections(float*& oPoints, int& oPointSize,
> int*& oConnections, int& oConnectionSize);
> }
>
> // This class can not use OSG classes either (so no osg::Array here)
> class WaveFrontWriter
> {
> // This method is pleased to use getPointsAndConnection() since it
> returns useful data.
> // Here I can use a C array of an std::vector, not osg::Array
> void write(Road* road) {
> road->getPointsAndConnections(vertices, vsize, indices,
> isize);
> // here vertices, vsize, indices, isize are used for
> writing the file ...
> }
> }
>
> // Here is the 3D representation of the road
> class OsgRoad
> {
> // This method is also pleased to use getPointsAndConnection() of
> Road core class
> void draw(Road* road) {
> road->getPointsAndConnections(vertices, vsize, indices,
> isize);
> osg::Geometry* geometry = new osg::Geometry();
> // how to use incoming C arrays (or std::vectors would be
> also nice) in the following call?
> geometry->setVertexArray();
> // the following call luckily accepts C arrays but ...
> // 1) does it make a copy of the passed C array? (if so,
> that means memory duplication in my case)
> // 2) if not, is it responsible of deallocation?
> addPrimitiveSet(new
> osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES, isize, indices));
> }
> }
>
>
>
>
> Thank you in advance.
> Gianni
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=60435#60435
>
>
>
>
>
> ___
> 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] geometry and normals

2014-07-25 Thread Bram Vaessen
it seems like you are using referenced vertices in your roads mesh? (at least 
that is what I understand from int*& oConnections
(the int references vertices indexes right?)

I think that if you want to use the accelerated drawing you should convert it 
to simple vertex arrays, where the vertices are not indexed.

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





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


Re: [osg-users] geometry and normals

2014-07-25 Thread Gianni Ambrosio
Hi STTrife,
which is the difference between what you say and what Robert suggested here?

robertosfield wrote:
> 
> As for memory/GL efficiency, the most efficient way to the geometry to the 
> GPU is to use index primitives via the osg::DrawElements* primitive set, this 
> allows you to share vertex, normal, texture coordinate data etc.
> 


Regards,
Gianni

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





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


Re: [osg-users] geometry and normals

2014-07-25 Thread Bram Vaessen
Well to give better advice, I would need to understand what is exactly stored 
in float*& oPoints and int*& oConnections.

What I assume is that oPoints (an array of floats) contains
x1,y1,z1,x2,y2,z2, etc.
and then oConnections (an array of ints) contains a serie of references to 
those points for example 2 refers to x2,y2,z2.

Maybe you could first tell something about this (if this is correct or not) 
before I comment further... maybe I misunderstand what is in those arrays...

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





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


Re: [osg-users] geometry and normals

2014-07-25 Thread Gianni Ambrosio
OK,
this is an exaple (flat square road):

Code:

   osg::Geometry* geometry = getGeometry();
   osg::Vec3 myCoords[] =
   {
  osg::Vec3(-1.0f,1.0f,0.0f),
  osg::Vec3(-1.0f,-1.0f,0.0f),
  osg::Vec3(1.0f,-1.0f,0.0f),
  osg::Vec3(1.0f,1.0f,0.0f)
   };
   int numCoords = sizeof(myCoords)/sizeof(osg::Vec3);
   geometry->setVertexArray(new osg::Vec3Array(numCoords,myCoords));
   unsigned short myIndices[] =
   {
  0,
  1,
  2,
  0,
  2,
  3
   };
   int numIndices = sizeof(myIndices)/sizeof(unsigned short);
   geometry->addPrimitiveSet(new 
osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES,numIndices,myIndices));




Gianni

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





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


Re: [osg-users] geometry and normals

2014-07-25 Thread Bram Vaessen
First: In your example the coordinates are stored in an array of Vec3, but in 
the other code you posted, the oPoints is an array of float so there seems to 
be a bit of a contradiction there?

Anyway you have indexed vertices obviously, but you can also use non-indexed 
vertices. In that case you just specify the vertices for each triangle 
separately. 

When I started working on my project I heard or read that this is better, 
because it can be handled faster by modern graphics card (something about the 
card not being able to use the fasted render path when indices are used), and 
the extra memory it takes is less important because modern graphics cards have 
plenty of memory. 

But I can't find a solid source on that now so I'm really starting to doubt if 
this is (still) true...

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





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


Re: [osg-users] geometry and normals

2014-07-25 Thread Robert Osfield
Hi Bram,

Most modern hardware will be best driven using indexed primitives sets
rather than duplicating vertices - it typically wins on memory bandwidth
and ability to utilize the vertex cache on the GPU.  If the amount of
shared indices is low then duplicating vertices is likely to be better.

Robert.


On 25 July 2014 14:30, Bram Vaessen  wrote:

> First: In your example the coordinates are stored in an array of Vec3, but
> in the other code you posted, the oPoints is an array of float so there
> seems to be a bit of a contradiction there?
>
> Anyway you have indexed vertices obviously, but you can also use
> non-indexed vertices. In that case you just specify the vertices for each
> triangle separately.
>
> When I started working on my project I heard or read that this is better,
> because it can be handled faster by modern graphics card (something about
> the card not being able to use the fasted render path when indices are
> used), and the extra memory it takes is less important because modern
> graphics cards have plenty of memory.
>
> But I can't find a solid source on that now so I'm really starting to
> doubt if this is (still) true...
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=60460#60460
>
>
>
>
>
> ___
> 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] geometry and normals

2014-07-26 Thread Gianni Ambrosio

STTrife wrote:
> 
> Anyway you have indexed vertices obviously, but you can also use non-indexed 
> vertices. In that case you just specify the vertices for each triangle 
> separately.
> 

That's basically my first implementation and the reason why I asked 
confirmation here was to understand which is the better way in my case. In a 
road I have always adjacent triangles (holes or disjointed parts are very rare) 
so I think what Robert suggested is the proper solution.

STTrife wrote:
> 
> Now I've confused myself :P

I was too, that's why I asked here ;)

Regards
Gianni

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





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


Re: [osg-users] Geometry Merging Problem

2013-02-19 Thread Adam Stambler
Hi Folks,

Sorry for the spam.  It turns out my problem was due to how I was coloring
my selected geometry.  For some reason changing the primitive color is
changing the colors of multiple geodes.

Sorry for the spam.
Adam

On Tue, Feb 19, 2013 at 11:38 AM, Adam Stambler  wrote:

> Hi All,
>
> I believe I am having trouble with OSG automatically optimizing my sets of
> Geometry.
>
> I am visualizing a 3D reconstruction using OSG.  Each part of the
> reconstruction is put into its own OSG Geometry and Geode.  All of the
> parts are then put a group and saved to an .ive file.  In another
> application, I load the ive and try and select each reconstructed Geode
> node.  When I click on one part ,   parts are selected.  It looks like
> Geometry in a few  nodes have been automatically merged.
>
> My question is:  is there any automatic optimization somewhere?  Perhaps
> things are optimized when they are made IVE file?  Either I implemented
> something incorrectly (very possible) or something modifies my scene
> graph.  I am not explicitly calling osgUtil::Optimizer.
>
> Thanks for any insight,
> Adam
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Geometry Merging Problem

2013-02-20 Thread Sergey Polischuk
Hi if you are using osgconv at any stage to convert your model, it implicitly invokes optimizer. you can control this with env var OSG_OPTIMIZER, to turn optimizer off you can pass OSG_OPTIMIZER=OFF Cheers. 19.02.2013, 20:38, "Adam Stambler" :Hi All,I believe I am having trouble with OSG automatically optimizing my sets of Geometry.I am visualizing a 3D reconstruction using OSG.  Each part of the reconstruction is put into its own OSG Geometry and Geode.  All of the parts are then put a group and saved to an .ive file.  In another application, I load the ive and try and select each reconstructed Geode node.  When I click on one part ,   parts are selected.  It looks like Geometry in a few  nodes have been automatically merged. My question is:  is there any automatic optimization somewhere?  Perhaps things are optimized when they are made IVE file?  Either I implemented something incorrectly (very possible) or something modifies my scene graph.  I am not explicitly calling osgUtil::Optimizer. Thanks for any insight,Adam ,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Geometry::setNormalBinding() and setColorBinding()

2016-06-14 Thread Antoine Rennuit
Hi all,

I have been using Geometry::setNormalBinding() and setColorBinding() in my code 
for years but I have just realized that the code is now deprecated because it 
is not efficient. I have read some more details about it 
here.

Now I am looking for the new and preferred way to do these bindings and have 
looked in many many places. The problem is they all seem to refer to the dirty 
old way of doing things, even the quick start 
guide, or 
the 
wiki.
 I have also looked in the examples but there are so many that I am lost.

Anyone can give me a hint here or point me to a relevant example or link?

Kind regards,

Antoine

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


[osg-users] geometry shader with opengles

2018-04-02 Thread lin hui
Hi,

I want to know if osg support geometry shader with opengles3.2?I have changed 
the profile to GLES3.I'm now testing on IOS.
I have info like this:
GEOMETRY glCompileShader "" FAILED
GEOMETRY Shader "" infolog:
ERROR: 0:15: 'layout' : syntax error: syntax error

and this is my code:

#version 300 es

precision highp float;
precision highp int;

uniform mat4 osg_ModelViewMatrix;
uniform mat4 osg_ViewMatrix;
uniform mat4 osg_ProjectionMatrix; 
uniform mat4 osg_ViewMatrixInverse;
uniform float TubeRadius;
uniform int EdgeCount;
uniform vec3 DirLightDir_V3;


layout(points) in;

layout(triangle_strip, max_vertices = 4) out;

out vec2 gf_uv;

void main()
{
vec4 offset0 = vec4(0,0,0,0);
vec4 offset1 = vec4(1,0,0,0);
vec4 offset2 = vec4(1,1,0,0);
vec4 offset3 = vec4(0,1,0,0);
gl_Position = osg_ProjectionMatrix * (gl_in[0].gl_Position + offset0);
gf_uv = offset0.xy;
EmitVertex();

gl_Position = osg_ProjectionMatrix * (gl_in[0].gl_Position + offset1);
gf_uv = offset1.xy;

EmitVertex();

gl_Position = osg_ProjectionMatrix * (gl_in[0].gl_Position + offset3);
gf_uv = offset3.xy;

EmitVertex();

gl_Position = osg_ProjectionMatrix * (gl_in[0].gl_Position + offset2);
gf_uv = offset2.xy;

EmitVertex();
EndPrimitive();
}

Any help is welcome!

Thank you!

Cheers,
lin

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





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


Re: [osg-users] geometry shader support submitted.

2008-01-07 Thread Gordon Tomlinson
Very Cool  Mike

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mike
Weiblen
Sent: Monday, January 07, 2008 3:47 PM
To: OpenSceneGraph Users
Subject: [osg-users] geometry shader support submitted.

Hi all,

I've just posted an initial implementation of OSG geometry shaders to the
osg-submissions list.

Included is a simple example "osgshaders2": the app sends 8 points at
corners of a cube, the geom shader generates animated line segment
crosshairs at those corners.

Things yet to be done (I cannot commit to these, so pls contribute):
- fully implement the non-square matrices in osg::Uniform
- implement the adjacency types in DrawPrimitives
- .osg file read/write support
- .ive file read/write support
- longer term: OSG could probably do some really smart/cool stuff, above and
beyond basic GL wrapping, in somehow associating geom shaders with the
corresponding DrawPrimitive.

Cheers
-- mew

___
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] geometry shader support submitted.

2008-01-07 Thread Emre Koc
Thanks Mike,

Now we need some time to develop some tessalators :)

/emre

On Jan 7, 2008 10:47 PM, Mike Weiblen <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've just posted an initial implementation of OSG geometry shaders to
> the osg-submissions list.
>
> Included is a simple example "osgshaders2": the app sends 8 points at
> corners of a cube, the geom shader generates animated line segment
> crosshairs at those corners.
>
> Things yet to be done (I cannot commit to these, so pls contribute):
> - fully implement the non-square matrices in osg::Uniform
> - implement the adjacency types in DrawPrimitives
> - .osg file read/write support
> - .ive file read/write support
> - longer term: OSG could probably do some really smart/cool stuff, above
> and beyond basic GL wrapping, in somehow associating geom shaders with
> the corresponding DrawPrimitive.
>
> Cheers
> -- mew
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Emre Koc
Sabanci University
Faculty of Engineering and Natural Sciences
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] geometry shader support submitted.

2008-01-08 Thread Robert Osfield
Hi All,

The new geometry shader support is now checked into OSG SVN.  I'll tag
a 2.3.3 dev release tomorrow to give us a snapshot that rolls it up.

Many thanks to Mike for his efforts over the Christmas/New year break ;-)

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


Re: [osg-users] geometry shader support submitted.

2008-01-08 Thread Gerrick Bivins
AWESOME!Been waiting to see this in osg! Great work Mike!
biv

On Jan 8, 2008 8:03 AM, Robert Osfield <[EMAIL PROTECTED]> wrote:

> Hi All,
>
> The new geometry shader support is now checked into OSG SVN.  I'll tag
> a 2.3.3 dev release tomorrow to give us a snapshot that rolls it up.
>
> Many thanks to Mike for his efforts over the Christmas/New year break ;-)
>
> Robert.
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] geometry shader support submitted.

2008-01-08 Thread Jeremy Moles
On Tue, 2008-01-08 at 14:03 +, Robert Osfield wrote:
> Hi All,
> 
> The new geometry shader support is now checked into OSG SVN.  I'll tag
> a 2.3.3 dev release tomorrow to give us a snapshot that rolls it up.
> 
> Many thanks to Mike for his efforts over the Christmas/New year break ;-)

Naturally, the video card in my laptop (which added about $1k to the
price) doesn't support Geometry Shaders.

*sigh*

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

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


Re: [osg-users] geometry shader support submitted.

2008-01-08 Thread Mike Weiblen
On Tue, January 8, 2008 09:38, Jeremy Moles wrote:
> Naturally, the video card in my laptop (which added about $1k to the
> price) doesn't support Geometry Shaders.
>
> *sigh*

Not to gloat, but I happily recommend the Dell Precision M4300 laptop with
NVIDIA Quadro FX 360M graphics.  And kudos to Dell that you can still buy
brand-new systems with XP not Vista!!

-- mew

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


[osg-users] Geometry drawable color after Triangulation

2009-06-24 Thread Nadia Comanici
Hi,

I have tried applying a DelaunayTriangulator on a set of points and generating 
the wireframe and the solid model, from the triangles that the 
DelaunayTriangulator generates. The wireframe model looks really great, but the 
solid one has the same color on all the faces, so I cannot distinguish it as an 
3D object. What should I set in order to see the 3D model, not just a big chunk 
of the same color?

The code I used looks like this:

Code:

char* fileName = argv[1];

//read the points
osg::Vec3Array* points = new osg::Vec3Array();  

unsigned nPoints = ReadFile(fileName,points);
if (nPoints == -1)
return 0;   

osg::Geometry* geometry = new osg::Geometry();  

// Generate the triangles
osg::ref_ptr triangulation = new 
osgUtil::DelaunayTriangulator(points);
triangulation->triangulate();   

//set the points and triangles
geometry->setVertexArray(points);
geometry->addPrimitiveSet(triangulation->getTriangles());   

//set the color
osg::Vec4Array * colors = new osg::Vec4Array(1);
colors->push_back(osg::Vec4d(0.0,1.0,0.0,1.0));
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL); 

//create geode and add the geometry
osg::Geode* geode = new osg::Geode();
geode->addDrawable(geometry);

//create StateSet and add it to the geode
osg::StateSet *set = new osg::StateSet();
set->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
set->setMode(GL_LIGHTING, osg::StateAttribute::ON);
osg::PolygonMode* polymode = new osg::PolygonMode;

polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE); 
 

set->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
geode->setStateSet(set);

//view the result
osgViewer::Viewer viewer;   
viewer.setSceneData(geode);
viewer.setUpViewInWindow(100, 100, 800, 600); 
viewer.run();   




Thank you!

Cheers,
Nadia

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





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


Re: [osg-users] Geometry and setUseDisplayList(false)

2010-12-10 Thread Stephan Maximilian Huber
Am 10.12.10 16:32, schrieb Gabriel Nützi:
> Hi everybody
> 
> I have a quite strange problem, I am a newbie, and probably it is a simple 
> setting, which I do not know:
> 
> I have subclassed from osg:Geometry and  have set up in this class my Mesh 
> which I want to render... the thing works fine, except, that when I use 
> setUseDisplayList(false), (because I update my vertices every rendering loop 
> in this viewer loop)  , my mesh is rendered, but it seems that there is a 
> somehow ,depending on the camera position, a bounding volume and the mesh 
> gets sometimes  not rendered looks like  it is culled somehow...

if you update your geometry, you must update its boundingbox. just call
dirtyBound() on your geometry, implement computeBound() in your subclass
or provide a "maximum" boundingbox with setInitialBound() when creating
your object.

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


Re: [osg-users] Geometry and setUseDisplayList(false)

2010-12-11 Thread Gabriel Nützi
Thank you verymuch!

This was helpful! I think, will try it!

I almost thought it is probably such an error!

Thanks !!

GAbriel

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





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


[osg-users] Geometry Generated object UV texture?

2011-05-05 Thread Nan WANG
Hi,
Anybody knows how to set a UV coordinate on a geometry shader generated object?

I tested my U-moving VS FS shader with a osg::Sphere and osg::box.
The uv coordinate can be mapping properly in VS and FS

When i apply this two Shaders to a Geometry Shader generated objectsthe 
texture2D mapping is not right...

i think it should be a problem of having right UV on GS generated object?

How can I give a UV to GS generated object? 

... 

Thank you!

Cheers,
Nan

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





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


Re: [osg-users] Geometry nodes with VBO

2011-06-23 Thread Robert Osfield
Hi Joan,

On Thu, Jun 23, 2011 at 9:33 AM, Joan Navarro  wrote:
> I have a scene with a lot of .ive objects. I'm trying to get better frame 
> rates. Now I want to apply the VBO technique to the ive model. For this goal, 
> I traverse the object until I visit the geometry node (geom).
>
> At this point I write the following orders:
>
> geom->setUseDisplayList (false);
> geom->setUseVertexBufferObjects(true);
>
> As result the frame rate decreases.
>
> Is this the correct way to use VBO's with the .ive?

VBO's and .ive file are completely orthogonal features, so to enable
VBO's you do as you've done, and this doesn't change whether the scene
graph was created manually or from plugin.

The only thing I would add is that when VBO's are enabled the display
lists are not used so the the UseDisplayList setting is irrellevant,
it's only if VBO's aren't supported will the Drawable fallback to
display lists.  So for you case doing a
setUseVertexBufferobjects(true) should be sufficient.

> Can I make something to improve my program with this technique?

Whether VBO's will help performance depends a great deal on your scene
graph - if there are tens of thousands of separate osg::Geometry on
screen at any time then the draw dispatch is likely to be a bottleneck
so using display lists that use less OpenGL class can be faster than
using VBO's as the VBO's require more OpenGL calls to set up each time
a Geometry is sent.  VBO's do tend to more efficient down on the GPU
though.

Also whether VBO's are faster or not depends upon your drivers and
also the way you've packed you primitive and vertex/colour/normal data
in your osg::Geometry - for instance if the osg::Geometry has to drop
down to OpenGL slow paths to render your Geometry then will be a large
CPU overhead associated with dispatching the data.

This topic has been covered many times on osg-users so please have a
look through the archives.

Oh.. And make sure you only do performance tests with a release build
because debug builds totally throw off any analysis.

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


Re: [osg-users] Geometry nodes with VBO

2011-06-23 Thread Sergey Polischuk
Hi, Joan

By default osg uses display lists, and they are usually at least as fast as fbo 
when drawing static geometry. If your geometry tristripped you get a lot of 
short strips, with vbo this issues a lot of drawing gl commands. With display 
lists driver usually can optimize them to draw together in one batch so it can 
be a lot faster. If you use triangle lists it should be about even. If you need 
to use vbo's you will get best speed with indexed triangle lists. Try to 
process your models with osgUtil::Optimizer with options INDEX_MESH | 
VERTEX_PRETRANSFORM | VERTEX_POSTTRANSFORM.

Cheers,
Sergey.

23.06.2011, 12:33, "Joan Navarro" :
> Hi,
>
> I have a scene with a lot of .ive objects. I'm trying to get better frame 
> rates. Now I want to apply the VBO technique to the ive model. For this goal, 
> I traverse the object until I visit the geometry node (geom).
>
> At this point I write the following orders:
>
> geom->setUseDisplayList (false);
> geom->setUseVertexBufferObjects(true);
>
> As result the frame rate decreases.
>
> Is this the correct way to use VBO's with the .ive?
>
> Can I make something to improve my program with this technique?
>
> Thank you!
>
> Cheers,
> Joan
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=40785#40785
>
> ___
> 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] Geometry nodes with VBO

2011-06-23 Thread Joan Navarro
Thanks Robert and hybr for your explanations, now it's more clear.

I will use the optimizer options too.

Cheers,
Joan

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





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


Re: [osg-users] Geometry nodes with VBO

2011-09-29 Thread Ga Scan
Hi,

I am new to OSG but experienced in OpenGL
I need to implement some OpenGL code with OSG.

I am using VBOs to render new sets of 3D points (~1 million / frame)
inside every glutDisplayFunc callback.

I have studied the examples and found
osgviewerGLUT is a good starting point
but I cant seem to find all the right pieces to accomplish the same in OSG.

The following example code will render points inside glutDisplayFunc callback.
Can this be reproduced with OSG ?

glEnableClientState(GL_VERTEX_ARRAY);
glBindBuffer(GL_ARRAY_BUFFER, pvbo);
glVertexPointer(3, GL_FLOAT, 0, 0);

float *buffer = captureBuffer();

glBufferData(GL_ARRAY_BUFFER, buffer_size,
 buffer, 
GL_DYNAMIC_DRAW);
releaseBuffer();

glDrawArrays(GL_POINTS, 0, num_points);
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
glDisableClientState(GL_VERTEX_ARRAY);


Thank you!

Cheers,
g

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





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


Re: [osg-users] Geometry nodes with VBO

2011-09-29 Thread Robert Osfield
Hi Ga,

The OSG supports VBO's within the osg::Geometry class so could do what
you need in very straight forward - far easier than with raw OpenGL.
Just do geometry->setUseVertexBufferObjects(true);  See osggeometry
for more details on osg::Geometry.

Robert.

On Fri, Sep 23, 2011 at 5:27 PM, Ga Scan  wrote:
> Hi,
>
> I am new to OSG but experienced in OpenGL
> I need to implement some OpenGL code with OSG.
>
> I am using VBOs to render new sets of 3D points (~1 million / frame)
> inside every glutDisplayFunc callback.
>
> I have studied the examples and found
> osgviewerGLUT is a good starting point
> but I cant seem to find all the right pieces to accomplish the same in OSG.
>
> The following example code will render points inside glutDisplayFunc callback.
> Can this be reproduced with OSG ?
>
>                glEnableClientState(GL_VERTEX_ARRAY);
>                glBindBuffer(GL_ARRAY_BUFFER, pvbo);
>                glVertexPointer(3, GL_FLOAT, 0, 0);
>
>                float *buffer = captureBuffer();
>
>                glBufferData(GL_ARRAY_BUFFER, buffer_size,
>                                                             buffer, 
> GL_DYNAMIC_DRAW);
>                releaseBuffer();
>
>                glDrawArrays(GL_POINTS, 0, num_points);
>                glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
>                glDisableClientState(GL_VERTEX_ARRAY);
>
>
> Thank you!
>
> Cheers,
> g
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=42929#42929
>
>
>
>
>
> ___
> 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] Geometry nodes with VBO

2011-09-29 Thread Ga Scan
Hi,

I assume someone will interested in this,
enough to read my code and reply with suggestions.
I am presenting code that should replace the OpenGL code presented above.
Both codes are run insides the glutDisplayFunc callback, "display call".
I have also added the OSG object initialization code
required prior to the OSG display call.
I expect this is where I need other suggestions.


1) This is the code used in each OSG "display call".
How can I copy byte-for-byte, like memcpy,
from the external stream "buffer" into the VBO ?


Code:

float *buffer = captureBuffer();

for (uint j = 0; j < vec->size(); j++)
{
vec->at(j) = osg::Vec3(buffer[j*3],buffer[j*3+1],buffer[j*3+2]);
vec->dirty();
}

releaseBuffer();

// update and render the scene graph
if (viewer.valid()) viewer->frame();





2) This is the code to initialize OSG display & objects.
I expect I am doing too much work hereHELP !


Code:

//Initialize an OSG scene
osg::ref_ptr viewer;
osg::observer_ptr window;
osg::ref_ptr loadedModel = createScene();

// Create objects to store geometry and vertices.
osg::ref_ptr geode = new osg::Geode;
osg::ref_ptr geom = new osg::Geometry;
osg::ref_ptr vec = new osg::Vec3Array;

// create the view of the scene.
viewer = new osgViewer::Viewer;
window = viewer->setUpViewerAsEmbeddedInWindow(100,100,800,600);
viewer->setSceneData(loadedModel.get());
viewer->setCameraManipulator(new osgGA::TrackballManipulator);
viewer->addEventHandler(new osgViewer::StatsHandler);
viewer->realize();

osg::Node* createScene(void)
{
// Disable Display lists and setup Vertex Buffer Objects
geom->setUseDisplayList (false);
geom->setUseVertexBufferObjects(true);

// Set VBO to STREAMING since attributes are changing per frame
osg::VertexBufferObject* df = geom->getOrCreateVertexBufferObject();
df->setUsage (GL_DYNAMIC_DRAW);//(GL_STREAM_DRAW);//

vec->resize(buffer_size);
//initial box size for auto setup boundry// FIXME: draw a cube in the 
scene
vec->at(0)=osg::Vec3( 2.0, 2.0, 2.0);
vec->at(1)=osg::Vec3(-2.0,-2.0,-2.0);
vec->at(2)=osg::Vec3(-2.0, 2.0, 2.0);
vec->at(3)=osg::Vec3( 2.0,-2.0,-2.0);
geom->setVertexArray( vec.get() );

osg::Vec4Array* c = new osg::Vec4Array;
c->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
geom->setColorArray(c);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);

osg::Vec3Array* n = new osg::Vec3Array;
n->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
geom->setNormalArray(n);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);

geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS,

   0, buffer_size));
geode->addDrawable (geom.get());

return (geode);
}





Thank you!

Cheers,
Ga

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





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


  1   2   >