[Qt-interest] multiple glwidget interaction

John McClurkin jwm at nei.nih.gov
Tue Jul 6 20:54:19 CEST 2010


Sajjad wrote:
> Hello forum,
> 
> I have two separate classes inherited from QGLWidget and both  the 
> classes need to share and update the projection , modelview and inverse 
> matrices . These matrices are defines as follows:
> 
> I get  the modelview matrix by 
> 
> glGetDoublev(GL_MODELVIEW_MATRIX, modelview); And that modelview matrix 
> will be shared and updated by both the QGLWidget subclasses. I need to 
> have the following matrices declared, but not sure where to declare them. 
> 
> GLdouble modelview[16]
> GLdouble projection[16]
> GLdouble inverse[16]
> 
> 
> I have declared the above matrices in one of the widget and i need to 
> pass the contents of these matrices to another gl widget. Do i have to 
> declare another three arrays in that widget as well? 
> 
> 
> I also need to set several signal and slots, like when ever the any of 
> the matrices changes the matrices will be passed with  the corresponding 
> slots. The slots may be of the same widget or the other widget.
> 
> 
> 
I would define a class containing the three arrays with functions to get 
and set their values and signals that could be emitted by those 
functions whenever the values were accessed. Then instantiate just one 
instance of that class.



More information about the Qt-interest-old mailing list