PDA

View Full Version : opengl glut xcode carbon cocoa confusion?


geroldboehler
2004.08.29, 08:34 AM
hi all

my name is gerold and i'm new to this list. sorry for the message title
but its hard to pack so many questions into one line. i have quite a mess
in my head so if anyone could help me clean up.

my situation is as follows:
i am developing a game (guess) which should be portable. therefore i keep
all the graphics and i/o stuff in seperate classes (bridge pattern approach)
and implement the graphics engine seperate for each plattform.
now, i don't want to reinvent the wheel over and over again, so i
use opengl for visualisation because it's available on unix and win platforms.
now i have some questions:

unfortunately i'm new to opengl so there's some confusion about it.
please tell me if the following is correct:
the opengl library is the same on every platform.
only stuff like window creation or setting pixelformats is platformspecific.
therefore it should be possible to write seperate initialisation code for different platforms and use the same opengl render code for all platforms.

now the following questions arise:
i develop the game logic in c++, only using the standard c++ library. now, to implement the visualisation as described above there's some confusion concerning the mac implementation of opengl:
i'd like to implement everything in c or c++. therfore i have to use the carbon framework. but it seems to me as if carbon is something that's not beeing used much anymore so i am not sure if this is the way to go (is it?)

more questions about opengl/mac development.
are the following assumptions correct?

- agl is the mac specific implementation of opengl calls that are system specific
- gl is the standard opengl library
- glut is a kind of wrapper around gl that hide's the system specific stuff and
provides a standard portable interface but leaks performance
- carbon framework provides libraries and support for procedural languages (c, ...)
- cocoa is the same as carbon, only for objective-c


thanks for you support and for this great forum

gerold

Nick
2004.08.29, 08:52 AM
I'm not quite an expert but Carbon is not needed for OpenGL. I use C++ without the carbon framework.

NCarter
2004.08.29, 08:54 AM
Hi Gerold! Welcome to iDevGames!

the opengl library is the same on every platform.
only stuff like window creation or setting pixelformats is platformspecific.
therefore it should be possible to write seperate initialisation code for different platforms and use the same opengl render code for all platforms.
All of the above is true.

i'd like to implement everything in c or c++. therfore i have to use the carbon framework. but it seems to me as if carbon is something that's not beeing used much anymore so i am not sure if this is the way to go (is it?)

Well, Carbon isn't going to go away any time soon, if ever. Not everyone wants to program in Objective-C (I don't, particularly), so eliminating Carbon would cut out a lot of developers.

You don't have to use Carbon, though. You could try one of the many OpenGL compatible cross platform libraries. I've just started using SDL (http://www.libsdl.org/) for my new game, and it seems to be very easy to use and offers a quick way of getting into OpenGL without using GLUT. I'd recommend it!

- agl is the mac specific implementation of opengl calls that are system specific
Yes. There's also CGL and a Cocoa GL view (I believe) which provide different APIs to do the same thing (they're all Mac specific).

- gl is the standard opengl library
- glut is a kind of wrapper around gl that hide's the system specific stuff and
provides a standard portable interface but leaks performance
- carbon framework provides libraries and support for procedural languages (c, ...)
- cocoa is the same as carbon, only for objective-c
Again, all of the above is true. Looks like you're on the right track.

Hope this helps!

Josh
2004.08.29, 08:58 AM
hi allHi!
therefore it should be possible to write seperate initialisation code for different platforms and use the same opengl render code for all platforms.Correct. Though you could use SDL and then let it figure out the initialization for all the different platforms.

i'd like to implement everything in c or c++. therfore i have to use the carbon framework. but it seems to me as if carbon is something that's not beeing used much anymore so i am not sure if this is the way to go (is it?)First off, Carbon is still used quite a bit. Secondly you don't have to use Carbon to setup OpenGL. Enter SDL again. :)

- agl is the mac specific implementation of opengl calls that are system specific
- gl is the standard opengl library
- glut is a kind of wrapper around gl that hide's the system specific stuff and
provides a standard portable interface but leaks performance
- carbon framework provides libraries and support for procedural languages (c, ...)
- cocoa is the same as carbon, only for objective-c
1) yes, though there is also CGL and NSGL on Mac, depending on your API
2) correct
3) yes, and the Mac OS X implementation is quite buggy; don't use GLUT
4) correct
5) essentially, yes

Edit: great minds, NCarter, great minds... ;)

FCCovett
2004.08.29, 01:35 PM
There's an example source code (400 kb) on how to use Carbon to set up a window, manage Carbon events, load textures, set up an OpenGL context, and some other goodies, at: http://webpages.charter.net/utopiaplanetia/BasicCarbonStruct.dmg

geroldboehler
2004.09.02, 03:09 PM
hi you, thanks for your answers, it's good to know i'm heading in the right direction =)

gerold