Get rid of glut functions for solid objects drawing in a Qt QGlWidget

932 Views Asked by At

I need to draw sphere, cylinders and cones in 3D inside a QGlWidget.

Now I'm using the glutSolidSphere, glutSolidCone and that awful trick of gluQuadric for drawing cylinders.

I just want to use only one framework for 3D drawing -in this case Qt- and get rid of all those Glut functions.

Are there some Qt classes to do this in Qt <= 4.6 ?

Doing this would also allow me to redistribute my executable without the glut library and get rid of the glutInit functions too!

3

There are 3 best solutions below

0
On

Are there some Qt classes to do this in Qt <= 4.6 ?

Build primitives? No, but they are quite simple to construct yourself.

0
On

No, not that I'm aware of.

QGLSphere and QGLCylinder appeared in the 5.0 documentation (although it claims introduction in 4.8).

If you absolutely must stick to 4.6 then you could try implementing those classes yourself, but if you're doing anything 3D you might be better off moving to 5.0 anyway.

0
On

If you're not moving to Qt 5 at the time, use the source of some glut implementation to find how the primitives are constructed.