OpenMask, OpenGL and QT Widget




In this chapter,the first part shows how we can draw an object in OpenGL controlling by a QT widget.
We try also to explain in a second part, how we can control the widget QT from the openGL part.



Send signals from the widget QT to the OpenGL animation


In this part, we try to explain how we can draw an object in OpenGL controlling by a QT widget.


PhotoPhoto
Photo
The Animation controlled by QT buttons

Download this file and uncompress : QTOpenGLMask.tar.gz
These files have been tested on Mandrake 9.1.
You may have to modify the .pro if you are running on an other operating system.

The Method

Details of the archive :
      main.cxx                                     //A classic OpenMask main file
      PsXEventHandler.h                            //Files which send signals to OpenGL
      PsXEventHandler.cxx
      PsvOpenGLParamSensitiveInputHandler.h        //Files which contain the OpenGL code
      PsvOpenGLParamSensitiveInputHandler.cxx
      PsParam.h                                    //Files which contain parameters for the OpenGL object
      PsParam.cxx
      scene.OpenMASK3                              //The OpenMask simulation tree
      1Window_1Viewport.3DVis.OpenMASK3
      cube.pro                                     //Generate the Makefile
      Makefile

QTInterface/
      OpenMASKInterface.pro                         //Generate the Makefile
      Makefile
      PsOpenMASKWidget.h                            //This class sends signals to PsXEventHandler (for the control)
      PsOpenMASKWidget.cxx
      OpenMASKWidget.ui.h                           //This file was constructing by QTdesigner

The Result

Compile and see the animation. As you can see a polygon is turning round and its color change.
You can stop or start the animation with the QT Widget. You can also move the slider to accelerate or decelerate the animation.


Send signals in the two ways (Widget QT/OpenGL and OpenGL/Widget QT)


In this part, we try to explain how we can draw an object in OpenGL controlling by a QT widget.


PhotoPhoto
Photo
You can now modify the QT widget settings

Download this file and uncompress : EventQTOM.tar.gz
These files have been tested on Mandrake 9.1.
You may have to modify the .pro if you are running on an other operating system.

The Method

Details of the archive :
      main.cxx                                     //A classic OpenMask main file
      PsXEventHandler.h                            //Files which send signals to OpenGL
      PsXEventHandler.cxx
      PsQTEventHandler.h                       //Files which send signals to the QT widget
      PsQTEventHandler.cxx
      PsvOpenGLParamSensitiveInputHandler.h        //Files which contain the OpenGL code
      PsvOpenGLParamSensitiveInputHandler.cxx
      PsParam.h                                    //Files which contain parameters for the OpenGL object
      PsParam.cxx
      scene.OpenMASK3                              //The OpenMask simulation tree
      1Window_1Viewport.3DVis.OpenMASK3
      cube.pro                                     //Generate the Makefile
      Makefile

QTInterface/
      OpenMASKInterface.pro                         //Generate the Makefile
      Makefile
      PsOpenMASKWidget.h                            //This class sends signals to PsXEventHandler (for the control)
      PsOpenMASKWidget.cxx
      OpenMASKWidget.ui.h                           //This file was constructing by QTdesigner

The Result

Compile and see the animation. As the first part do, you can see a polygon turning round.
You can stop or start the animation with the QT Widget. You can also move the slider to accelerate or decelerate the animation.
Now if you press the "m" key, this will changed the speed of the animation.
The thing that is important here is that the slider moved when you press the key.

Return to the summary