CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: GLEW missing GL version but valid context

  1. #1
    Join Date
    Feb 2016
    Posts
    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 ?

  2. #2
    Join Date
    Aug 2006
    Posts
    232

    Re: GLEW missing GL version but valid context

    You should have posted in the Graphics forum...

    http://forums.codeguru.com/forumdisp...cs-Programming

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,734

    Re: GLEW missing GL version but valid context

    [moved from C++ (Non Visual C++ Issues) forum...]
    Victor Nijegorodov

  4. #4
    Join Date
    Mar 2001
    Posts
    2,527

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)