adamlwgriffiths / cyglfw3

Cython bindings for GLFW3
Other
20 stars 6 forks source link

WindowHints not working #24

Closed adamarbour closed 6 years ago

adamarbour commented 6 years ago

I've added several window hints to my window that are not working. You can see in the code that I have requested it to not be visible and not resizable and it is both. I've tried both False/True and 0/1 and it is still not working

I am running on Mac OSX 10.13.3 with GLFW3 installed from HomeBrew.

import cyglfw3 as glfw

def main():
    if not glfw.Init():
        exit()

    window = glfw.CreateWindow(640, 480, "HELLO WORLD")
    if not window:
        glfw.Terminate()
        exit()

    glfw.WindowHint(glfw.RESIZABLE, False)
    glfw.WindowHint(glfw.VISIBLE, 0)
    #glfw.WindowHint(glfw.CONTEXT_VERSION_MAJOR, 3)
    #glfw.WindowHint(glfw.CONTEXT_VERSION_MINOR, 3)
    #glfw.WindowHint(glfw.OPENGL_PROFILE, glfw.OPENGL_ANY_PROFILE)
    #glfw.WindowHint(glfw.OPENGL_FORWARD_COMPAT, True)

    # The window is being closed
    #glfw.SetWindowCloseCallback(window, window_close_change)
    glfw.MakeContextCurrent(window)

    while not glfw.WindowShouldClose(window):

        glfw.SwapInterval(1)
        glfw.SwapBuffers(window)
        glfw.PollEvents()

    glfw.Terminate()

main()
adamlwgriffiths commented 6 years ago

You need to set the window hint before you make the window. The windowing system needs to know what to create before it creates it, it cannot be changed once you've called glfwCreateWindow.

The examples clearly show this: https://github.com/adamlwgriffiths/cyglfw3/blob/master/examples/gl2_1.py https://github.com/adamlwgriffiths/cyglfw3/blob/master/examples/gl3_2.py https://github.com/adamlwgriffiths/cyglfw3/blob/master/examples/gl3_2_backward_compatible.py https://github.com/adamlwgriffiths/cyglfw3/blob/master/examples/gl4_1.py https://github.com/adamlwgriffiths/cyglfw3/blob/master/examples/multiple_windows.py