David,

I think this just a simple matter of doing the following:

    class VBO : public osg::NodeVisitor {
    public:

        virtual void apply(osg::Geode &geode) {

            for (osg::Geode::DrawableList::const_iterator itr = geode.getDrawableList().begin();
                    itr != geode.getDrawableList().end();
                    ++itr) {
                (*itr)->setUseVertexBufferObjects(true);
            }

        }

    };

    VBO vboMode;
    root->traverse(vboMode);

This will convert your scene graph to use vbo's if the card supports it. 

Cheers,
Paul


David Spilling wrote:
Dear All,

Does OSG support rendering to a Vertex Buffer Object?

I'm happy with regular texture RTT, but is rendering to VBO as simple as this:

    camera->setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT);
    camera->attach(osg::CameraNode::COLOR_BUFFER, m_texture);

where m_texture's "image" is pointing to a vertex buffer? e.g. something like

    m_vertex = (osg::Vec4f*) new osg::Vec4f[m_nx * m_ny];
    m_vertexArray = new osg::Array(m_nx * m_ny, m_vertex);
    m_texture->setImage(m_vertex)

?

Does this (apparently simple) operation ensure that the VBO stays entirely on the GPU, and doesn't do a round trip via the driver/CPU?

Thanks all,

David



_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to