Re: [osg-users] shared VertexBufferObject question

2008-09-23 Thread Robert Osfield
Hi Alex,

Adding back in the lazy updating of the glVertexPointer would get you
a small amount of performance, but it must have been commented out for
a reason, what I don't recall as this will have been a number of years
back.  Commenting it back in might work, but then it might come across
crashes due to the vertex pointer being reset elsewhere with
osg::State being updated to know that it was dirty.   At a guess it
might an issue with mixing display lists and vertex pointer usage.

Robert.

On Mon, Sep 22, 2008 at 7:53 PM, Pecoraro, Alexander N
[EMAIL PROTECTED] wrote:
 I did some reading about VBOs on the NVidia developer site and it turns
 out that the glBindBuffer() call is not the one that I should worry
 about. The white paper I read said that limiting the number of calls to
 glVertexPointer() was the proper way to optimize the use of VBOs.

 So I noticed that there was some commented out code in include/State
 that appeared to be for the purpose of preventing redundant calls to
 glVertexPointer() - see below:

 inline void setVertexPointer( GLint size, GLenum type,
  GLsizei stride, const GLvoid *ptr
 )
 {
   (only showing relevant parts of code)
  //if (_vertexArray._pointer!=ptr || _vertexArray._dirty)
  {
_vertexArray._pointer=ptr;
glVertexPointer( size, type, stride, ptr );
  }
  _vertexArray._dirty = false;
 }

 Seems like if the commented out IF statement was not commented out then
 I could have multiple Geometry nodes share a vertex buffer object and a
 vertex array and only require one call to glVertexPointer(). Wouldn't
 that be more efficient?

 Alex

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Robert
 Osfield
 Sent: Saturday, September 20, 2008 1:56 AM
 To: OpenSceneGraph Users
 Subject: Re: [osg-users] shared VertexBufferObject question

 Hi Alex,

 The unbind is done to prevent state leakage.  One could potentially
 using lazy state updating on VBO state by placing more controls into
 osg::State, but this would require all Drawables to be careful about
 what they assume is current state.  It's possible but it's quite a bit
 of work.

 Robert.

 On Sat, Sep 20, 2008 at 12:42 AM, Pecoraro, Alexander N
 [EMAIL PROTECTED] wrote:
 I want to create a VertexBufferObject that is shared by several
 Geometry
 nodes so that the number of calls to glBindBuffer() are decreased, but
 I
 noticed that on lines 1561 - 1567 of Geometry.cpp there is some code
 that
 automatically unbinds the vertex buffer object effectively forcing
 each
 Geometry node to rebind the VBO each time. Why does it do this? Isn't
 this
 preventing a shared VBO from being used in the most efficient way
 possible?



 Thanks.



 Alex

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org

 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
 g


 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
 g
 ___
 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] shared VertexBufferObject question

2008-09-22 Thread Pecoraro, Alexander N
I did some reading about VBOs on the NVidia developer site and it turns
out that the glBindBuffer() call is not the one that I should worry
about. The white paper I read said that limiting the number of calls to
glVertexPointer() was the proper way to optimize the use of VBOs.

So I noticed that there was some commented out code in include/State
that appeared to be for the purpose of preventing redundant calls to
glVertexPointer() - see below:

inline void setVertexPointer( GLint size, GLenum type,
  GLsizei stride, const GLvoid *ptr
)
{
   (only showing relevant parts of code)
  //if (_vertexArray._pointer!=ptr || _vertexArray._dirty)
  {
_vertexArray._pointer=ptr;
glVertexPointer( size, type, stride, ptr );
  }
  _vertexArray._dirty = false;
}

Seems like if the commented out IF statement was not commented out then
I could have multiple Geometry nodes share a vertex buffer object and a
vertex array and only require one call to glVertexPointer(). Wouldn't
that be more efficient?

Alex

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert
Osfield
Sent: Saturday, September 20, 2008 1:56 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] shared VertexBufferObject question

Hi Alex,

The unbind is done to prevent state leakage.  One could potentially
using lazy state updating on VBO state by placing more controls into
osg::State, but this would require all Drawables to be careful about
what they assume is current state.  It's possible but it's quite a bit
of work.

Robert.

On Sat, Sep 20, 2008 at 12:42 AM, Pecoraro, Alexander N
[EMAIL PROTECTED] wrote:
 I want to create a VertexBufferObject that is shared by several
Geometry
 nodes so that the number of calls to glBindBuffer() are decreased, but
I
 noticed that on lines 1561 - 1567 of Geometry.cpp there is some code
that
 automatically unbinds the vertex buffer object effectively forcing
each
 Geometry node to rebind the VBO each time. Why does it do this? Isn't
this
 preventing a shared VBO from being used in the most efficient way
possible?



 Thanks.



 Alex

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g


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


Re: [osg-users] shared VertexBufferObject question

2008-09-20 Thread Robert Osfield
Hi Alex,

The unbind is done to prevent state leakage.  One could potentially
using lazy state updating on VBO state by placing more controls into
osg::State, but this would require all Drawables to be careful about
what they assume is current state.  It's possible but it's quite a bit
of work.

Robert.

On Sat, Sep 20, 2008 at 12:42 AM, Pecoraro, Alexander N
[EMAIL PROTECTED] wrote:
 I want to create a VertexBufferObject that is shared by several Geometry
 nodes so that the number of calls to glBindBuffer() are decreased, but I
 noticed that on lines 1561 – 1567 of Geometry.cpp there is some code that
 automatically unbinds the vertex buffer object effectively forcing each
 Geometry node to rebind the VBO each time. Why does it do this? Isn't this
 preventing a shared VBO from being used in the most efficient way possible?



 Thanks.



 Alex

 ___
 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] shared VertexBufferObject question

2008-09-19 Thread Pecoraro, Alexander N
I want to create a VertexBufferObject that is shared by several Geometry
nodes so that the number of calls to glBindBuffer() are decreased, but I
noticed that on lines 1561 - 1567 of Geometry.cpp there is some code
that automatically unbinds the vertex buffer object effectively forcing
each Geometry node to rebind the VBO each time. Why does it do this?
Isn't this preventing a shared VBO from being used in the most efficient
way possible?

 

Thanks.

 

Alex

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