Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33

Thread: GLUT is great! but -- how to break the message loop?

  1. #1

    GLUT is great! but -- how to break the message loop?

    hello folks, glut is a really great, really simple to use CROSS platform lib. and that cross platform aspect is what i use to implement a port of gaffers tinyptc (www.gaffer.org - a cross platform "low level graphics library for software rendering in 32 bit color") to opengl (using ortho mode and texture blitting) for even more platforms available to tinyptc. but the interface of tinyptc allows the user to write his own "message loop"
    a prog looks like this:

    if (!ptc_open("test",WIDTH,HEIGHT))
    return 1;
    while (1)
    {
    render_something_to(pixels);
    ptc_update(pixels);
    }


    thats all one needs to do all the nice demo's or such and one is not bothered with event handling, callbacks and window-os-specific stuff. but - sadly glut needs to use callbacks and its mainloop.
    but - WHY ?!?!?! - glut does not allow to set up a user mainloop - somehow like this:

    while(1)
    {
    // my code
    ...
    ...
    glutRun();
    }

    so glut still could process all events and so on.
    you may watch the current implementation using glut and another implementation using windows api at
    http://www.andre-krause.net/tinyptc/src

    (look at gl_glut.c and gl_test.c and maybe at gl.c - the win32 implementation)
    i really would like to use glut instead of os dependent windows stuff. so please someone help or can convince the author of glut ??
    and besides fltk.org - a cross platform gui toolkit ALLOWS a user defined mainloop!!
    so why not glut ?


    [This message has been edited by herc (edited 05-12-2002).]

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,840

    Re: GLUT is great! but -- how to break the message loop?

    www.libsdl.org
    sets up your gl-window, you can do your own loop, and you can even use the glutfuncs anyways
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

  3. #3

    Re: GLUT is great! but -- how to break the message loop?

    ok, i will give it a try - but i think you can understand me - glut is installed on most systems, an sdl-port would require the user to install the sdl lib....

    and besides - with sdl i would no longer need opengl ;-) -- because sdl does all what tinyptc can and far more. tinyptc was developed to be much smaller, (a little easy'er) and lighter than sdl or openptc.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,840

    Re: GLUT is great! but -- how to break the message loop?

    well.. glut is normally not installed on my pc, i always have to search a glut32.dll when i download a demo..

    sdl is just an sdl.dll (for windowsworlds), and so its easy as well.

    with sdl you don't need glut anymore, no, with sdl you don't need tinyptc anymore, no. its up to you.. i provided you only the solution to get rid of your problems..
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

  5. #5

    Re: GLUT is great! but -- how to break the message loop?

    yes - you are right :-)
    hmm glut is not installed by default ? hmm, think i forgot that i installed glut manually decades ago ;-) besides the tinyptc and sdl stuff -

    i still cannot understand why glut does not allow a user defined message loop......

  6. #6
    Junior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    133

    Re: GLUT is great! but -- how to break the message loop?

    There is a hack, glutMainLoopUpdate which
    allows for this. sjbaker wrote it.
    www.sjbaker.org/steve/software/glut_hack.html

    or search Google for glutmainloopupdate.

    Regards,
    Jim



    [This message has been edited by jmathies (edited 05-12-2002).]
    --
    Jim Mathies http://www.mathies.com/

    \"The best way to predict the future is to invent it."

  7. #7

    Re: GLUT is great! but -- how to break the message loop?

    thanks !
    is there hope, that this hack get's included in the official glut releases ?

  8. #8
    Junior Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    133

    Re: GLUT is great! but -- how to break the message loop?

    Originally posted by herc:
    thanks !
    is there hope, that this hack get's included in the official glut releases ?
    doubtful. glut is dead. the author hasn't
    released a new version in years, and
    the source is not open source. there
    are a number of replacements, but none
    of these have the breadth of support
    glut does.. yet.

    Take a look at:

    Cpw: http://www.mathies.com/cpw/ (Win32)
    GLFW: http://hem.passagen.se/opengl/glfw/ (X11, Win32)

    Regards,
    Jim
    --
    Jim Mathies http://www.mathies.com/

    \"The best way to predict the future is to invent it."

  9. #9
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    4,388

    Re: GLUT is great! but -- how to break the message loop?

    It's a shame what happened to GLUT. The author refused to incorporate needed improvements requested by developers, the splitting of the loop was the biggest issue and the most requested feature. People have been asking for this for 4 years now and have even offered the required code. Unfortunately they have been ignored. The original GLUT author also refused release it under a real open source license.

    There is freeglut now, find it here:
    http://freeglut.sourceforge.net/

    I'm not sure how maintained this is, the latest download is fairly recent, looks like Steve Baker is the current keeper.


    [This message has been edited by dorbie (edited 05-12-2002).]

  10. #10
    Advanced Member Frequent Contributor marcus256's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    853

    Re: GLUT is great! but -- how to break the message loop?

    With GLFW you use your own loop ("split" it however you like).

    GLFW is constantly updated. It links statically with your app => no need for a separate installation, and you can include the GLFW source with your project if you want to distribute the source (it's compact enough for that: the source for the win32 + x11 versions together is just above 200 KB, or 60 KB compressed).


    [This message has been edited by marcus256 (edited 05-13-2002).]

Posting Permissions

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