Issue #43 resolved

gl::sys::LoadFunctions returns true without a valid context

created an issue

I just ran into this problem when I was forgetting to setup a GL context prior to calling the init code. Trying to query some info on the implementation, I found that GL functions which normally would crash the program without first retrieving valid addresses, e.g. glGetString, succeeded and the applications returns properly. This is odd, since I expected the wrapper functions generated by glLoadGen to chrash the program as well - eventually.

I'm testing this on Ubuntu 13.04.

The style is func_cpp and the version is 4.3 (core).

Comments (5)

  1. Jason McKesson repo owner

    This appears to just be how Linux works You apparently don't need a context, depending on how your GL implementation is installed. That behavior also means you can't count on the NumMissing count to be legit.

    Consider it undefined behavior. On Windows, it crashes.

  2. thokra reporter

    Thanks for the link. I didn't know about, nor did I expect this behavior.

    Although "won't fix" is fine with me, what could be done, in theory, is to check if some context-dependent string is actually returned by a function pointed to by a seemingly valid function pointer. For instance, glGetString(GL_VERSION) will not crash the program, but it will also not return a valid version string.

    Either the driver is buggy, which is highly unlikely in regards to the above query, or there wasn't a context at the time. If this can be established for all vendors, glLoadGen could actually return false.

    If so, would you be interested in this workaround?

  3. Log in to comment