Results 1 to 6 of 6

Thread: QT minimal Glut code - no library linking required

  1. #1
    Join Date
    Jun 2010
    Posts
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QT minimal Glut code - no library linking required

    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
    1. glutWireCube
    2. glutSolidCube
    3. glutWireTorus
    4. glutSolidTorus
    5. glutSolidSphere
    6. 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

    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.
    Last edited by rucs_hack; 27th August 2010 at 17:41.

  2. The following user says thank you to rucs_hack for this useful post:

    Ligator (2nd October 2013)

  3. #2
    Join Date
    Jul 2008
    Location
    Bangalore, India
    Posts
    24
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QT minimal Glut code - no library linking required

    Hey...Thanx..This really helps a lot

  4. #3
    Join Date
    Jun 2010
    Posts
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT minimal Glut code - no library linking required

    I'm glad you find it useful.

    /me

  5. #4
    Join Date
    Apr 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT minimal Glut code - no library linking required

    Thanks man, this is perfect.

  6. #5
    Join Date
    Nov 2011
    Location
    Brazil
    Posts
    10
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT minimal Glut code - no library linking required

    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

  7. #6
    Join Date
    Oct 2013
    Posts
    1
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Post GLUT shapes for QtCreator.

    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.
    Attached Files Attached Files

Similar Threads

  1. Replies: 2
    Last Post: 7th September 2009, 21:13
  2. Linking Qt in a dynamic library
    By dave_mm0 in forum Qt Programming
    Replies: 4
    Last Post: 18th July 2009, 16:28
  3. Help needed linking to library
    By StephenR in forum Qt Programming
    Replies: 4
    Last Post: 3rd July 2009, 08:50
  4. linking qt3 to a library
    By thebra in forum Newbie
    Replies: 10
    Last Post: 11th November 2006, 01:25
  5. import library linking
    By bruce1007 in forum Qt Programming
    Replies: 6
    Last Post: 19th May 2006, 10:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.