Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

john903

macrumors member
Original poster
Apr 11, 2008
66
0
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?
 

Cromulent

macrumors 604
Oct 2, 2006
6,812
1,100
The Land of Hope and Glory
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?

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.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
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
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
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.
 

psingh01

macrumors 68000
Apr 19, 2004
1,586
629
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.
 

john903

macrumors member
Original poster
Apr 11, 2008
66
0
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?
 

john903

macrumors member
Original poster
Apr 11, 2008
66
0
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
 

john903

macrumors member
Original poster
Apr 11, 2008
66
0
It looks like if I turn off the -Werror flag it should compile. Does anyone know how to do that?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.