What type of primitive (mode) is in your DrawArrays? If it's GL_LINES then
obviously you'll need to add 2 vertices to draw an additional line segment.

Other than that I don't know what the problem is.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Allen
Saucier
Sent: Thursday, April 16, 2009 10:27 AM
To: [email protected]
Subject: Re: [osg-users] Dinamic Line Drawing

Well, it didntt work for me. :-(

I'm actaully calling osg::viewer::frame() a few 100x / ms, I turned off
DisplayLists for the geometry, did not call setVertexArray(vad), did not
call dirtyDisplayList() and the line is not being drawn at all now.

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);

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.

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.

Do you have any more suggestions? [Question] Thx....


code to "draw line" after initial setup ----------
  
  osg::Vec3Array *vad = dynamic_cast<osg::Vec3Array *>
    (m_ogeomTrailGeometry->getVertexArray());
  vad->push_back(osg::Vec3(x,y,z));
  
  osg::DrawArrays *drArrys = dynamic_cast<osg::DrawArrays *>
    (m_ogeomTrailGeometry->getPrimitiveSet(0));
  drArrys->setFirst(0);
  drArrys->setCount(vad->size());
  m_ogeomTrailGeometry->dirtyDisplayList(); // doesn't work

  // m_ogeomTrailGeometry->setVertexArray(vad); // works  when uncommented



Paul Martz wrote:
> If you use osgViewer::Viewer::run(), then you're rendering constantly 
> and don't need to do anything else to tell it to redraw.
> 
> If you're using osgViewer::Viewer::frame(), then you need to call that 
> function.
> 
> Paul Martz
> Skew Matrix Software LLC
> http://www.skew-matrix.com
> +1 303 859 9466
> 
> -----Original Message-----
> From: 
> [mailto:] On Behalf Of Allen
> Saucier
> Sent: Thursday, April 16, 2009 8:03 AM
> To: 
> Subject: Re:  Dinamic Line Drawing
> 
> Wow, that easy? ha, ha... 
> 
> Paul, how does the "system" know when to redraw after I've added to 
> the vertices?  Don't I have to tell it to redraw after I've added a 
> vertex and up'ed the vertex counter?
> 
> -vertex counter == osg::DrawArrays *vad; -new vertices added to *vad 
> w/
> push_back() cmd
> 
> 
> Paul Martz wrote:
> 
> > setUseDisplayLists( false ).
> > 
> > Paul Martz
> > Skew Matrix Software LLC
> > http://www.skew-matrix.com
> > +1 303 859 9466
> > 
> > -----Original Message-----
> > From: 
> > [mailto:] On Behalf Of Allen
> > Saucier
> > Sent: Wednesday, April 15, 2009 3:44 PM
> > To: 
> > Subject: Re:  Dinamic Line Drawing
> > 
> > Thanks Paul!  I didn't understand that in the previous postings.  
> > Would you mind telling me how to "disable" the display listings for 
> > this
> > 
> geometry?
> 
> > 
> > 
> > ** PAUL wrote ***
> > Your geometry is probably using display lists (on by default).
> > setVertexArray will dirty and rebuild them. A more efficient 
> > solution would be to disable display lists. If you do that, you 
> > should be able to change individual elements of your array and not 
> > have to set the entire
> > 
> array.
> 
> > 
> > Paul Martz
> > Skew Matrix Software LLC
> > http://www.skew-matrix.com
> > +1 303 859 9466
> > 
> > ------------------------
> > ----
> > Allen
> > 
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=10279#10279
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
> > org
> > 
> > _______________________________________________
> > osg-users mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
> > org
> > 
> > ------------------
> > Post generated by Mail2Forum
> > 
> 
> 
> ------------------------
> ----
> Allen
> 
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=10304#10304
> 
> 
> 
> 
> 
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
> org
> 
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
> org
> 
>  ------------------
> Post generated by Mail2Forum


------------------------
Allen

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=10315#10315





_______________________________________________
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