Re: [osg-users] How to modify the array of vertex from a Geometry object

2008-02-10 Thread Rubén López
Hi,

At this point, I would recommend to use a debugger and enter into the
OSG code with it. It may not be a bug in the OSG code, but maybe by
looking at what OSG is doing you can find how to fix your own code.

As a hint on where to look. The dirty() call should be forcing a new
compileBuffer() call in the next draw stage, and this should mean a
glBufferSubData call uploading the new vertex data to the GPU. If this
is OK, then I would look at the geometry draw() call, to see if it is
using the VBO path or another one.

Maybe Robert can help you a bit more with this when he is back next
week.

Regards.
Rubén

El vie, 08-02-2008 a las 11:17 +0100, lucas Grijander escribió:
> Hi!
> 
> I add the vbo->dirty() but it doesn't change anything. I had a look to
> the vbo data and it's fine, it changes, but the render is not
> updated any idea??
> 
> regards,
> 
> Crisalix.
> 
> 
> 
> 
> 
> __
> > From: [EMAIL PROTECTED]
> > To: osg-users@lists.openscenegraph.org
> > Date: Thu, 7 Feb 2008 23:38:00 +0100
> > Subject: Re: [osg-users] How to modify the array of vertex from a
> Geometry object
> > 
> > Hi,
> > 
> > I think that the only thing missing is a vbo->dirty()
> > 
> > Regards
> > 
> > El jue, 07-02-2008 a las 19:31 +0100, lucas Grijander escribió:
> > > Thanks Rubén,
> > > 
> > > I'm trying to use VBO, but I think something is missing... I added
> > > this to the creation of my geometry:
> > > 
> > > myGeom->setSupportsDisplayList(false);
> > > myGeom->setUseDisplayList(false);
> > > myVertexBuffer = myGeom->getOrCreateVertexBufferObject();
> > > myVertexBuffer->setArray(0,&v);
> > > myVertexBuffer->setUsage(GL_STREAM_DRAW_ARB);
> > > myGeom->setUseVertexBufferObjects(true);
> > > 
> > > and then inside the callback I'm try to modify the vertex data:
> > > 
> > > osg::Vec3Array *test = dynamic_cast > > *>(testNx->myVertexBuffer->getArray(0));
> > > 
> > > for(int i = 0; i < numVertex; i++)
> > > {
> > > NxMat34 pose = listShapes.at(i)->shape->getGlobalPose(); 
> > > osg::Vec3f trans = osg::Vec3(pose.t.x,pose.t.y,pose.t.z);
> > > 
> > > test->at(i) = trans;
> > > } 
> > > 
> > > but nothing changes in the render the object does not move.
> Does
> > > anybody know what is missing??
> > > 
> > > thanks in advance
> > > 
> > > Crisalix.
> > > 
> > > 
> > > 
> > >
> __
> > > > From: [EMAIL PROTECTED]
> > > > To: osg-users@lists.openscenegraph.org
> > > > Date: Wed, 6 Feb 2008 21:33:51 +0100
> > > > Subject: Re: [osg-users] How to modify the array of vertex from
> a
> > > Geometry object
> > > > 
> > > > Hi,
> > > > 
> > > > Some hints:
> > > > 
> > > > 1. Be sure that test->size() is equal to numVertex
> > > > 
> > > > 2. I don't know what the "at" method is, I couldn't find it
> either
> > > on
> > > > the TemplateArray class or the std::vector class. Try with the
> > > vector []
> > > > operator, ie: (*test)[i] = trans
> > > > 
> > > > 3. If you are updating the vertex data once per frame, don't use
> > > display
> > > > lists, it is the worst thing that you can ever do! It is cheaper
> > > even to
> > > > use direct mode. Use vertex buffer objects and configure the VBO
> > > > (getOrCreateVertexBufferObject) in streaming mode
> (GL_STREAM_DRAW).
> > > > 
> > > > Hope this helps.
> > > > 
> > > > Regards.
> > > > 
> > > > Rubén
> > > > 
> > > > El mié, 06-02-2008 a las 14:08 +0100, lucas Grijander escribió:
> > > > > Dear all,
> > > > > 
> > > > > I have to create a 3D surface, and then such surface will be
> > > modified during the application with several deformations. I've
> tried
> > > to create a Geometry object, then I set the VertexArray, and
> finally
> > > inside the render callback I update such vertex with the new ones.
> I
> > > got some errors during the rendering:
> > > > > 
> > > > > Warning: detected OpenGL error "value not valid" after
> > > RenderBin::draw(,)
> > > > > 
> > > > > Does anyone has an idea of such error? In addition, I'm sure
> the
> > > way I am accessing the vertex is not the right one, anybody knows
> the
> > > best way?
> > > > > 
> > > > > here is the code:
> > > > > 
> > > > > 
> > > > > //Create the 3D geometry
> > > > >
> > >
> -
> > > > > osg::Vec3Array(m*n));
> > > > > osg::Vec2Array& t = *(new osg::Vec2Array(m*n));
> > > > > osg::Vec4Array& col = *(new osg::Vec4Array(1));
> > > > > 
> > > > > col[0][0] = col[0][1] = col[0][2] = col[0][3] = 1.0f;
> > > > > 
> > > > > int index = 0;
> > > > > for( i = 0; i < m; i++ )
> > > > > {
> > > > > for(j = 0; j < n; j++)
> > > > > {
> > > > > v[index][0] = i;
> > > > > v[index][1] = 0;
> > > > > v[index][2] = j;
> > > > > 
> > > > > t[index][0] = (float)i/(m-1);
> > > > > t[index][1] = (float)j/(n-1);
> > > > > 
> > > > > index++;
> > > > > }
> > > > > }
> > > > > 
> > > > > myGeom = new osg::Geometry;
> > > > > 
> > > > 

