8000 Added glfwIsInitialized function by Frostie314159 · Pull Request #2065 · glfw/glfw · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added glfwIsInitialized function #2065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Frostie314159
Copy link

This adds a glfwIsInitialized function, that just accesses the internal initialized paramter of the GLFWlibrary object.

This makes it more direct and convenient to check if glfw is already initialized.

As requested in glfw#2036

@wintertime
Copy link

There is more than one way to help users with the underlying problem:

  1. I'd guess, having this function would be the simplest addition to code around mutliple libraries in one application not knowing if they still need to initialize GLFW. It would just be a higher burden on users to alw 97E2 ays check.
  2. If glfwInit would just error out with something like GLFW_ERROR_ALREADY_INITIALIZED (instead of silently ignoring the call) that would solve the problem without having to add a new function. Users would then just check this and avoid calling glfwTerminate if some other part already initialized GLFW. I'm just not sure if that meets compatibility requirements. User code would be about as complicated as 1.
  3. The most convenient way for users without making the implementation much more complicated than now would be to make initialized a counter. On glfwInit check the counter then only call the initialization code if it was 0, but always increase it by 1. On glfwTerminate error (or maybe ignore) if the counter is 0, decrease it by 1 and call termination code when it reaches 0 after it was decresed. That would be compatible with current user code and enable very easy use (just call glfwInit and glfwTerminate irregardless of other users).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0