Jump to content
  • Advertisement
Sign in to follow this  

Beginning OpenGL Using XCode 2.2

This topic is 4214 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I'm a student learning to be a programmer. I have aspirations in joining the game industry some day, and figured that learning OpenGL as early as I could would benefit me greatly. I came across NeHe in my search for a tutorial, and I'm interested in using them. However, when attempting to do lesson 1 to be sure everything was working well enough for me to begin to learn, I came across a problem. When attempting to build and run the program, it told me the following: (X)Undefined symbols: _DrawGLScene _InitGL _ReSizeGlScene _glutResizeFunc collect2: Id returned 1 exit status It seems like there is a header file missing, or a mistype of the functions (the latter of which I'm doubting). I have searched around, but was unable to find an answer elsewhere. Also the code was pretty much an exact copy that was provided in the NeHe tutorial. It is as follows Source: Lesson: Mac OS X
#include <OpenGL/gl.h>		// Header File For The OpenGL32 Library
#include <OpenGL/glu.h>		// Header File For The GLu32 Library
#include <GLUT/glut.h>		// Header File For The GLut Library

#define kWindowWidth	400
#define kWindowHeight	300

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

int main(int argc, char** argv)
	glutInit(&argc, argv);
	glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize (kWindowWidth, kWindowHeight);
	glutInitWindowPosition (100, 100);
	glutCreateWindow (argv[0]);




	return 0;
I am pretty decent with the C language (currently making my first version of a raytracing program for a class), to just give some background information. Also, I am running Mac OS X 10.4 Tiger and, as said in the subject, using XCode 2.2. Any information that can be given is greatly appreciated. Thank you very much for your time!

Share this post

Link to post
Share on other sites
I've never used Mac, but the linker errors you reported shouw that you didn't define the functions DrawGLScene,InitGL and ReSizeGlScene. Or perhaps you forgot to link to anoether file where you defined them?
The latter one is perhaps something GLUT needs, take a look at the Glut documentation about this function (just google).

Posible code for the three functions is (taken from NeHe lesson1):

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
glBegin(GL_TRIANGLES); // Drawing Using Triangles
glVertex3f( 0.0f, 1.0f, 0.0f); // Top
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right

GLvoid InitGL(GLvoid)
// Enable Smooth Shading
// Black Background
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
// Depth Buffer Setup
// Enables Depth Testing
// The Type Of Depth Testing To Do
// Really Nice Perspective Calculations

GLvoid ReSizeGLScene(int Width, int Height)
// Prevent Division By Zero
// This condition occurs when the window height is 0 or less. We simply
// pretend it has a hight of 1. The window will probably not be drawn.
if (Height<=0)

// Reset the current viewport.

// Select The Projection Matrix
// Reset The Projection Matrix

// Calculate The Aspect Ratio Of The Window

// Select The Modelview Matrix
// Reset The Modelview Matrix

Hope that helps

Share this post

Link to post
Share on other sites
That fixed it. I didn't think to look in the other Lesson 1's for them... I knew they hadn't been defined but assumed that I was just overlooking a header file or that something was missing in one of my frameworks. Looks like I assumed wrong. :)

Thanks very much.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!