Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > gl/glut.h for OS X?

gl/glut.h for OS X?
Thread Tools
Junior Member
Join Date: Oct 2001
Location: Los Angeles
Status: Offline
Reply With Quote
Jan 9, 2002, 02:56 PM
 
I am taking an intorductory course to programming comuputer graphics. A programming example I am working from is meant to run on a Solaris machine. It makes use of OpenGL and GLUT.

It has the following include:
#include <GL/glut.h>

To see if I had the header file on OS X, I ran a quick search for the file. None turned up. However, I did come across a file called "glut.h". I also know that OS X supports OpenGL calls through some APIs somewhere (no idea what header file though).

What equivalent header files can I use to replace the GL/glut.h file? Are the API calls the same? I also have XFree86 installed. I assume any graphics windowing programs will have to be done through there?

Any ideas? Thanks for any advice.
     
Dedicated MacNNer
Join Date: Apr 2001
Location: Bethesda, MD
Status: Offline
Reply With Quote
Jan 9, 2002, 03:20 PM
 
#include <GLUT/glut.h>


also don't forget to include the proper frameworks when linking:

-framework GLUT -framework OpenGL -framework Foundation

dave
     
Junior Member
Join Date: Dec 2000
Location: Boston, MA USA
Status: Offline
Reply With Quote
Jan 9, 2002, 05:08 PM
 
davechen is correct. To clarify, the header file exists inside the GLUT framework rather than a "GL" directory (as it is on a Solaris machine). You will see this a lot when porting applications.

So, just use "Add Framework..." to add "GLUT.framework" and "OpenGL.framework" (you may not need them both), and change the #include to find the file inside one of these frameworks.

- Ross
     
Grizzled Veteran
Join Date: Sep 2000
Location: Springfield, MA
Status: Offline
Reply With Quote
Jan 9, 2002, 06:04 PM
 
To make it a whole lot easier on you, if you work on the code on Solaris and Mac OS X, use an include statement like this:
<font face = "courier">
#ifdef __APPLE__
#include &lt;GLUT/glut.h&gt;
#else
#include &lt;GL/glut.h&gt;
#endif
</font>
We hope your rules and wisdom choke you / Now we are one in everlasting peace
-- Radiohead, Exit Music (for a film)
     
Junior Member
Join Date: Oct 2001
Location: Los Angeles
Status: Offline
Reply With Quote
Jan 9, 2002, 06:05 PM
 
Awesome. Simply Cool. Thanks for your help.
     
Mac Enthusiast
Join Date: Jan 2002
Location: Trondhjem, Norway
Status: Offline
Reply With Quote
Jan 9, 2002, 09:10 PM
 
I'm also doing some introductory things in GLUT and OpenGL! It's cool!

Just wanted to say that there are many examples in /Developer/Examples/GLUTExamples (I have the Dec 2001 tools).
זרו
     
Grizzled Veteran
Join Date: Sep 2000
Location: Springfield, MA
Status: Offline
Reply With Quote
Jan 9, 2002, 09:24 PM
 
Originally posted by alien:
<STRONG>I'm also doing some introductory things in GLUT and OpenGL! It's cool!</STRONG>
Yeah it is! I just learned it last semester, and it's very dangerous stuff. I often found my self playing with my OpenGL code instead of the projects for other classes.

I made a little wave simulation in case anyones interested
We hope your rules and wisdom choke you / Now we are one in everlasting peace
-- Radiohead, Exit Music (for a film)
     
Junior Member
Join Date: Oct 2001
Location: Los Angeles
Status: Offline
Reply With Quote
Jan 9, 2002, 10:17 PM
 
Groovy. But I don't suppose we will do much actual OpenGL stuff. I think the prof plans only to use it as a canvas of sorts. I think then we'll be doing some rather low level operations starting with 2D and then onto 3D ending with raytracing (very excited about that). We'll see how it goes.

Mactoid, I tried your suggestion, but I am returned an error because there is no if for the else.
     
Junior Member
Join Date: Oct 2001
Location: Los Angeles
Status: Offline
Reply With Quote
Jan 9, 2002, 10:21 PM
 
D'oh. By looking at your code, Mactoid, I figured out what I was doing wrong: forgot the #endif. Ugh. Lame me.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:42 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2