我正在使用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>
完全初始化GL()函数:
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);
}
我做错了什么?
答案 0 :(得分:0)