Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I use OpenGl for iPhone games??

Hi! As you know I really want to be an iOS developer. I know how Xcode works. But I don't know for the graphics and animation. I've heard that OpenGl can be used in games. But how? I mean like connecting the animations in OpenGl to the program written in XCode. I don't understand that part yet. So please can you guys explain me about that. I thank you all.

iPod touch, iOS 6.1.3, 4th Generation

Posted on Jul 31, 2013 8:33 PM

Reply
15 replies

Aug 1, 2013 9:48 AM in response to Eric Grylls

There is not a simple answer.


Need more information first:

- Do you know anything about OpenGL already or are you starting from scratch?


- Do you know anything about 3D computer graphics or are you starting from scratch?


iOS does not use OpenGL, it uses OpenGL ES (designed for embedded devices)


Here are some links to get started:


Khronos is the organization in charge of the standard:

http://www.khronos.org/opengles/


A great basic intro to OpenGL ES:

http://db-in.com/blog/2011/01/all-about-opengl-es-2-x-part-13/

(English is not the writer's first language but he does a fantastic job explaining the basics anyway)


If you don't already know computer graphics I would get a basic graphics book as well. OpenGL is difficult to use properly without understanding viewing transformations etc.


Hope this helps.

Aug 2, 2013 4:03 AM in response to swgeek

Thank you sir. Now I know that iOS use OpenGL ES. Well, I'm going to start from scratch. I have try those XCode and other stuffs but I know them by reading. So my next question is, Can I get it (OpenGL ES) in MacBook Air? Plus, XCODE is for programming. So how can I use that openGl ES. I mean connecting the program to the animations. I mean like that. Sorry if my English is confusing. I'm not from US or Europe. I'm from Burma. But I hope you can help me. Thank you. :-)

Aug 2, 2013 12:08 PM in response to Eric Grylls

OpenGL is a programming library, so if you ask how to use it (direclty), you are only going to get directed to any number of resources and tutorials and example bits of code.


OpenGL on a macbook air is probably not going to be ES, because that version of OpenGL is targeted for embedded applications (ES I think stands for embedded systems). ES is a stripped down version of OpenGL.


These pages might clarify the differences and direct you and any questions you have a bit better.


https://developer.apple.com/technologies/ios/graphics-and-animation.html


https://developer.apple.com/technologies/mac/graphics-and-animation.html


Connecting a program to 'the animations' might mean you are asking how to animate stuff. There are any number of ways to implement animations, and depending, open-gl is not the API you want to deal with. It is quite low level.

Aug 2, 2013 1:50 PM in response to Eric Grylls

Hi Eric,


it would help me frame answers if you give the background information:

- do you know any 3D computer graphics theory? E.g. viewing transformations.

- do you know any openGL already?

- do you already know objectiveC and ios programming?


To answer your questions:

- the OpenGL ES libraries are already included as part of the iOS SDK, so if you have that you are set.

- I am using an Air myself, works fine for developing for iOS, including code using OpenGL ES.

- OpenGL ES is based on OpenGL 3.0, so is very similar. Almost the same.


- read the post I linked to:

http://db-in.com/blog/2011/01/all-about-opengl-es-2-x-part-13/

He explains how to hook things up quite well. However, you do already need to understand how to develop for iOS.


As I mentioned above, it helps to know 3D Graphics principles. If you do not know that then it is difficult to animate using openGL (or any other SDK). There are third party tools available (e.g. Corona, Unity, project Anarchy) that can make life easier, but at some point you simply have to learn 3D graphics. Trying to do animation without understanding graphics is like trying to write native apps without understanding programming. You can cheat to do basic stuff, but nothing useful or deep.


This is not easy stuff, you will have to put some work into it. Start with the above link as an intro, and also the apple docs pointed to by teacup.


Good luck!

Aug 2, 2013 10:55 PM in response to swgeek

Hi swgeek.

Well I don't have any experience in 3D animation and graphics YET. And what do u mean "Including code using OpenGL ES". Is Maya the same with OpenGL or OpenGl ES in basic ways. Like coloring, transformation. If so I will take a course for Maya.

To tell the truth, I'm going to start from the START. I need that information that I will need.


And I don't understand what teacup775 means. That point that => "OpenGL on a macbook air is probably not going to be ES, because that version of OpenGL is targeted for embedded applications (ES I think stands for embedded systems). ES is a stripped down version of OpenGL” <=


Please explain me those point cuz; I'm kind of confusing in those points. I'll be glad if u help me. Thank you.

Aug 2, 2013 11:16 PM in response to Eric Grylls

oh lordy son.


Maya is not the same. Maya is a 3D modeling and animation application. OpenGL is an OS system library that interfaces to the graphics card of your computer.


Maya/3dsMax and programs like them are built on top openGL very much in the same way your text editor or email client program is built on top your computer's OS. If you want to write an email, you use the client or if you want to write the next Harry Potter series, you use the text editor. If you want to make the next animated feature film, you'd be using Maya and the like. If you want to make the next Unreal gaming engine, you'd do the same thing as well as using OpenGL for mac or linux.... but that is different from developing a game using the engine, or Unity.


--


OpenGL ES is a stripped down version of OpenGL. It has fewer features because phones and ipads are less powerful devices than a laptop or desktop. If you want to learn how to program to OpenGL, just use the version included in your laptop, and write code for mac os. You probably don't wan to take on development for ios because it will add more headaches that just don't mean much, when you're probably need to learn what a for-loop is first. Hope your math skills include abstract algebra, and first year college physics.

Aug 4, 2013 3:10 AM in response to Eric Grylls

Hey Eric,


first, did you read the link I posted? You may not understand everything right away, but it will help you over time if you read those links. Short answers here cannot possibly give you any understanding by themselves. i.e. read the post, and in your next question state that you have read it otherwise I will not respond any more.


1) OpenGL to run on the macbook air will not be ES, but you stated you want to be an iOS developer, so you will use OpenGL ES. If you write an app to run on the air, you will use regular OpenGL. If you write an app to run on iOS, you will use OpenGL ES.


