cross-platform code

leggo
Unregistered
 
Post: #1
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
Quote this message in a reply
Moderator
Posts: 691
Joined: 2002.04
Post: #2
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...

Mark Bishop
Quote this message in a reply
leggo
Unregistered
 
Post: #3
tnx!
any idea of where I can find some examples/tutorials/source code?
Quote this message in a reply
Moderator
Posts: 592
Joined: 2002.12
Post: #4
The SDL website (http://www.libsdl.org/) has the information you need plus links to tutorials.
Quote this message in a reply
Moderator
Posts: 691
Joined: 2002.04
Post: #5
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)

Mark Bishop
Quote this message in a reply
leggo
Unregistered
 
Post: #6
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
Quote this message in a reply
Moderator
Posts: 691
Joined: 2002.04
Post: #7
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...

Mark Bishop
Quote this message in a reply
leggo
Unregistered
 
Post: #8
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
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #9
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...

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
leggo
Unregistered
 
Post: #10
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>
Quote this message in a reply
Member
Posts: 156
Joined: 2002.10
Post: #11
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
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #12
How about SDL/sdl.h> ?
Quote this message in a reply
leggo
Unregistered
 
Post: #13
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
Quote this message in a reply
Oldtimer
Posts: 832
Joined: 2002.09
Post: #14
I think Jabber's right there: #include <SDL/sdl.h> should do the trick (lower-caps on the header)
Quote this message in a reply
leggo
Unregistered
 
Post: #15
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
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Cross platform question kordeul 13 4,942 Aug 22, 2007 03:09 AM
Last Post: kordeul
  Cross-platform gui? Duane 13 5,081 Jul 6, 2007 06:38 PM
Last Post: mac_girl
  Best cross platform API for PC &amp; MAC Tarek Demiati 6 3,106 Apr 16, 2006 03:07 PM
Last Post: Dan Potter
  Cross platform game code on a budget Carlos Camacho 7 3,587 Apr 19, 2003 09:29 PM
Last Post: Mars_999
  Cross-platform Solutions DJBlufire 13 4,798 Feb 16, 2003 02:40 PM
Last Post: athomson