glCreateShader crashes application

Hi at all! I’m new to OpenGL programming. I’m following the tutorials on opengl-tutorial (dot) org on how to create the first triangle (sorry, I can’t post the link… I don’t know why -.-").

I’m using SDL2 and GLEW with Visual Studio 2015. All have been recompiled with it and setup.
The only thing that’s wrong is glCreateShader. It crashes my program. I tried printing it and results in a null pointer. Even VS2015 throws and exception because no procedure is present at address 0x0.
I tried checking video drivers (I have an AMD 5650) and all seems to be up to date!

This is how I initialize the libraries:


// Init SDL Library
if (SDL_Init(SDL_INIT_EVERYTHING))
	std::cout << "SDL not initialized correctly" << std::endl;

// Setup SDL for OpenGL
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
SDL_SetHint(SDL_HINT_RENDER_OPENGL_SHADERS, "1");

// Create window and renderer
window = SDL_CreateWindow("Game Engine", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL);

// Create the OpenGL context
context = SDL_GL_CreateContext(window);
SDL_GL_MakeCurrent(window, context);

// Init GLEW
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK)
	std::cout << "GLEW not initialized correctly" << std::endl;

What’s wrong?
Thanks in advance for any help!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.