[osg-users] OSGNode VBO Control
Ignitus Boyone
IgnitusBoyone at Gmail.com
Tue Oct 27 07:40:23 PDT 2015
Hi,
I'm starting to work my way through the source for Geometry and Drawable, but more experienced minds might be able to point me in the right directions sooner.
I'm working on a AR HUD and because a later point in the project might require the loading of complex models to represent avatars or vehicles inside the AR space we have chosen to use OSG as a starting point. The current UI is currently relatively primitive and basically consist entirely of billboards of varying textures with minor text glyphs to indicate various properties.
I've implemented most of the billboards in a single VBO based Geometry node. Because the target hardware is lacking I wanted to play with partial updates to the VBO contents based on our current draw performance. First pass I simply created a post function for manually controlling where in the draw thread buffer transfers occur, but it has become apparent to me from profiling that this might only be marking the VBO as dirty and the actual upload occurring during the next draw frame.
Code:
void OSGVboMarker::post()
{
if (m_frontVBO.isInitialized && m_bDirtyBit)
{
m_swapLock.lock();
int count = m_frontVBO.vertices->size();
m_pGeometry->setVertexArray( m_frontVBO.vertices );
m_pGeometry->setNormalArray(m_frontVBO.normal, osg::Array::BIND_OVERALL);
m_pGeometry->setColorArray(m_frontVBO.color, osg::Array::BIND_OVERALL);
m_pGeometry->setTexCoordArray(0,m_frontVBO.texCoords, osg::Array::BIND_PER_VERTEX);
m_pGeometry->setVertexAttribArray(5, m_frontVBO.centers, osg::Array::BIND_PER_VERTEX);
m_pGeometry->setVertexAttribArray(6, m_frontVBO.scaleValues, osg::Array::BIND_PER_VERTEX);
m_pDrawArrays->setCount(count);
m_pDrawArrays->set(osg::PrimitiveSet::QUADS, 0, count);
So, I have two questions related to the above.
1. When do modified VBO nodes push memory to the card.
2. Is it possible to manually control this operation and possibly do sub buffer updates.
...
Thank you!
Cheers,
Ignitus
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65456#65456
More information about the osg-users
mailing list