SDL 2.0とglew 1.9を使用してopenGLコンテキストを作成しようとしています
プロジェクトのビルド中は問題ありませんが、デバッグ中に GLEW が初期化に失敗します。この問題を解決するにはどうすればよいですか?
私はビジュアルスタジオ2012を使用しています
出力は次のとおりです。
The program '[936] gravitation.exe' has exited with code -1 (0xffffffff).
コードは次のとおりです。
#include <GL/glew.h>
#include <SDL.h>
#include <iostream>
int main(int argc, char **argv)
{
SDL_Window* window = 0;
SDL_GLContext contextOpenGL = 0;
SDL_Event event;
bool terminate = false;
GLenum initGLEW = glewInit();
if( GLEW_OK != initGLEW )
{
std::cout << "initialisation error of GLEW : " << glewGetErrorString(initialisationGLEW) << std::endl;
SDL_GL_DeleteContext(contextOpenGL);
SDL_DestroyWindow(window);
SDL_Quit();
return -1;
}
while(!terminate)
{
SDL_WaitEvent(&event);
if(event.window.event == SDL_WINDOWEVENT_CLOSE)
terminer = true;
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapWindow(window);
}
SDL_GL_DeleteContext(contextOpenGL);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}