iDevGames Forums
cross-platform code - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: cross-platform code (/thread-6446.html)

Pages: 1 2 3


cross-platform code - leggo - Jul 14, 2004 02:35 AM

I've recently bought an iBook and I'd like to use it to code my opengl apps! I've been coding only for win so far and I'm still a beginner (I've created a stupid game and a tetris clone)
I'd like to make cross-platform code so I can work both on mac and on pc and show my works to my friends! Rasp
Is it possible? where can i find some examples?

tnx LOL


cross-platform code - sealfin - Jul 14, 2004 04:38 AM

You've got a few choices, primarily either GLUT or SDL; I'd recommend the SDL library: easy, free, reasonably documented, knowledgable and helpful mailing list, games orientated, and cross-platform for Mac OS X, Windows, Linux, and a host of other minor platforms...


cross-platform code - leggo - Jul 14, 2004 05:06 AM

tnx!
any idea of where I can find some examples/tutorials/source code?


cross-platform code - BeyondCloister - Jul 14, 2004 05:14 AM

The SDL website (http://www.libsdl.org/) has the information you need plus links to tutorials.


cross-platform code - sealfin - Jul 14, 2004 05:16 AM

Apparently NeHe has a few SDL ports; failing that, I'm not sure - I think there are a few tutorials for 2D SDL code (there's a platform game example/tutorial which is always mentioned on the SDL mailing list) but I don't have the links to hand, sorry - if you want, email me and I'll send you a few SDL/OpenGL examples I coded a while back - they pretty much cover all the basics (creating an OpenGL context with SDL, using SDL_image to load textures, et al; they're not pretty, but they do work Rolleyes)


cross-platform code - leggo - Jul 14, 2004 05:34 AM

sealfin Wrote:Apparently NeHe has a few SDL ports; failing that, I'm not sure - I think there are a few tutorials for 2D SDL code (there's a platform game example/tutorial which is always mentioned on the SDL mailing list) but I don't have the links to hand, sorry - if you want, email me and I'll send you a few SDL/OpenGL examples I coded a while back - they pretty much cover all the basics (creating an OpenGL context with SDL, using SDL_image to load textures, et al; they're not pretty, but they do work Rolleyes)

thank you for your help! Smile
I have found some examples, but I have a prob lem: xcode Rasp
I have create a new empty project, added the opengl, sdl and carbon frameworks and loaded the example files
the problem is the "include"
I've tried with
#include <GL/gl.h> but it gives me error when I compile
sorry for my crappy english Rasp


cross-platform code - sealfin - Jul 14, 2004 05:41 AM

Try #include <OpenGL/gl.h>

If you've installed SDL via one of the packages at the SDL site, you should already have the option of an "SDL OpenGL Application" in the New Project window of Xcode anyway...


cross-platform code - leggo - Jul 14, 2004 05:46 AM

sealfin Wrote:Try #include <OpenGL/gl.h>

thank you!
now I only need to know how to include sdl! I haven't understand how frameworks work yet Rasp

edit:
I really can't figure how to include sdl! I've been searching over the net and it seems to be a common problem! (and no one knows the answer Rasp )
Cry


cross-platform code - Steven - Jul 14, 2004 07:45 AM

Assuming you're using XCode, you should just need to drag the framework into the Frameworks folder in your project and add #include <SDL/sdl.h> or something like that...


cross-platform code - leggo - Jul 14, 2004 08:17 AM

Steven Wrote:Assuming you're using XCode, you should just need to drag the framework into the Frameworks folder in your project and add #include <SDL/sdl.h> or something like that...

yeah I'm using xcode...
I've added the sdl and opengl frameworks (they are listed among the other files of the project, on the left), however it doesn't work neither with <SDL/SDL.h> nor <SDL.h>


cross-platform code - IBethune - Jul 14, 2004 11:35 AM

You need to add the following to your linker flags (in the target build settings)

-framework SDL

(and for any other frameworks you are using).

- Iain


cross-platform code - Josh - Jul 14, 2004 11:41 AM

How about SDL/sdl.h> ?


cross-platform code - leggo - Jul 14, 2004 12:01 PM

IBethune Wrote:You need to add the following to your linker flags (in the target build settings)

-framework SDL

(and for any other frameworks you are using).

- Iain

I added -framework SDL to "other link flags" where xcode put -framework Carbon, but it was useless Sad


cross-platform code - Fenris - Jul 15, 2004 12:30 AM

I think Jabber's right there: #include <SDL/sdl.h> should do the trick (lower-caps on the header)


cross-platform code - leggo - Jul 15, 2004 01:56 AM

Fenris Wrote:I think Jabber's right there: #include <SDL/sdl.h> should do the trick (lower-caps on the header)

no... it doesn't work! Sad
I've tried all the combinations! Rasp

Today I've also tried to add to "Framework Search Paths" the path of my sdl framework, but it was useless... Cry