Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: GLEW and ARB_debug_output problem

  1. #1
    Intern Contributor
    Join Date
    Jul 2010
    Posts
    74

    GLEW and ARB_debug_output problem

    I originally posted this on the glew-users and glew-coders mailing list last night but have not had any responses:

    It appears that ARB_debug_output is not compatible with GLEW due to a chicken and egg problem.

    To use ARB_debug_output you have to use the WGL_create_context_profile's wglCreateContextAttribsARB() to set WGL_CONTEXT_DEBUG_BIT_ARB to get a GL context with the ARB_debug_output extension.

    To get WGL_create_context_profile you have to create a dummy window and context, so you can call glewInit() to initialize all the WGL function pointers. Unfortunately as ARB_debug_output does not appear in the extensions string until you use wglCreateContextAttribsARB() to set WGL_CONTEXT_DEBUG_BIT_ARB, the ARB_debug_output's function pointers are not initialized.

    Once you call wglCreateContextAttribsARB() to set WGL_CONTEXT_DEBUG_BIT_ARB and create a debug context, you need to reinitialize GLEW's pointers so it can now find ARB_debug_output's function pointers, then you can use ARB_debug_output.

    But calling glewInit() a second time will not initialize those pointers as it has already been called before and refuses to initialize twice.

    Hence you now have a chicken and egg problem.

    One idea I have for a fix, it to expose wglewInit() to non GLEW_MX users (like me). wglewInit() would only initialize the WGL function pointers (so you can use wglCreateContextAttribsARB() to create a debug context). Once you have the debug context, you then call normal glewInit() which would then initialize all the GL extensions including ARB_debug_output. You can then successfully use ARB_debug_output.

    Unless of course someone else has a better idea to fix it, or there is a workaround I can use.

  2. #2
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    2
    yeah i found it a bit confusing that ARB_debug_output functions are not available and ignored in opengl when no debug context.
    In addition to your suggestions glew could link these functions lazy-style instead for glewInit() or link them when wglCreateContextAttribsARB is called with debug argument.
    For now i link these functions myself with wglGetProcAddress after i create the debug context.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •