?
Solved

Configure GLUT for Jaguar

Posted on 2003-03-15
8
Medium Priority
?
519 Views
Last Modified: 2013-12-26
Howdy,

I've been trying for the past two days to configure the GLUT for OS X 10.3 for a simple project.  The Mac demos and documentation on OpenGL for Cocoa are less than verbose, don't always work, are written in Objective-C and don't use the GLUT.  When I follow the tutorial at:

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=MacOSX

I get "Undefined symbols: _DrawGLScene _InitGL _ResizeGLScene" errors, which I can't figure out.  I searched through the class files and I can't find them.  So then I'd suspect that I have an old version of the GLUT, but when I pbxbuild install the one I download from Apple, I get an error telling me (among other things) that:

ld: table of contents for archive: ./libForeground.a is out of date; rerun ranlib(1) (can't load from it)

It seems it shouldn't be this hard, what am I doing wrong?
0
Comment
Question by:Raydot
  • 5
  • 3
8 Comments
 
LVL 1

Expert Comment

by:mphanke
ID: 8160640
Hi,

I have no idea on Mac OpenGL but have you downloaded the NeHe base code? It was my problem in the beginning. Further the errors showing up above ("Undefined symbols: _DrawGLScene _InitGL _ResizeGLScene") look like you are using some functions which are not defined in the source, I don't believe it is a problem with the GLUT lib.

This error usually originates from using a the functions mentioned above in one of the GLUT functions where you define which function is supposed to be used for drawing, resizing and so on.

Hope this helps,

Martin

P.S. I came here from the other post in OpneGL section.
0
 
LVL 3

Author Comment

by:Raydot
ID: 8170322
NeHe Base code?  Is that different from what I posted in the link above?

0
 
LVL 1

Expert Comment

by:mphanke
ID: 8170560
Hi,

yep, if you look at the homepage ( nehe.gamedev.net ) on the left side you will find something saying nehe basecode. Download it this should solve your issues.

Martin
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:mphanke
ID: 8170585
You are calling functions which are declared but not defined.
Look at some easy examples like the Triangle one which is something further in the tutorials. These functions have to be declared! Then all your problems should be resolved. Otherwise post here and I will give you some more advise. Please try to post some more precise errors / warnings.

The issue might be resolved if you do:

GLvoid InitGL(GLvoid) {}
GLvoid DrawGLScene(GLvoid) {}
GLvoid ReSizeGLScene(int Width, int Height) {}

Then the functions are defined and the code should run.

Martin
0
 
LVL 1

Expert Comment

by:mphanke
ID: 8170789
You are calling functions which are declared but not defined.
Look at some easy examples like the Triangle one which is something further in the tutorials. These functions have to be declared! Then all your problems should be resolved. Otherwise post here and I will give you some more advise. Please try to post some more precise errors / warnings.

The issue might be resolved if you do:

GLvoid InitGL(GLvoid) {}
GLvoid DrawGLScene(GLvoid) {}
GLvoid ReSizeGLScene(int Width, int Height) {}

Then the functions are defined and the code should run.

Martin
0
 
LVL 3

Author Comment

by:Raydot
ID: 8171200
Hm.  Well those are the error messages I get, I don't see how I could be more specific.  And the green triangle code isn't great for two reasons: 1) it doesn't use the GLUT and 2) the code as written returns an error if you call the file something like "green triangle" as opposed to a name with no spaces in it like "green_triangle"

Still and all, I think you were right, I changed the function prototypes.  On NeHe's site, they're listed as:

GLvoid InitGL(GLvoid);
GLvoid DrawGLScene(GLvoid);
GLvoid ReSizeGLScene(int Width, int Height);

But your version seemed to work...almost.  I did get three warnings, all of which basically read:

"warning dynamic shared library: /System/Library/Frameworks/Carbon.framework/Carbon not made a weak library in output with MACOSX_DEPLOYMENT_TARGET environment variable set to: 10.1"

...which I'm told is nothing to worry about.  

Is this different in the code on the site vs. the code for download?

Let me take this around the block a bit, and if it all holds together, the points are yours.
0
 
LVL 1

Accepted Solution

by:
mphanke earned 1000 total points
ID: 8172413
Hi,

see the NeHe MacOS Tutorial is only for giving you an idea how the basics look like. It seems not to be indented to be running code. It took me some time to figure this out. I took  the source from http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01 - this is for Windows but just give it a try, it should work use the following function bodies:

GLvoid InitGL(GLvoid)
{
     glShadeModel(GL_SMOOTH);
        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);                         // Black Background
     glClearDepth(1.0f);                                   // Depth Buffer Setup
     glEnable(GL_DEPTH_TEST);                              // Enables Depth Testing
     glDepthFunc(GL_LEQUAL);                                   // The Type Of Depth Test To Do
        glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);               // Really Nice Perspective Calculations
}

GLvoid DrawGLScene(GLvoid)                                        // Here's Where We Do All The Drawing
{
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);               // Clear The Screen And The Depth Buffer
     glLoadIdentity();                                   // Reset The Current Modelview Matrix
}

GLvoid ReSizeGLScene(int Width, int Height);
{
     if (height==0)                                        // Prevent A Divide By Zero By
     {
          height=1;                                   // Making Height Equal One
     }

     glViewport(0, 0, width, height);                         // Reset The Current Viewport
     glMatrixMode(GL_PROJECTION);                              // Select The Projection Matrix
     glLoadIdentity();                                   // Reset The Projection Matrix

     // Calculate The Aspect Ratio Of The Window
     gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);

     glMatrixMode(GL_MODELVIEW);                              // Select The Modelview Matrix
     glLoadIdentity();                                   // Reset The Modelview Matrix
}

I have no experience with MacOS, so it is up to you port the code. It should be not really a lot of work.

Martin
0
 
LVL 3

Author Comment

by:Raydot
ID: 8349292
I bet you thought I forgot about this...I actually did go download that code.  It's written in ObjectiveC, but it works.  So the points are yours!  Thanks.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question