Hi All,

    I have a problem with a short description, but with a long story.
My problem is simply the crash of my application while drawing dynamic
lines on screen.


    Here comes the story;

    I am using OpenSceneGraph (tried both 3.1.4 and 3.2.0)  and Qt 4.x
with Visual Studio 2010.

* I have a Qt widget which is inherited from osgQt::GLWidget and
osgViewer::CompositeViewer and QWidget. I add this widget to my main
screen which is developed with Qt also.

* I set a QTimer (with setInterval(20)) and connect its timeout()
signal to my update() slot of QWidget and this also triggers
paintEvent() where I call frame() method of osg::ViewerBase (I call
frame() inside the paintEvent() handler).

* Of course this goes like that until I stop the timer. On the other
side, I use Qt SIGNAL/SLOT mechanism in order to respond GUI events
like pressing start/pause/stop button of the application and changing
the slider to move the simulation to a time frame. Ex: valueChanged
signal of the QSlider is connected to a slot in my app to shift
simulation into a diffrerent time frame.

* All data is updated frame by frame in my application (here frame
means a time intervals, for ex: 25 frame per second.). Simulation
takes these values and draw/transform objects on the screen for each
frame. Of course each object has related data values in each frame
which is used for this update mechanism.

    I am approaching to the point which makes me crazy.

* In my application I draw line(s) behind the objects in the scene
(trail lines). I use a Vec3Array as a container for vertices and
update them continuously in order to draw a new line in each frame
(because the objects are moving).

* In a special case, I would like to clear all the vertices in the
Vec3Array vector, so call clear() method on the array vector. This is
where the rings bell. Application crashes in DrawArrays::draw method
after calling glDrawArrays. But not everytime, this is the weird part.

* I tried dynamic data variance, singlethreaded model and etc. but
nothing works.

    This is already a long mail, still I have more to say, many code
to post, but I am not sure where should I begin. I can provide as much
as possible. However, before ending my e-mail, I would like to ask if
this approach is safe or not? I mean, I call frame() method within a
Qt slot and again update related datas within another Qt slot. Qt has
a main loop (GUI thread) of course, and is it possible to cause a
race-condition with OSG, because it has its own threading model?
Please ask if you need more information and of course you will, I
would be glad to tell more.

Cheers,
Deniz
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to