Glut

Discussion in 'Mac Programming' started by john903, Apr 26, 2008.

  1. john903 macrumors member

    Joined:
    Apr 11, 2008
    #1
    I can't figure out how to do the following things with GLUT (Carbon). Thank you for your help!

    1) When I create a window the red button in the title bar is disabled. How do I enable it?

    2) Is there a way to detect middle mouse scrolling in GLUT?

    3) How do you set the icon for your program?
     
  2. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    GLUT and Carbon are two completely separate things.

    If you want 1 then I believe you will need to use Carbon to create your window and handle events etc, this would mean that you would also be using Carbon for 2. I think 3 is more to do with setting up the project properly, I have no idea I've never made a custom icon for an application.
     
  3. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #3
    For 3.,
    Ctrl+Click Resources, choose Add-> New File... (Choose your icon file, i left this part out)
    Ctrl+Click targets->project name, and choose Get Info.
    Choose the Properties tab
    There is a Icon File entry. You can enter the filename of the icon there.

    On the others I've got nothing.

    -Lee
     
  4. Sayer macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #4
    For #2 at least here you go: http://iihm.imag.fr/blanch/howtos/MacOSXGLUTMouseWheel.html

    You basically need to get a modified version of GLUT that has mouse scroll wheel support baked into it. Once you get the modified GLUT your GLUT-based apps can respond to the scroll wheel mouse events as you see fit.

    As to the #1 - the close widget - I think GLUT handles closing the window on exit, doesn't it? If you try to close the window outside of your run loop it may blow up the app in yer face. There are a TON of GLUT-based examples at /Developer/Examples/OpenGL/GLUT. Look through there, maybe one of em does that and you can copy/paste (every programmer does it, they can just hide it since the code is all compiled together in the end).

    And #3 was answered already so n'yah.
     
  5. psingh01 macrumors 65816

    Joined:
    Apr 19, 2004
    #5
    GLUT is pretty limited and I don't believe it is even being updated anymore. The FreeGLUT project (http://freeglut.sourceforge.net/) is pretty much the same as GLUT plus some other useful enhancements. This may have support for the middle button and scroll wheel.
     
  6. john903 thread starter macrumors member

    Joined:
    Apr 11, 2008
    #6
    Thanks for the help! I was able to get my icon working.

    FreeGLUT looks good. I downloaded the source but how do you build it?
     
  7. psingh01 macrumors 65816

    Joined:
    Apr 19, 2004
    #7
  8. john903 thread starter macrumors member

    Joined:
    Apr 11, 2008
    #8
    Thanks! I got errors when I tried to make freeglut. I'm new to gcc. Is it the "long long" warning that's preventing the build? Here's the output for "make all".

    cd . \
    && CONFIG_FILES= CONFIG_HEADERS=config.h \
    /bin/sh ./config.status
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing default-1 commands
    make all-recursive
    Making all in src
    source='freeglut_callbacks.c' object='libglut_la-freeglut_callbacks.lo' libtool=yes \
    depfile='.deps/libglut_la-freeglut_callbacks.Plo' tmpdepfile='.deps/libglut_la-freeglut_callbacks.TPlo' \
    depmode=gcc3 /bin/sh ../depcomp \
    /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I/usr/X11/include -g -O2 -Wall -pedantic -Werror -c -o libglut_la-freeglut_callbacks.lo `test -f freeglut_callbacks.c || echo './'`freeglut_callbacks.c
    mkdir .libs
    gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I/usr/X11/include -g -O2 -Wall -pedantic -Werror -c freeglut_callbacks.c -MT libglut_la-freeglut_callbacks.lo -MD -MP -MF .deps/libglut_la-freeglut_callbacks.TPlo -fno-common -DPIC -o .libs/libglut_la-freeglut_callbacks.lo
    cc1: warnings being treated as errors
    In file included from /usr/X11/include/X11/extensions/xf86vmode.h:39,
    from freeglut_internal.h:101,
    from freeglut_callbacks.c:29:
    /usr/X11/include/X11/Xmd.h:155: warning: ISO C90 does not support 'long long'
    make[2]: *** [libglut_la-freeglut_callbacks.lo] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
     
  9. john903 thread starter macrumors member

    Joined:
    Apr 11, 2008
    #9
    It looks like if I turn off the -Werror flag it should compile. Does anyone know how to do that?
     
  10. czane macrumors newbie

    Joined:
    May 6, 2008

Share This Page