2) No, you need to learn basic principles of computer graphics. Not Maya.


I am not trying to be evasive. You are asking us to summarize a HUGE topic, there are no simple answers.

Read the post. Then come back. And keep in mind that this is not simple stuff, it will take months of hard work from you to get up to speed on this stuff, not a couple of paragraphs on this forum.

Aug 4, 2013 9:03 PM in response to swgeek

Well sir, I'm reading both the posts you and techup775 gave me.


I will develop iOS games using a MacBook Air. I do need a Mac. But is OpenGL ES is a software that runs on Mac?


Sorry. I'm confusing with all those stuffs now. What should I do after reading all the posts? You are right. It will take months before I can ask another question. But by the ways. You all helped me. I thank you all. And I wish we can discuss further more.


But please. Is OpenGl ES a software that runs on a Mac? Or something like that. :)

Aug 4, 2013 9:33 PM in response to Eric Grylls

I would suggest that you not worry about opengl es specifically until you have more graphics experience and understand the domain a lot more. You probably have to learn basic programming, along with the math etc and all sorts of things before you should worry too much about ios developement.


I'd suggest googling for tutorials on the kind of thing you want to make, and follow those. If you cannot understand -them-, you will at least have some idea of what to ask about.


Good luck!

Aug 14, 2013 12:11 PM in response to Eric Grylls

Hi Eric,


sorry about the late reply, was out for a while.


Yes, it is confusing because there are a lot of choices and a lot of information to absorb. Unfortunately there are no simple answers.


You clearly have a desire to learn, so I do not want to tell you to simply go away until you know what to ask. Unfortunately I cannot think of a clear path for you either.


Let's start with what you know already:

- you said you need a Mac - that implies you do not already have a Mac. So let us take a step back: what exactly are your interests? i.e. what do you want to learn? Why do you want to learn iOS programming or OpenGL?


- If you simply want to play with graphics, there are other tools you can start at a much higher level, e.g. Unity3D.

- if you simply want to learn how to program, forget openGL for now. You can start with C/C++, Javascript, or objectiveC. You don't even need a mac.

- if you really want to learn how to program iOS then forgot OpenGL for now, learn objective C and how to get a basic GUI up for now, then you can decide later whether to use OpenGL or some other library. At that point ask again and we can help you decide that.



i.e. to help you decide what to do next you have to tell us what your goal is.

Aug 14, 2013 10:52 PM in response to Eric Grylls

Good, that helps frame the reply.


First, forget about OpenGL for now. That will just distract you from your main goal, which is apparently to become an iOS developer.


Go back even one step further. Why do you want to be an iOS developer?


- if the answer is just to make a lot of money, that ship may have sailed. The app store is pretty saturated and I would say most apps do not make much money any more, unless you get really lucky. The most popular apps these days seem to be produced by companies with money to hire designers and developers and a good marketing team.

However, if you become a good iOS developer you may get hired by someone, it depends.


- If the answer is because you love iOS devices and you really want to program for them, good for you. Keep going.


- if the answer is because you want to learn how to code and just picked iOS at random, think it through. You will have to buy a mac, pay for an apple developer account, and buy an iOS device to test with, + spend a lot of time learning. Nothing wrong with that, but you could always start out with something with less overhead (e.g. javascript), then spend the money once you are sure you loke programming and want to do it for iOS.


---


Anyway, let's assume you really want to code for iOS.


The next question is: Do you already know how to code in any language? E.g. C, C++, Java?

Aug 15, 2013 7:29 AM in response to swgeek

The answer is the second one. I love iOS. I love Apple. And I love all the products. Nothing can take their place. And I want my creations to be a part of them.


There is a problem with the last question. I don't know how to code in other languages yet. First I thought to learn C++. Then I found that it can't be used for iOS. So I stopped it. Then stuck here.


I need to learn how to code in another language(C, C++) before learning Objective-C, right?

Aug 15, 2013 10:22 PM in response to Eric Grylls

Hey Eric,


Cool. You know what you want to do :-).


No, you do not need to learn other languages before learning objective C.


So the suggestion stands: forget openGL for now, pick it up after you understand how to code for iOS using objective C.


I don't know the best way for you to learn objective C - I already knew other languages so it was easy for me to just pick up example code and play with it, but you will have to find a book or online tutorial that teaches it from scratch. Google search for that.

Big Nerd Ranch has a couple of books with a good reputation, but I have not used them so cannot comment.


Good luck!

How can I use OpenGl for iPhone games??

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.