Re: [osg-users] How to modify the array of vertex from a Geometry object

2008-02-07 Thread Rubén López
Hi,

I think that the only thing missing is a vbo->dirty()

Regards

El jue, 07-02-2008 a las 19:31 +0100, lucas Grijander escribió:
> Thanks Rubén,
> 
> I'm trying to use VBO, but I think something is missing... I added
> this to the creation of my geometry:
> 
> myGeom->setSupportsDisplayList(false);
> myGeom->setUseDisplayList(false);
> myVertexBuffer = myGeom->getOrCreateVertexBufferObject();
> myVertexBuffer->setArray(0,&v);
> myVertexBuffer->setUsage(GL_STREAM_DRAW_ARB);
> myGeom->setUseVertexBufferObjects(true);
> 
> and then inside the callback I'm try to modify the vertex data:
> 
> osg::Vec3Array *test = dynamic_cast *>(testNx->myVertexBuffer->getArray(0));
> 
> for(int i = 0; i < numVertex; i++)
>  {
>  NxMat34 pose = listShapes.at(i)->shape->getGlobalPose(); 
> osg::Vec3f trans = osg::Vec3(pose.t.x,pose.t.y,pose.t.z);
>  
>  test->at(i) = trans;
> } 
> 
> but nothing changes in the render the object does not move. Does
> anybody know what is missing??
> 
> thanks in advance
> 
> Crisalix.
> 
> 
> 
> __
> > From: [EMAIL PROTECTED]
> > To: osg-users@lists.openscenegraph.org
> > Date: Wed, 6 Feb 2008 21:33:51 +0100
> > Subject: Re: [osg-users] How to modify the array of vertex from a
> Geometry object
> > 
> > Hi,
> > 
> > Some hints:
> > 
> > 1. Be sure that test->size() is equal to numVertex
> > 
> > 2. I don't know what the "at" method is, I couldn't find it either
> on
> > the TemplateArray class or the std::vector class. Try with the
> vector []
> > operator, ie: (*test)[i] = trans
> > 
> > 3. If you are updating the vertex data once per frame, don't use
> display
> > lists, it is the worst thing that you can ever do! It is cheaper
> even to
> > use direct mode. Use vertex buffer objects and configure the VBO
> > (getOrCreateVertexBufferObject) in streaming mode (GL_STREAM_DRAW).
> > 
> > Hope this helps.
> > 
> > Regards.
> > 
> > Rubén
> > 
> > El mié, 06-02-2008 a las 14:08 +0100, lucas Grijander escribió:
> > > Dear all,
> > > 
> > > I have to create a 3D surface, and then such surface will be
> modified during the application with several deformations. I've tried
> to create a Geometry object, then I set the VertexArray, and finally
> inside the render callback I update such vertex with the new ones. I
> got some errors during the rendering:
> > > 
> > > Warning: detected OpenGL error "value not valid" after
> RenderBin::draw(,)
> > > 
> > > Does anyone has an idea of such error? In addition, I'm sure the
> way I am accessing the vertex is not the right one, anybody knows the
> best way?
> > > 
> > > here is the code:
> > > 
> > > 
> > > //Create the 3D geometry
> > >
> -
> > > osg::Vec3Array(m*n));
> > > osg::Vec2Array& t = *(new osg::Vec2Array(m*n));
> > > osg::Vec4Array& col = *(new osg::Vec4Array(1));
> > > 
> > > col[0][0] = col[0][1] = col[0][2] = col[0][3] = 1.0f;
> > > 
> > > int index = 0;
> > > for( i = 0; i < m; i++ )
> > > {
> > > for(j = 0; j < n; j++)
> > > {
> > > v[index][0] = i;
> > > v[index][1] = 0;
> > > v[index][2] = j;
> > > 
> > > t[index][0] = (float)i/(m-1);
> > > t[index][1] = (float)j/(n-1);
> > > 
> > > index++;
> > > }
> > > }
> > > 
> > > myGeom = new osg::Geometry;
> > > 
> > > myGeom->setVertexArray( &v );
> > > myGeom->setTexCoordArray( 0, &t );
> > > 
> > > myGeom->setColorArray( &col );
> > > myGeom->setColorBinding( osg::Geometry::BIND_OVERALL );
> > > 
> > > for( i = 0; i < m-1; i++ )
> > > {
> > > osg::DrawElementsUShort* elements = new
> osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP);
> > > elements->reserve(m*2);
> > > for( j = 0; j < n; j++ )
> > > {
> > > elements->push_back((i+0)*n+j);
> > > elements->push_back((i+1)*n+j);
> > > }
> > > myGeom->addPrimitiveSet(elements);
> > > }
> > > 
> > > 
> > > osg::Texture2D *tex = new osg::Texture2D;
> > > 
> > > tex->setImage(osgDB::readImageFile("Images/breast.png"));
> > > 
> > > osg::StateSet *dstate = new osg::StateSet;
> > > dstate->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
> > > dstate->setTextureAttributeAndModes(0, tex,
> osg::StateAttribute::ON );
> > > dstate->setTextureAttribute(0, new osg::TexEnv );
> > > 
> > > myGeom->setStateSet( dstate );
> > > 
> > > osg::Geode *geode = new osg::Geode;
> > > geode->addDrawable( myGeom );
> > > 
> > > ---
> > > 
> > > //Accessing the elements
> > > ---
> > > 
> > > osg::Vec3Array *test = dynamic_cast(myGeom->getVertexArray()); 
> > > 
> > > for(int i = 0; i < numVertex; i++)
> > > {
> > > NxMat34 pose = listShapes.at(i)->shape->getGlobalPose(); 
> > > osg::Vec3f trans = osg::Vec3(pose.t.x,pose.t.y,pose.t.z);
> > > 
> > > test->at(i) = trans;
> > > 
> > > 
> > > 
> > > } 
> > > myGeom->dirtyDisplayList();
> > > myGeom->dirtyBound();
> > > 
> > > 
> > 

