PDA

View Full Version : QGLWidget is not visible on linux and Mac OS X



sanjayshelke
3rd March 2008, 07:37
hi,
i have created 3D pyramid by using QGLWidget and handled paintEvent() instead of paintGL() as i am adding the QGLWidget to QGraphicsScene.This code is working fine on Windows but same is not working on Linux(Fedora core 6) and Mac OS X(10.4.7 Tiger) platforms.

In paintEvent i am doing grabFrameBuffer and drawing the image by using Qpainter.

regards,
~sanjay

wysota
3rd March 2008, 08:32
Reimplement paintGL then instead of paintEvent. By the way, I would call adding a GL widget to graphics scene risky.

sanjayshelke
3rd March 2008, 08:42
many thanks,

Basically i am using graphicsview framework which contains n no. of graphics item.This 3D pyramid is also one of the item and so i need to add it to the QgraphicsScene.This forces me to implement paintEvent().Because if i reimpleent paintGL() it is not called at all.

And the thing is that code is working on windows.

regards,
~sanjay

wysota
3rd March 2008, 08:51
This forces me to implement paintEvent().Because if i reimpleent paintGL() it is not called at all.
The thing is paintGL() is called from the paintEvent after the context has been set up correctly. You must have done something wrong. Check if it works when the widget is outside QGraphicsScene.


And the thing is that code is working on windows.
Windows has a different architecture than other platforms.

I still suggest you implement the pyramid without QGLWidget. It should be possible using just the pixel buffer (or something else, I'm not a GL expert).

sanjayshelke
3rd March 2008, 10:32
true sir,
If i take QGLWidget outside the QGraphicsScene it will call paintGL().

I need to create 3D pyramid with features such as rotate, fill faces of pyramid.
For all that i have used openGL.I never gone through pixelbuffer before but i will go through it now, though i m not sure whethter i can create true 3D pyramid.

Meanwhile ijust want to know is there any solution for mentioned problem of QGLWidget not visible.

regards,
~sanjay

wysota
3rd March 2008, 12:53
I need to create 3D pyramid with features such as rotate, fill faces of pyramid.
For all that i have used openGL.I never gone through pixelbuffer before but i will go through it now, though i m not sure whethter i can create true 3D pyramid.
A pixel buffer is an OpenGL feature where you can create a scene without actually displaying it in a window. Thus I'm not telling you not to use OpenGL but to avoid inserting a QGLWidget into the scene. Render your scene to a pixmap and use a regular/animated pixmap item in the scene.

sanjayshelke
4th March 2008, 07:18
thanks,
it seems to be perfect for me ti implement Pyramid.

One more question. My system does not support pixelbuffer.What should i do for that.

regards,
~sanjay