PDA

View Full Version : OPENGL, draw directly on the main window view not using QWidget, possible or not ?



yellowmat
7th November 2006, 09:58
Hi everybody,

This post is the second round of a previous one where I wonder which technology to use (QGLWidget, QWidget or QCanvasItem) in order to draw a custom widget with full opacity control (also for the widget background).

I wonder now if it is possible to create an objet, not inherited from QWigdet or any other object used for drawing, and implements in it some drawing function using OpenGL primitives call. Thus, it will be possible to draw on a main window view with opacity control.

I would like to know if someone has already implemented such a solution and could tell me what I should be aware of. I already know that if I developp a class that does not inherit from QWidget, I will not have the support it provides (event management functions).

Thanks in advance for your help.

high_flyer
7th November 2006, 10:49
Just a small question - is Qt4 out of the question for you?

yellowmat
7th November 2006, 10:50
Unfortunately I can't use QT4 :crying: my boss is stingy.

wysota
7th November 2006, 15:15
In theory you could render to a gl context and then render the result to a pixmap which you could then blit it to the window. But that's just theory.

yellowmat
7th November 2006, 16:00
Ok, thanks for your help.

I think I will implement a cleaner solution as follow : I will developp my custom widget and it will inherits from QGLWidget (it will give good speed at drawing ... I have found an OpenGL forum which surely will help me to optimize my drawing code)

This custom will be usable as it with no opacity control (because of the widget background) and integreated into a modal QDialog object (top level and without border) on which I can apply the setWindowOpacity function.

It seems (to me) to be the best way to answer my needs (under Qt3).

If someone have another idea ... :cool:

yellowmat
7th November 2006, 16:01
Wysota, I keep your solution in mind (off screen rendering) and if I have some time I will implement it in order to compare both.