Hello Allen,

I've tried leaving setDisplayList (true) and calling the method 
dirtyDisplayList() and not calling setVertexArray(vad).  That doesn't work 
either.

Nothing has worked so far except to call setVertexArray(vad);

Check the code to osg::Geometry::setVertexArray to see if it's doing things you're not:

void Geometry::setVertexArray(Array* array)
{
    _vertexData.array = array;
    computeFastPathsUsed();
    dirtyDisplayList();
    dirtyBound();

    if (_useVertexBufferObjects && array)
        addVertexBufferObjectIfRequired(array);
}

The important parts in your case are dirtyDisplayList() and dirtyBound()... If the old array pointer is the same as the new one, then _vertexData.array = array will just reassign the same value. computeFastPathsUsed() doesn't change anything, it just sets a flag to say whether you're on the OpenGL fast paths or not. And you're probably not using vertex buffer objects (setUseDisplayList(false) + setUseVertexBufferObject(false) (the default) = plain old vertex buffers) so the last line is not executed for you.

The gist of it is:
1. In all cases, you need to add a vertex array, a normal array, a color array and one or more primitiveset(s). (note that the normal and color arrays can just contain one element with binding BIND_OVERALL)

2. For static geometry, you leave setUseDisplayList() set to true (the default) and you're done. OSG will build the display list once, and always draw using that display list afterwards.

3. For dynamic geometry, you'll setUseDisplayList(false) and modify the vertices in the vertex array (either keep a ref_ptr to it or get the pointer each time from the osg::Geometry object).

Note that if the geometry is updated only seldom (once per second, or once per 30 seconds, for example) you could leave setUseDisplayList(true) (the default) and call dirtyDisplayList() when you change the vertices in the vertex array. But nowadays, there's little advantage to using display lists even for static or "almost static" geometry - they're even being deprecated in OpenGL 3.0.

So to sum up, you need to set the vertex array in your initial setup, and then either dirtyDisplayList() in your update (draw line) code or setUseDisplayList(false) in your initial setup.

If it still doesn't work for you, send us some repro code. Check out the osggeometry example to see if you're doing things like that example, and if not, modify it to match your code, see if you can reproduce your results, and send it to us.

In my mind, the method, dirtyDisplayList() should 1) dirty my display list 2) 
rebuild it and therefore during the next draw sequence of the viewer, the line 
should be drawn.  But that simply is not the case.

Yes it is. That's it exactly. If that doesn't work for you, send us some repro code.

My best guess is: Some flag w/in the Geometry/Drawable is not being set to "dirty" and 
some flag is not being set to "redaw" once the Geometry/Drawable is dirty.  That's the 
nearest I can tell.

That code path is being used every day by a very large number of programmers in a very large number of software programs (it's a very common thing to do), so I'm pretty sure if it were broken we'd know. :-) Nevertheless, with a small example that shows what you're doing, we might be able to see more clearly if there's a bug or if there's something missing in your usage.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to