我首先使用sdl:
创建opengl 3.2SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
g_ogl = SDL_GL_CreateContext(g_window);
然后我可以通过调用SDL_GL_GetAttribute()来确认正确的初始化 Glew正在正确初始化:
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK)
{
fprintf(stderr, "Init failed");
return EXIT_FAILURE;
}
然而,以下失败:
if (GLEW_VERSION_3_2 != GL_TRUE)
{
fprintf(stderr, "Glew is wrong!");
return EXIT_FAILURE;
}
因此,glCreateShader()会导致0x00000000访问冲突 当glewInit()未被调用或失败时,互联网上的每个人都有这个问题,但事实并非如此。发生了什么事?