Installing GLUT

Hi
I'm a second year Computer Science student and am at the beggining of my first Computer Graphics unit. Currently I'm using Microsoft Visual Studio to write my code using Windows XP on a MacBook but am finding it quite slow when running my code. I thought moving to Xcode might be a good idea but don't know how to install GLUT on it. I've read through the instructions that come with the download but don't understand them. If anyone could help me it would be really useful!

Thanks a lot
Ben

1.83GHz Core Duo MacBook Mac OS X (10.4.8)

Posted on Oct 27, 2006 2:48 PM

Reply
13 replies

Oct 29, 2006 1:32 PM in response to Ben Atkinson

In System/Library/Frameworks, there should be over 70 framework folders, including folders for the Carbon, Cocoa, and GLUT frameworks. If the GLUT framework is not there, do a Spotlight search for GLUT.framework. If nothing shows up in the search, I don't know what to tell you. I don't know why the GLUT framework wouldn't be installed on your Mac.

Mac OS X (10.4)

Oct 31, 2006 2:31 AM in response to Mark Szymczyk

Thanks a lot that got that bit working perfectly!
For some reason though I get an error in my main function saying "error: '::main' must return 'int'". This was never a problem when using Visual Studio. I've tried getting around it by declaring another variable 'tempInt' and returning it at the end but it doesn't seem to like that either.
The only other error I'm now getting is with <windows.h>, just need to find the Mac equivalent to that!

Thank you very much for your help, you've been very useful! 🙂

Ben

Oct 31, 2006 8:05 AM in response to Ben Atkinson

you need to declare the main function like this:

int main(int argc, char *argv[]){

...
return someint
}

this is the standard declaration which allows you to return an error code if something unexpected happens. The Microsoft compiler might be more forgiving in that respect.
What do you need windows.h for? Maybe you can use functions from stdlib.h instead.

Daniel

Oct 31, 2006 8:24 AM in response to confusion

What i've got at the moment is:

void main(int argc, char **argv)
{
glutInit(&argc,argv);

glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(width, height); //set window size
glutInitWindowPosition(xpos, ypos); //set window position

glutCreateWindow("Game Screen");

init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutIdleFunc(spinDisplay);
glutKeyboardFunc(keys); //add keyboard callback
glutSpecialFunc(special); //add callback for the function keys

glutMainLoop();
}

I tried adding "return tempInt;" at the end to see if it would fix it but it still had the same problem. Is there anything i'm missing here?

I was using <windows.h> for Sleep(), i've now replaced it with <unistd.h> so thats one thing out of the way 🙂.

Thanks very much for your help


1.83GHz MacBook Core Duo Mac OS X (10.4.8)

Oct 31, 2006 8:55 AM in response to confusion

Thanks, I'm very slowly getting somewhere!
That now works fine but I'm getting 2 new errors that aren't shown on the main screen but when I click on the message that says there are 2 errors at the bottom right of the screen it shows undefined symbols errors followed by a long list of gl and glut commands 😟.
Sorry for asking so many questions, this is the first time I've used Xcode and I have no idea what I'm doing!

Thanks, Ben

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Installing GLUT

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.