Re: [osg-users] How to modify the array of vertex from a Geometry object

2008-02-06 Thread Rubén López
Hi,

Some hints:

1. Be sure that test->size() is equal to numVertex

2. I don't know what the "at" method is, I couldn't find it either on
the TemplateArray class or the std::vector class. Try with the vector []
operator, ie: (*test)[i] = trans

3. If you are updating the vertex data once per frame, don't use display
lists, it is the worst thing that you can ever do! It is cheaper even to
use direct mode. Use vertex buffer objects and configure the VBO
(getOrCreateVertexBufferObject) in streaming mode (GL_STREAM_DRAW).

Hope this helps.

Regards.

Rubén

El mié, 06-02-2008 a las 14:08 +0100, lucas Grijander escribió:
> Dear all,
> 
> I have to create a 3D surface, and then such surface will be modified during 
> the application with several deformations. I've tried to create a Geometry 
> object, then I set the VertexArray, and finally inside the render callback I 
> update such vertex with the new ones. I got some errors during the rendering:
> 
> Warning: detected OpenGL error "value not valid" after RenderBin::draw(,)
> 
> Does anyone has an idea of such error? In addition, I'm sure the way I am 
> accessing the vertex is not the right one, anybody knows the best way?
> 
> here is the code:
> 
> 
> //Create the 3D geometry
> -
> osg::Vec3Array(m*n));
> osg::Vec2Array& t= *(new osg::Vec2Array(m*n));
> osg::Vec4Array& col  = *(new osg::Vec4Array(1));
> 
> col[0][0] = col[0][1] = col[0][2] = col[0][3] = 1.0f;
> 
>   int index = 0;
> for( i = 0; i < m; i++ )
> {
>   for(j = 0; j < n; j++)
>   {
>   v[index][0] = i;
>   v[index][1] = 0;
>   v[index][2] = j;
> 
>   t[index][0] = (float)i/(m-1);
>   t[index][1] = (float)j/(n-1);
> 
>   index++;
>   }
> }
> 
>   myGeom = new osg::Geometry;
> 
> myGeom->setVertexArray( &v );
> myGeom->setTexCoordArray( 0, &t );
> 
> myGeom->setColorArray( &col );
> myGeom->setColorBinding( osg::Geometry::BIND_OVERALL );
> 
> for( i = 0; i < m-1; i++ )
> {
> osg::DrawElementsUShort* elements = new 
> osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP);
> elements->reserve(m*2);
> for( j = 0; j < n; j++ )
> {
> elements->push_back((i+0)*n+j);
> elements->push_back((i+1)*n+j);
> }
> myGeom->addPrimitiveSet(elements);
> }
> 
> 
>   osg::Texture2D *tex = new osg::Texture2D;
> 
> tex->setImage(osgDB::readImageFile("Images/breast.png"));
> 
>   osg::StateSet *dstate = new osg::StateSet;
> dstate->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
> dstate->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON );
>   dstate->setTextureAttribute(0, new osg::TexEnv );
> 
> myGeom->setStateSet( dstate );
> 
> osg::Geode *geode = new osg::Geode;
> geode->addDrawable( myGeom );
> 
> ---
> 
> //Accessing the elements
> ---
> 
> osg::Vec3Array *test = dynamic_cast(myGeom->getVertexArray());
>   
> for(int i = 0; i < numVertex; i++)
> {
> NxMat34 pose = listShapes.at(i)->shape->getGlobalPose();  
>osg::Vec3f trans = osg::Vec3(pose.t.x,pose.t.y,pose.t.z);
> 
>test->at(i) = trans;
>   
>   
>   
> } 
> myGeom->dirtyDisplayList();
> myGeom->dirtyBound();
> 
> 
> thank you very much for your help!!!
> 
> Crisalix.
> 
> 
> _
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> ___
> 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] making a movie of an OSG simulation

2008-02-06 Thread Rubén López
Hi,

I have done it several times with gtk-recordmydesktop on Ubuntu. You
will have to tune parameters a bit to capture OpenGL windows, just read
the documentation, it is mentioned on it explicitly. The downside is
that this will lose frames. If you want all the frames and high quality,
follow the Alberto's link and code your post-frame callback. OSG has
enough tools to write this with a few lines of code.

El mié, 06-02-2008 a las 18:30 +0530, hemanth korrapati escribió:
> hi
> 
> I wanted to make a movie of whatever is displayed on the screen when
> running an osg program.
> how do i do it ?
> 
> Thank You
> ___
> 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] Blender's osgExport

2008-02-05 Thread Rubén López
Hi,

Sorry for the delay on the answer. The blender download system crashed
some time ago, and all the downloads became invalid (not only osg
exporter ones, everything). I contacted Blender main responsible, Ton
Roosendal, but he confirmed that this info couldn't be recovered in any
way.

I have manually updated the latest version, and should be downloadable
now, but I am afraid that all the previous versions have been lost :(

Regards.

El jue, 03-01-2008 a las 18:04 +0100, Alberto Luaces escribió:
> El Thursday 03 January 2008 17:53:18 santosh escribió:
> >  From this link I am trying to download but couldn't
> > Is there any other way to download. I tried with wget also.
> > Or else if you have, can u send it?
> 
> I'm sending it to you offlist.
> ___
> 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] OSGEdit 0.7.0 RC1

