Discussion in 'iOS Programming' started by kage207, Jun 18, 2009.

  1. kage207 macrumors 6502a

    Jul 23, 2008
    Okay, so I just got a book called Mobile 3D graphics with OpenGL ES and M3G. I plan on making games for mobile devices. I'd just like to ask anyone with experience with OpenGL ES to say what they had experience with before they began working with it.

    Also, I'm reading a book called iPhone SDK Programming, I just don't understand the words they were using on the iTunes U with Stanford. The book helps me go at my own pace and I'm learning a lot more.

    Btw, I only have experience with console applications in the following languages, C++ and Java. I began to learn about classes and functions in C++ last year. I also know HTML, I know that isn't that hard but, I understand that. And I'm good at C++ and Java when making basic console applications.

    So basically, I'm going to read iPhone SDK Programming, and design a program. But my real question is, how hard is OpenGL ES? Do you need to know calc? I saw some stuff in the Mobile 3D Graphics book that might have looked like calc. And any tips to help me learn OpenGL ES would be appreciated!
  2. Thomas Harte macrumors 6502

    Nov 30, 2005
    Calc as in calculus? It's not at all relevant to OpenGL — it is interested only in linear algebra-type stuff.

    OpenGL ES doesn't contain any desperately hard maths that you absolutely have to understand in order to get going (given that you can treat the matrix stacks as black boxes if you're happy with glRotatef, glTranslatef and glScalef), but memory management is a pain. In full-size OpenGL, there are a bunch of API calls of the form glVertex, and others related to it, that allow you to do things like:

       glVertex3f(0, 1, 0);
       glVertex3f(1, 1, 0);
       glVertex3f(1, 0, 0);
    // just draw a triangle between (0, 1, 0), (1, 1, 0) and (1, 0 0)
    But they're not particularly efficient, so were cut from the ES spec. So you need to arrange all your data into correctly laid-out arrays and make the necessary calls to glEnableClientState and glVertexPointer/etc. It's the sort of thing you'll probably have permanently encapsulated below your own higher-level classes almost immediately, but it is an entry barrier.
  3. lazydog macrumors 6502a

    Sep 3, 2005
    Cramlington, UK
    OpenGL ES is really nice and easy to learn. Invariably there is a little maths involved because you're dealing with 3d, geometry etc, but to what extent really depends on your game.

    C++ and OpenGL work together really well and that is true for the iPhone too - it's possible to write an OpenGL based game on the iPhone which is 99.99% C++.

    If you want to learn OpenGL ES then I would recommend getting a copy of the The OpenGL Programming Guide - The Redbook. There is an online version here. There are differences between OpenGL and OpenGL ES though but the Red Book covers everything that's in ES. This link lists all the functions in ES (there are some Apple extensions as well though), so keep it handy when reading the book. The biggest difference between full OpenGL and ES is that there is no immediate mode in ES.

    While going through examples etc you'll come over something called GLUT. It's a really easy to use API for writing and experimenting with OpenGL. You'll need to run it on the Mac but it's super easy to use. GLUT is already insatlled on your Mac and Xcode comes with an example GLUT project but the best thing is to download a sample GLUT project for the Mac and start from there. I can definitely recommend using GLUT while you are learning.

    Then there is OpenGL ES 2 (used on the 3GS). For that you'll want to get a copy of the OpenGL Shading Language - (the orange book or is it yellow?). ES 2 is quite different from the 'fixed pipeline' of ES 1, but ES 2 will also run programs written for ES 1 so nothing is wasted by learning ES 1 first. In fact, I think it is a really good idea to put learning ES 2 on hold until you are well acquainted with ES 1.

    good luck

    b e n

Share This Page