Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT and Visual Studio Crashing when using GLUT objects?

QT and Visual Studio Crashing when using GLUT objects?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5.5visual studiofreeglutopengl
5 Posts 4 Posters 3.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    taulant01
    wrote on 7 Nov 2015, 06:14 last edited by
    #1

    Hi Guys,

    I am working in a task to create a program in OpenGL in Visual Studio with QT framework.

    I wanted to learn the first steps in this direction, so I wanted to create a TeaPot just for testing:

    #include "glwidget.h"
    #include <GL/glut.h>
    GLWidget::GLWidget(QWidget *parent)
        : QGLWidget(parent)
    {
    }
    
    void GLWidget::initiliazeGL(){
        glClearColor(1, 1, 0, 1);
    }
    void GLWidget::paintGL(){
       glClear(GL_COLOR_BUFFER_BIT);
    
        glutWireTeapot(1.0);
    }
    void GLWidget::resizeGL(int w, int h){
    
    }
    

    Above is the class where I put my code. First I have tried to create a Rectangle with GL_TRIANGLES, and it worked, but when I try to add "glutWireTeapot", or "glutSolidTeapot", or "glutSolidCube" etc... it crashes the application.

    In QT Creator it says:
    The program has unexpectedly finished.
    C:~//~//~//~~~\debug\testBug2.exe crashed[

    In Visual Studio 2013 it says:

    Unhandled exception at 0x000007FEE7C95AAF (freeglut.dll) in testBug2.exe: 0xC0000005: Access violation reading location 0x0000000000000034.

    When I saw the message in Visual Studio about the freeglut.dll, I went and deleted the freeglut files, downloaded freeglut again and added the files to the destination folders. But still, it didn't work :(

    Does anybody have any idea what the problem is?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 7 Nov 2015, 10:10 last edited by mrjj 11 Jul 2015, 10:11
      #2

      hi
      @taulant01 said:
      freeglut

      In old days one has to call glutInit before using any of the functions.

      Never tried freeglut so dont know if you still must

      but it does seem so
      http://freeglut.sourceforge.net/docs/api.php#Initialization

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on 7 Nov 2015, 10:30 last edited by
        #3

        As @mrjj said you need to initialize freeglut first. But thre's really no point in using freeglut with Qt at all. You already have a window (GLWidget), maouse and keyboard handling and access to OpenGL functions (QOpenGLFunctions). In this setup freeglut is kinda redundant and can only create problems (clashing gl names etc.). I'd say just stick with Qt if you already started with it.

        Y 1 Reply Last reply 7 Nov 2015, 21:08
        0
        • C Chris Kawa
          7 Nov 2015, 10:30

          As @mrjj said you need to initialize freeglut first. But thre's really no point in using freeglut with Qt at all. You already have a window (GLWidget), maouse and keyboard handling and access to OpenGL functions (QOpenGLFunctions). In this setup freeglut is kinda redundant and can only create problems (clashing gl names etc.). I'd say just stick with Qt if you already started with it.

          Y Offline
          Y Offline
          yoavmil
          wrote on 7 Nov 2015, 21:08 last edited by
          #4

          @taulant01 said:

          glutSolidTeapot

          Qt doen't replace glutWireTeapot etc.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on 8 Nov 2015, 13:07 last edited by
            #5

            Qt doen't replace glutWireTeapot etc.

            Yes, but except for a one-time example what's the use of it these days? One should use shaders and VBOs anyway.

            1 Reply Last reply
            0

            2/5

            7 Nov 2015, 10:10

            • Login

            • Login or register to search.
            2 out of 5
            • First post
              2/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved