
There
are some old OPENGL
source code examples available on the net. All worth a look at
if
you are learning OpenGL. The trick is to get them to compile on XCode.
Well
It's not that difficult. In fact its eeeasy!
So get your XCode Discs
out and start running ... XCode that is!
Here are some of the old
OpenGL source code examples, they needed a bit of dusting off.
You
should be able to compile most of them on XCode, using your OS X super
powers.
Oooh, I can feel the energy out there folks.
The teapots.c
example will only take a few minutes to create the project and compile
it.
The end result will look like the image above.

Then go to file and open a new project which is a Standard C tool.

Next we assign the project a name, which will be its original
OPENGLexample name "teapots".

Once the teapots Project Window Appears we can add
the Required OpenGL and GLUT frameworks. For more information
on the project window click here.

Buy holding down the control key and clicking on teapots project file you will then
see the Add menu option. This is where we will add from the "Existing frameworks"
to the project.

Select from the Existing Frameworks and Add Cocoa, GLUT and OpenGL Frameworks.
You can do this individually or by keeping the Apple key pressed and clicking on the
Cocoa framework, GLUT framework and OpenGL framework.

Once selected press add.
The confirmation screen will appear then click on add again.

The project will now appear with the frameworks as per the image below.
Now we replace the content in main.c with that of teapots.c

In this example I have not renamed the file to keep it short.
Then open up the .c file by clicking on it.

includes or header files with the those that XCode understands.

So Select all the code in teapots.c and paste it into the project .c file.

Now we replace the original teapot.c header or include files with these:
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <OpenGL/glext.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>

Now we hit "Build and Go" and hey presto Tea Pots will appear demonstrating the Open GL
lighting and textures.
Finding documentation on the web regarding OpenGL and GLUT is no easy task.
It would appear an OPENGL book is a good idea; if you want to learn more.
Now you can compile a whole wadge of examples from this link.
There are also more OPENGL redbook examples located here.
EnjoyGL.
Download XCODE Project Source Here
Related links :
Free XCode Rubiks Cube Project source
XCode OpenGL Examples
Two More OpenGL ported Examples
OpenGL RedBook Programming Guide




0 comments:
Post a Comment
Links to this post
Create a Link