I have started my project in Powerplant carbon library.
Now I want to use OpenGL library in my project. How can I use it?
-hemant
In article
<b45fb15bb3acab1f0884c41efee8dbbb@localhost.talkaboutmac.com>,
> I have started my project in Powerplant carbon library.
>
> Now I want to use OpenGL library in my project. How can I use it?
The PowerPlant Contributed Class Archive
<http://www.metrowerks.com/MW/Support/powerplant/> has some useful (if
old) sample code (GLPane) to get you started on a OpenGL LPane that can
live in a window with other PowerPlant panes, but usually people just
open a single full screen window for OpenGL. It will also give you some
insight into how people pass events, PowerPlant messages, and PowerPlant
commands to OpenGL panes in a PowerPlant program.
<http://www.ati.com/developer/demos/macss2/> has some inspiring OpenGL
Mac demos. The "animusic" one is particularly worth watching. Apple's
<http://developer.apple.com/qa/qa2004/qa1166.html> is useful. "AGL" is
Apple's API for using OpenGL in a pane in a window. "CGL" supports
full-screen and offscreen, while "NSGL" is Cocoa. I Think of the
windowing portion of GLUT as mostly useful for cross-platform demos, but
not too useful in a Mac program that feels like a real Mac program.
I like to use two CRTs and put the OpenGL full-screen on the second CRT.
Carbon CFM or Carbon Mach-O?
If Mach-O, just add the appropriate Frameworks to the Frameworks panel
of your project. (The easiest way to do this is to set your project to
its framework panel, then drag the frameworks from the
/System/Library/Frameworks folder window in Finder. You'll need the
OpenGL framework, of course, and probably also the GLUT and AGL
frameworks.
In your code, you'll
#include <OpenGL/OpenGL.h>
If CFM, you'll download the SDK from Apple's SDK page
<http://developer.apple.com/sdk/>, (search in that page for:
"OpenGL CFM SDK
This SDK is provided for developers building CFM applications using
OpenGL on Mac OS X.")
then add the library to your project, and add the header's folder to
your access paths panel of your project's target's settings dialog box.
I usually put non-standard libraries in /Library/C++/, and define one
source-tree on Metrowerk's Preferences, and use that source tree to
refer to the header's folder, just to have a standard place to put
libraries that aren't guaranteed to be present on the a system.
Under CFM, you'll not use framework style includes, but, assuming you've
set up your access paths correctly:
#include <OpenGL.h>
Naturally, since you might switch from CFM to Mach-O, you'd want to put
all these #includes in a separate file that you include from the "C/C++
Preprocessor" panel of your target's preferences.
Put them in a separate file, rather than in the "C/C++ Preprocessor"
panel directly, so that:
* You can search them. Find All does not search the settings dialog box.
* If you change the .h file affecting the list of #includes, then that
one change affects all the relevant targets. In the panel directly, and
you have to change the panel individually for each target.
* If you ever want to move to another compiler, you won't be ignoring a
critical piece of the source code of your programs that mysteriously
doesn't appear in any source file.
A "Prefix Text" panel has supporters, and might have some advantages,
but I don't know what those advantages are.

Signature
David Phillip Oster