I see this is part of the roadmap. I'm just wondering if this is realistic or not, how much work it would be and most of all: what would be the major changes required to make cocos2d compile and run on the Mac?
Out of curiosity: what would it take to make cocos2d run on Mac?
(21 posts) (9 voices)-
Posted 1 year ago #
-
Swap out all of the openGL ES code for openGL proper. And any UIKit to AppKit. Maybe a few other loose ends.
Posted 1 year ago # -
Well, i thought: why not try it myself? So i made a copy of cocos2d-iphone, changed the Base SDK to Mac OS X 10.6, renamed UIKit to AppKit headers, same with OpenGL. Compiles with only ~1600 errors.
Judging from the errors, a lot will be renaming things like NSPoint instead of CGPoint, NSImage instead of UIImage, etc. Removing UITouch and iPhone SDK specific stuff as well. I think i'll spend an hour on this and see how far i can get with it.
Posted 1 year ago # -
You might be able to get around many of the CGPoint and NSPoint things by using #defines. If you do this, make sure you also change CGRectMake() to NSMakeRect(), etc.
Posted 1 year ago # -
it's way more work then you think. Some gl calls of OpenGLES don't have "rename" alternatives in OpenGL
Posted 1 year ago # -
Copy that, i got it down to about 800 errors and while there are still some because of DeviceOrientation, Accelerometer, Touches and other iPhone specifics it seems that the biggest change by far will be to rewrite the GL stuff (no EAGL).
Just for further reference, here's what i did:
change base sdk to mac os x
replace target frameworks with those from mac os x
rename <UIKit/UIKit.h> to <AppKit/AppKit.h>
rename <OpenGLES/ES1/gl.h> to <OpenGL/gl.h> (same with ext and others)
rename (most of) CG* and UI* (Window, View, Image, TextAlignment, Application ...) to NS* counterpartsTo be removed/replaced:
touches
device orientation
accelerometer
EAGL stuff
PVR stuff
FontLabel
UIDevicePosted 1 year ago # -
Old an out of date, but there are desktop "wrappers" for opengl es, such as:
http://sourceforge.net/projects/dgles/
Even if that project is not useful, the technique may be?
Posted 1 year ago # -
Posted 1 year ago #
-
Why use opengl-es on a mac instead of opengl? It's almost the same as saying hey I love not having all the quartz capabilities on the iphone how can I make sure I don't have them on the mac too?
Posted 1 year ago # -
@TouchGameDev: you have it upside down ...
@bradparks: that's cool, i'll check it out.
Posted 1 year ago # -
How is that upside down? The iPhone SDK clearly states all of the goodies you can no take advantage of. Please point me to what I am missing so I can learn instead of a one line dismissal statement. I thought you were a expert teacher - comments like those fall very short of being helpful.
Posted 1 year ago # -
"OpenGL ES 1.1 and 2.0 are subsets of the full OpenGL standard. Some OpenGL functionality is not available in OpenGL ES"
That's a quote from ARM. They specifically talk about limited shaders and shadows. So while opengles is faster for an EMBEDDED device it does not have all of the goodies of the desktop openGL - how do I have this upside down? If you are creating a game for the Mac why would you not want to have these things available - further if you read apples documentation you will discover that indeed an a definitive No on you do not get all of the desktop quartz capabilities on the iphone device.
Posted 1 year ago # -
First off cocos2d is an openGL ES 1.1 based engine.
Second, many developers are quite happy with what they have created for iPhone and have never even given thought to openGL because cocos2d hides it away from them and they would like to port their game to run on the desktop.
Third, using a wrapper around existing openGL ES functions would just help in the porting of existing code. It would not prevent you from adding more openGL code to your game or making use of shaders etc...
Posted 1 year ago # -
Hey CJ - thanks so much for clearing this up that was very helpful certainly more so then the one line telling me I have it upside down. I don't know what I said was upside down though - maybe since the thread mentions nothing about needing a wrapper for these games the way you did it would help to clarify this from the beginning. I happen to know several people that have been able to do things as such and I would be happy to point you their way if needed. Why don't you PM me so I can get your contact details and we can talk further - I have another thought but in risk of saying the wrong thing and being upside down II think best talk to a moderator first. Thanks.
Posted 1 year ago # -
Posted 1 year ago #
-
@TouchGameDev:
I was asking what needs to be done to compile and run cocos2d on the Mac as opposed to the iPhone or iPhone Simulator.CJ pointed out: "Swap out all of the openGL ES code for openGL proper."
Meaning: to do that one would have to replace all the incompatible or not existing OpenGL ES code and re-write it as proper OpenGL code so that cocos2d can run on the Mac. For example, OpenGL ES has functions defined in EAGL which simply do not exist in OpenGL. OpenGL ES is a subset but (and i didn't know that either) that doesn't mean that it is fully compatible with OpenGL.
Others then pointed out that there are wrappers for OpenGL ES so that GL ES apps can run on Mac without having to rewrite the GL ES code.
Personally, i don't care if a prospective cocos2d-mac would use either a GL ES wrapper or has a rewritten renderer. I think using a wrapper makes more sense though since it'll make it easier to keep the port up to date.
The whole point of the port was discussed in another thread. It's not to become a cool 2D game engine for the Mac but instead for developers to be able to write visual editors for cocos2d-iphone games, ideally based on a shared codebase.
I'm sorry that i haven't taken the time to explain this in more detail. I thought it was clear from the first two posts that the idea isn't about that anyone wants to use OpenGL ES in a Mac port but about the problem of GL ES not being available on a Mac. GL ES code just doesn't compile on the Mac.
Posted 1 year ago # -
Hey Steffen don't get so upset CJ explained it perfectly and I understood everything he said just fine. I did not know there was another thread either. The only thing I said was why not take advantage of all the goodies on the mac since you would have more of them for a game on the desktop - that's not upside down according to your blog - "Games aren't built overnight" correct? So port or not hey why not take advantage of those extras too and as CJ explained you could also still do this. Nobody was looking for a fight. I am not sure why you are being so defensive. Everyone is so tense in this place - yesterday I mentioned the name of a 3D artists for people who needed one and I said they were professional a pleasure to work with and the best artist I have seen on the forums - I got a response how would I know I have only been a member (me) for two hours. Holy crap. People need to calm down - this is why stackoverflow has so many users people are calm and nice. In my own defense I have been a member since the forum went up. I used a different name but now that I have been using twitter I just didn't want it to be confusing and so they would know that I was the source. I think it's time for all ye programmers to stand up take a big stretch let the eyes get some sun instead of monitor rays take a walk or do whatever it is you do when you are not in front of your machine. <-That is an opinion just to further clarify I respect yours as well.
Posted 1 year ago # -
@gaminghorror how is your effort to port going?
Posted 1 year ago # -
That was just a test that i spent 1-2 hours on. I was curious and wanted to see how far i would get.
I'm sorry if i made the impression that i'm actually going through the effort to port it.Posted 1 year ago # -
You should! :)
Posted 1 year ago #
Reply
You must log in to post.