Order of glfwSwapInterval & glfwSwapBuffers

Using GLFW
Kir
2014-06-17
2014-06-17
  • Kir

    Kir - 2014-06-17

    Hello, should I call glfwSwapInterval after calling glfwSwapBuffers at least once?
    If I do in another way, I get crash of the whole system. If yes, why? There is no remarks in documentation about this.

     
  • Doug Binks

    Doug Binks - 2014-06-17

    You should not need to call glfwSwapInterval more than once. I suggest you take a look at the example projects and see if these work.

     
  • Kir

    Kir - 2014-06-17

    No, I didn't suppose to call glfwSwapInterval more than one time; it seems due to my bad knowledge of english I had written incorrect sentence so you misunderstand.
    I mean, if I call glfwSwapInterval before glfwSwapBuffers (for example, after initializing the window, e. g. glfwCreateWindow, glfwMakeContextCurrent...), I get a system crash. If I call glfwSwapBuffers one or more times before glfwSwapInterval, I get that I expected.
    So, is there any restrictions on calling glfwSwapInterval BEFORE glfwSwapBuffers (window/context was already initialized due to the restriction described in documentation)? Or it is problem of my computer (video drivers)?

     
  • Doug Binks

    Doug Binks - 2014-06-17

    Sorry for misunderstanding. The examples all call glfwSwapInterval before calling glfwSwapBuffers (as does my own code) with no problems on the machines I've tested (and presumably this is the case for many others).

    So I recommend you check if the examples work, otherwise there is potentially an issue in your own code.

     
  • Kir

    Kir - 2014-06-17

    Well, I wrote a simple program and it works perfectly. The problem was that my real program called, as I supposed, no more glfw funtions. Except one. I found out that the removal of glfwSetTitle that was at the end of loop fixed the problem. So, how can glfwSetTitle crash my system?

     
  • Doug Binks

    Doug Binks - 2014-06-17

    Calling glfwSetWindowTitle once per frame is somewhat unusual, and perhaps this simply causes your windowing environment to become unresponsive. Or perhaps you have passed in an incorrect pointer or non-null terminated string.

    If it's a responsiveness issue then updating the window title less often may help.

     
  • Kir

    Kir - 2014-06-17

    Well, finally, it works! Thank you.

    Now the title updates only when needed - and all works as expected.