kaszewczyk
21st October 2012, 14:24
Hello
I'm learning OpenGL 3.3 with Qt 4.8 and I have a problem to run my application
I have created class called Mesh where i use some OpenGL functions from glew library code looks like this:
void Mesh::compile()
{
glGenBuffers(1, &this->vbo);
glBindBuffer(GL_ARRAY_BUFFER, this->vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(this->vertexs), vertexs, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
My application crash on the line "glGenBuffers(1, &this->vbo);" with message "The program stopped working unexpectedly."
My pro file look like this
QT += core gui opengl
TARGET = GLSL
TEMPLATE = app
SOURCES += main.cpp\
glwidget.cpp \
mesh.cpp
HEADERS += glwidget.h \
mesh.h
FORMS += glwidget.ui
CONFIG += glew
unix|win32: LIBS += -lGLEW
Can someone help me please ?
--------EDIT
I solve this problem out.
To use OpenGL 3.3 with Qt please follow these steps
add to ur .pro file line
unix|win32: LIBS += -lGLEW
add this code in ur QGLWidget initializeGL method
makeCurrent();
glewExperimental = GL_TRUE;
int glewErr = glewInit();
if( glewErr != GLEW_OK )
{
qDebug("Error %s", glewGetErrorString(glewErr) ) ;
}
I'm learning OpenGL 3.3 with Qt 4.8 and I have a problem to run my application
I have created class called Mesh where i use some OpenGL functions from glew library code looks like this:
void Mesh::compile()
{
glGenBuffers(1, &this->vbo);
glBindBuffer(GL_ARRAY_BUFFER, this->vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(this->vertexs), vertexs, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
My application crash on the line "glGenBuffers(1, &this->vbo);" with message "The program stopped working unexpectedly."
My pro file look like this
QT += core gui opengl
TARGET = GLSL
TEMPLATE = app
SOURCES += main.cpp\
glwidget.cpp \
mesh.cpp
HEADERS += glwidget.h \
mesh.h
FORMS += glwidget.ui
CONFIG += glew
unix|win32: LIBS += -lGLEW
Can someone help me please ?
--------EDIT
I solve this problem out.
To use OpenGL 3.3 with Qt please follow these steps
add to ur .pro file line
unix|win32: LIBS += -lGLEW
add this code in ur QGLWidget initializeGL method
makeCurrent();
glewExperimental = GL_TRUE;
int glewErr = glewInit();
if( glewErr != GLEW_OK )
{
qDebug("Error %s", glewGetErrorString(glewErr) ) ;
}