我正在使用 Qt,我正在尝试使用 GLEW 从 OpenGL 1.0 切换到更新的 OpenGL。我有一个 GUI,它使用 QGLWidget 的子类来处理 OpenGL 的东西。在initializeGL
我做声明的开头,GLenum err = glewInit();
这会导致以下情况:
program.exe exited with code -1073741515
更多细节:库:
LIBS += -L"C:/Program Files/Microsoft SDKs/Kinect/v1.7/lib/amd64/" -lKinect10
LIBS += -lOpenGL32
LIBS += -lglew32
LIBS += -lglu32
标题:
#include <windows.h>
#include <gl/glew.h>
#include <QByteArray>
#include <QGLWidget>
#include <memory>
#include <algorithm>
完整的 initializeGL() 函数:
void OpenGLWidget::initializeGL(){
GLenum err = glewInit();
if (GLEW_OK != err)
{
/* Problem: glewInit failed, something is seriously wrong. */
}
glEnable(GL_TEXTURE_2D); //Enables the drawing of 2D textures
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width(), height(), 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, (GLvoid*) NULL);
glBindTexture(GL_TEXTURE_2D, textureId); //Binds the GL_TEXTURE_2D to the textureId
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width(), height(), 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, (GLvoid*) blackScreen); //Strart the program off with a black screen
glBindTexture(GL_TEXTURE_2D, textureId); //Binds the GL_TEXTURE_2D to the textureId
glClearColor(0,0,0,0);
glClearDepth(1.0f);
}
我究竟做错了什么?