Reputation: 681
I want to learn Open GL ES for iOS. I heard Open GL ES is mainly programmed in C++ or C. And iOS apps are done in Objective-C or Swift. Is it possible for me to render images and objects with Open GL ES in C++ and combine it with the iOS part in Objective-C.
Also if that is is possible, would I do the Open GL ES part in Xcode with C++ or use another IDE? And then obviously use Xcode for the iOS part.
Upvotes: 1
Views: 356
Reputation: 16774
It makes no difference for you what language is "OpenGL ES mainly programmed in". What matters is what the API is like. The API differs on iOS depending on the language you are using. ObjectiveC will have almost all of the API in C (Not C++) where the rest is in ObjectiveC (context wrapping and hooking to UIView
). Swift on the other hand uses Swift wrapper around the API which is generally a complete pain and with a combination of data and buffer structuring in Swift I would (for now) discourage you on using Swift. Your application may still be in Swift but I suggest at least the openGL part is in ObjectiveC and then bridged to Swift for usage.
When using ObjectiveC you may use all of the functionality of standard C out of the box. If you want to use the C++ you need to set the certain flags but there is a very simple way to make the Xcode do that for you by simply renaming the ".m" files to ".mm". These will use C++ by default.
No matter the language I suggest you to use Xcode for the openGL part. Next to the friendly autocompletion you have a variety of nice tools to debug and analyze your product.
You have some libraries designed by Apple as well mostly in GLKit. Some of them are useful such as working with matrices but more or less everything else boils down to "Don't use it" once you get to a certain point of development.
But since you say you are starting to only learn I suggest you to simply see some examples from tutorials and documentation. The Apple raw openGL ES documentation is actually quite impressive with all the snippets and explanations (comparing to the rest of the documentation). So you may use any of these and probably some StackOverflow and you should be on your way in no time.
Upvotes: 1