QT and Visual Studio caching when using GLUT objects?

EDIT: Sorry for the mistake in the Title, it should have been: QT and Visual Studio CRASHING when using GLUT objects?

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:

[i]#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){

}[/i]

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 estBug2.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 :frowning:

Does anybody have any idea what the problem is?

I would expect GLUT and Qt to be mutually exclusive. They’re both fundamentally GUI toolkits, so I wouldn’t expect to be able to use both in the same program.

In particular, most FreeGLUT functions (including glutWireTeapot) first check that GLUT has been initialised (via glutInit), and terminate if it hasn’t. But calling glutInit in a program that’s already using Qt to create a GUI may have its own problems.

Does anybody have any idea what the problem is?
I use glut functions with a GUI tookit called FLTK. FLTK comes with explicit directions about usage with glut. I expect QT does too. I tried googling ‘QT and GLUT’ and got a few promising looking leads. But I’m not a QT user, so I leave it up to you to pursue it. Good luck.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.