PDA

View Full Version : 3D rendering on Ubuntu using QGLWidget



sanjayshelke
14th January 2009, 09:59
Hi all,

I have created 3D object by inheriting QGLWidget as well as QGraphicsItem.
I am inheriting QGraphicsItem to add this 3D object into QGraphicsScene by using addItem().
The class looks like this

class My3DItem : public QGLWidget, public QGraphicsItem
{
}
I have done some tricks to work this on Linux. Actually adding item to the scene calls paint()
method.I have reimplemented paint() method and calling glDraw() through this implementation to call paintGL() method.

This trick is working on Fedora but not on Ubuntu.

Can anyone guide me on this. If someone interested in the code i can upload it also.

Thanks in advance.

Regards,
~Sanjay

wysota
14th January 2009, 11:03
Inheriting from a graphics item and a widget makes no sense, even if it works in some environment. You can use QGraphicsProxyWidget if you want, but AFAIR it doesn't work with GL widgets.

sanjayshelke
14th January 2009, 12:05
Thanks,

Actually I am developing an application which shows sevral different items.
I am using graphicsview architecture for showing such items.
Among these several items there are3D items such as Pyramid, pentagon, Sphere etc.
To crate such items i have used opengl and to add it to the scene i need to inherit it form QGraphicsItem as well.
Your suggestions will be helpful for me.

Regards,
~Sanjay