Checking if glfw has been initated

Hi everyone,
Is there a way to check if a window is up and running? I want to be able to first launch a window. I then want to add items to the window progressively however the user may decide to generate these items before the window has been launched and I would be able to check if indeed this is the case.
I thought using if glfw.init() != 1 would do the job but it doesn’t.
Thanks

I am using a Python bindings. On first instances, it would seem that glfw.get_current_context() could do the job except that if you run this function it returns a Warning not an Exception which means that I cannot ‘capture’ it with the try...except... else block in Python. I have tried forcing the warning to generate an error using

import warnings
warnings.filterwarnings('Error')

But then I get the computer just stalling there forever. So if anyone has any comments or alternative I will appreciate it!
Thanks

Hi @MLL,

This isn’t the best place to ask about Python or the GLFW Python bindings, you might get more help from the Python binding Github or project page.

For your GLFW specific questions, it would be worth taking a look at the GLFW documentation.

Some notes:

A Window is ‘up and running’ immediately after glfwCreateWindow is called. If you want to check the window visibility state then you can get this with glfwGetWindowAttrib(window, GLFW_VISIBLE);. Note that this only gets whether the window has been set as visible or not, for whether the window is focussed use glfwGetWindowAttrib(window, GLFW_FOCUSED);.

The current context is related to the OpenGL context, which can be set current or null for a particular thread. This is unrelated to whether the window is visible or not.

@dougbinks Thanks for your response.

I believe that my first question was not well formulated. Indeed I am interested in checking whether a opengl context has been initiated or not so that I can proceed or not with other opengl instrucions (perhaps this is more of an opengl question?)

The Context Guide Documenation is useful here.

Unless you specify no context creation an OpenGL context is created when you create your window.

You need to set this as the current context before you can use it with OpenGL commands.

Thanks @dougbinks for the information