Hi,

This post is related to this my post:

http://forum.openscenegraph.org/viewtopic.php?t=12384

The main problem is to understand how to design a QTOsgViewer plugin used 
inside an application which modify dinamically the 3D osg scene.

It's really hard to explain the global situation but in a nutshell is as 
follows:

I have a QT widget which extends QGLWidget: this is fundamentally a QT Plugin 
which extends the osg viewer also. My main application thread make all 3D 
graphics operations and when I done I call the QGLWidget::update() to force the 
call of an overrided paintGL() slot to make the frame (calling osg frame()) and 
repaint the widget. In base of my tests right now, frame() method must be 
called inside paintGL(): if I don't call the frame() inside paintGL() there are 
a lot of errors about openGL, shaders and graphics context. 

So, I assume to have to call the frame() only inside the paintGL(). This is the 
main assumption and can be wrong but for now I have no other idea.

At random times, happens that the QWidget::update() DON'T calls the paintGL(), 
so, there is not 1:1 correspondance between update() and paintGL() slot. As I 
understand this is an intentional and normal behavior for QT framework. 

In general this can't be a problem, but in my case I use a semaphore release 
inside the paintGL(): if the paintGL() is lost, the semaphore release don't 
comes and my application freezes (stuck on a pre-gived semaphore). I have to 
use this semaphore because others my application modules have to wait until 
paintGL() is finished: frame() have to work over 3D tree which can't be 
modified from others component until are done. if I don't use the semaphore the 
application crash because the slot paintGL() (and then the osg frame()) can be 
called when another module works on 3D tree causing a race-condition. 

In others words, if we modify the 3D OSG tree WHEN the frame() method running 
we probably receive a segmentation fault because we can't modify the tree when 
OSG designs it.
So, I need to implement a methodology to avoid this situation. So, when I have 
finished to modify the OSG 3D tree, I have to force the paintGL() method to 
call the frame() method and then return to modify the OSG 3D tree again. 
If I'm not able to understand when the frame() is finished (this means "when 
paintGL() is finished") I can't able to procede with 3D tree modifications. 
This is the reason for the semaphore inside paintGL().

Now, I think that the problem is inside the first assumption: we have to don't 
call the frame() inside paintGL() but I don't understand how.

This is a problem between QT and OSG and is diffult for me to find a solution.

Many thanks for any ideas.

Cheers,
Dario

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





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

Reply via email to