2007-11-06 Thread Rubén López

El lun, 05-11-2007 a las 12:19 -0500, Jeremy L. Moles escribió:
> On Mon, 2007-11-05 at 12:33 +0100, Harald A. wrote:
> > HI,
> > 
> > great to hear that a new version of osgedit is comming.
> > 
> > here my evaluatoin report for the current rc1
> > 
> > 
> > Build was not realy easy,
> 
> I really love the effort that goes into OSGEdit, but I can't help but
> agree with this. I'm more than competent when it comes to building
> software and using a development environment, and I just didn't have the
> energy required to fix the build system to make it work for me...
> 
> > I do not have installed my developmentstuff
> > systemwide, and scons ignored my enviroment vars
> > (LIBRARY_PATH, CPLUS_INCLUDE_PATH C_INCLUDE_PATH and also (in parts) CPATH)
> > 

The migration from automake/autoconf to SCons have lost a lot of
"standard" things like these that just worked automagically, and I am
too used to install things system-wide (making my own debian packages if
needed). 
Could you provide some pointer to documentation on the standard building
variables? I will try to support them before the final release.

Thanks.


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


Re: [osg-users] OSGEdit 0.7.0 RC1

2007-11-04 Thread Rubén López
Hello Antoine,

I forgot something in my post. Please, ask the questions in the OSGEdit
mailing list: [EMAIL PROTECTED]

About your issue, the 32bits version is compiled in a Debian testing,
which may have some package newer than ubuntu Gutsi. The 64bit is
compiled in this ubuntu.

Anyway, you can compile it yourself, making your own package, it is very
easy (a single command), check the README file in the source package for
further instructions.

Regards.

El dom, 04-11-2007 a las 17:06 +0100, Antoine Hue escribió:
> Hello Ruben,
> 
> This looks very interesting.
> 
> I downloaded the Debian package and  tried to install it on my Ubuntu 
> 6.10 but cannot the installer is not able to resolve dependency on 
> libart library. The message says it requires libart-2.0-2 which is what 
> I have on my machine (exact version of libart-2.0-1 is 2.3.17-1).
> 
> I am really not a Debian package expert and I cannot go further on this.
> 
> Antoine
> ___
> 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] OSGEdit 0.7.0 RC1

2007-11-03 Thread Rubén López
Hi,

A new version of OSGEdit, the OpenSceneGraph editor, has been released.
This is the first release candidate of 0.7.0, and it is a complete
rewrite. This time the major focus has been making it much more
extensible and easier to maintain. It has a new reflection mechanism,
similar to osgIntrospection, but specific to the scene editing
requirements. As osgIntrospection, it is generated mostly automatically,
and supports every OSG object.
The new engine that powers 0.7.0 opens a lot of customization
possibilities, allowing you yo create: 

* Custom actions, that will be activated from menu / toolbar items 

* Custom controls, that will provide GUI for new object attributes, or
enhance usability of existing controls with a better GUI. 

* Custom 3D controls, that provide on-viewport direct manipulation of
object attributes, like the current rotate, scale and translate 3D
controls. 

* Custom wrappers. This is the most powerful customizable feature,
because it allows you to add support for your own osg::Object
(osg::Node) subclasses. 

* Custom layouts. So you do not like the default layout when you edit
some object? You can change it by editing a simple XML file. This allows
selecting which control to use for each attribute, which attributes to
show, how to organize the attributes in tabs, and so on. 

* Your own menu and toolbar layout. All the menubar and toolbar is
located in a XML file that you can edit to better fit your needs. This
allows not only to change where each action is located, but also to give
support for your custom actions.

All this customization is supported by an extension mechanism, that is
already being used by the core actions, controls and wrappers.
To improve the usability, OSGEdit 0.7.0 supports direct manipulation of
transformations by dragging handles in the viewport, a log window where
you can check what is happening without the need of a terminal, and a
history window where you can know what exactly will you undo or redo.

Please, take into account that this is a release candidate and it may
have lots of bugs. Send any bug report that you may find to the OSGEdit
bug tracking system.

Visit the OSGEdit download page to get the 0.7.0-rc1 version:

http://osgedit.sourceforge.net/download.html

Regards.


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