Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: GLUT still runs when user closes window

  1. #1

    GLUT still runs when user closes window

    How can I detect when a user have closed a window created with GLUT? Otherwise GLUT will keep working in the background. Is there any multiplatform solution?

    Thanks in advance!

  2. #2

    GLUT still runs when user closes window

    I took the code from Phoenix as a working example. Here's what you need:
    Code:
    glfwGetWindowParam(GLFW_OPENED) = 1
    Or:
    Code:
    repeat
    // Main loop here..
    until glfwGetWindowParam&#40;GLFW_OPENED&#41; <> 1;

  3. #3

    GLUT still runs when user closes window

    Annother solution would be SimpleDirectmediaLayer (SDL)
    -> www.libsdl.org

  4. #4

    GLUT still runs when user closes window

    Robert, that paramether is very helpful, thanks! About the second code, I had the idea it was not possible to use your own loop, instead GLUT requires using its events... how do you initialize GLUT to run your own loop?

    waran, I'm trying not to use SDL, it would be another library to learn and integrate and I have had enough with DX and GLUT

    Thanks!

  5. #5

    GLUT still runs when user closes window

    Hey, FPC can't find the glfwGetWindowParam() function. I placed gl, glu and glut in the uses clause. In which unit is it located? :?

  6. #6

    GLUT still runs when user closes window

    The unit you need is glfw and I think it's a default in the distribution of FPC. Else you can get it here. And basically from there all you do is event snoop. Try looking at Phoenix's phxScreen unit for insights into how Andreaz does it; best method I've seen yet and MPL licensed (free for commercial use). Or you could always make your own unit to handle the window management.

  7. #7

    GLUT still runs when user closes window

    Robert, glfw can't be used since cronodragon probably uses glut for window management

    Cronodragon, instead of using glut then use glfw. I find it to be far easier to work with
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  8. #8

    GLUT still runs when user closes window

    Oh ok, thanks! GLFW looks so cool, I'm checking the reference. It also allows threads, that's what I wanted in the first place!

  9. #9

    GLUT still runs when user closes window

    Does someone have glfw.dll? The download doesn't bring it, I don't know how to compile it (seems to require some sort of C compiler), and I can't find one that works in Internet :cry:

  10. #10

    GLUT still runs when user closes window

    Lessee if mine works for you. This DLL is for the 2.5 API version, so I included the same version header unit just in case it differs from the latest.

    http://thewickedflea.freepgs.com/glfw.zip

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •