PDA

View Full Version : QT minimal Glut code - no library linking required



rucs_hack
27th August 2010, 15:40
A while back I found this code that implements a minimal set of glut shapes for QT, but it didn't work due to a memory leak.

I found and fixed the leak, and even though the original code is old it works perfectly on windows/linux and the mac. I'm currently using it in a QT program to display the output from an n-body model.

The shapes it makes available are

glutWireCube
glutSolidCube
glutWireTorus
glutSolidTorus
glutSolidSphere
glutWireSphere


Provided these are the only shapes you use there's no need to change existing glut code for this to work. Using this means you don't have to link against the glut lib, which is quite handy (well I think so).

download link (http://moody.politespider.com/releases/qtglut.zip)

If anyone wants to extend this to add more glut features then I'd be happy to update the file I've got hosted. I may well add more stuff to it myself, but not just yet, I'm still finishing my own software that uses it.

QTInfinity
15th September 2010, 08:52
Hey...Thanx..This really helps a lot :)

rucs_hack
15th September 2010, 10:58
I'm glad you find it useful.

/me

ivionday
2nd April 2011, 20:21
Thanks man, this is perfect.

mwgobetti
13th January 2012, 12:15
Sorry for the bumping but this is really on-topic... I'm actually only looking for a way to implement glutSolidCone in my Qt application without messing with the GLUT library. I think I've already searched everywhere. rucs_hack do you have any tips or could you help me on it?
Thanks a lot :)

Ligator
3rd October 2013, 08:30
Because GLUT wihtout teapot is not GLUT. ;)
This files are the same that rucs_hack's files plus teapot and cone.
Funtions in qglut:

void glutWireCube(GLdouble size);
void glutSolidCube(GLdouble size);
void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius,GLint nsides, GLint rings);
void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint nsides, GLint rings);
void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
void glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
void glutSolidTeapot(GLdouble scale);
void glutWireTeapot(GLdouble scale);
void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);

Add this two files to your project and add "#include "qglut"" to your glwidget.cpp.

Enjoy it. :D