Cross-platform development with GLKit?

I just installed the current version of Xcode 4 and implemented the new GLKit API, which is also used in the OpenGL template for iOS. So, I want to develop a cross-platform game for iOS, Mac and Windows. GLKit looks like a step backward in terms of portability, but GLKit features (especially such as asynchronous texture loading) are big advantages ...

How can I develop a cross-platform game with GLKit? I will need to write any county code twice, right? Or is there something like a GLKit implementation for windows?

Any idea, workaround, code development tips (how to separate GLKit code from other components?) Is welcome - thanks!

+6
source share
1 answer

I canโ€™t think of anything that GLKit does, which cannot be replaced with code other than GLKit. This may make some of the tasks of OpenGL ES 2.0 easier, distracting them from you, but it does nothing unique. The closest thing to what you have is something that you cannot reproduce elsewhere (from what I was messing around with) - this is an accelerated matrix and the vector math functions it provides, but even those can be replaced with a little acceleration or code NEON.

Although I would like to use GLKit in my applications, I still support iOS 4.2 with them, which does not have GLKit. I have nothing to do, because I cannot use GLKit, I just need to write a little more code to handle things like viewing updates, downloading textures, math, etc. There is a lot of documentation and examples for these operations, so you donโ€™t have to worry about being independent when it comes to implementing them.

You will have much bigger problems than GLKit when you try to make your code cross-platform with a Mac, and in particular with Windows. Desktop OpenGL and OpenGL ES have some differences in their implementations, and you need to know the places to replace one function or inline variable with another. CAOpenGLLayer and NSOpenGLView on Mac are also different from CAEAGLLayer on iOS, and AppKit as a whole is a different animal than UIKit.

Windows will be even more difficult to support because you will not be able to use any of the Cocoa frameworks and most likely not Objective-C. This will take a lot longer than any OpenGL / OpenGL ES differences.

+5
source

Source: https://habr.com/ru/post/907507/


All Articles