-
February 17th, 2016, 08:47 AM
#1
GLEW missing GL version but valid context
Hey
i'm using glew and glfw3.
In my code, I init glfw3 first, then I create a window and its context, and then I try to initialize glew.
I get the "missing gl version" error.
I compiled on windows sources myself.
Here are my preprocessors for compiling glfw :
_GLFW_WIN32;_GLFW_WGL;_GLFW_USE_OPENGL;_GLFW_BUILD_DLL;
and for glew :
WIN32;WIN32_LEAN_AND_MEAN;VC_EXTRALEAN;GLEW_BUILD;
Here is my code :
Code:
`GLFWwindow* window;
glfwSetErrorCallback(error_callback);
if (!glfwInit())
exit(EXIT_FAILURE);
window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
if (!window)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window);
std::cout << glGetString(GL_VERSION) << std::endl;
glewExperimental = true;
GLenum err = glewInit();
if (err != GLEW_OK) {
std::cerr << "Failed to init GLEW !" << std::endl << glewGetErrorString(err) << std::endl;
glfwTerminate();
return 1;
}`
glGetString(GL_VERSION) does return my opengl version ! (4.5.0)
And I tried with glewExperimental = false too
After some debugging, I found that this is causing the error :
Code:
getString = (PFNGLGETSTRINGPROC) glewGetProcAddress((const GLubyte*)"glGetString"); if (!getString) return GLEW_ERROR_NO_GL_VERSION;
That means glew can't get that string...
Can somebody help me please ?
-
February 17th, 2016, 09:06 AM
#2
Re: GLEW missing GL version but valid context
-
February 17th, 2016, 11:22 AM
#3
Re: GLEW missing GL version but valid context
[moved from C++ (Non Visual C++ Issues) forum...]
Victor Nijegorodov
-
March 4th, 2016, 08:27 AM
#4
Re: GLEW missing GL version but valid context
call
Code:
GLenum err = glewInit();
before you call
Code:
std::cout << glGetString(GL_VERSION) << std::endl;
ahoodin
To keep the plot moving, that's why.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|