Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Optimizing OpenGL for iPhone

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
7,705
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jan 22, 2010

(May 15, 2009) Tim Omernick from the popular gaming company, ngmoco, provides a broad overview of OpenGL on the iPhone.

Stanford University:
http://www.stanford.edu/

Stanford School of Engineering:
http://soe.stanford.edu/

Stanford University Channel on YouTube:
http://www.youtube.com/stanford

Category:

Education

Tags:

Download this video

LICENSE: Creative Commons (Attribution-Noncommercial-No Derivative Works).

For more information about this license, please read: http://creativecommons.org/licenses/by-nc-nd/3.0/.

High-quality MP4 Learn more

  • likes, 2 dislikes

Link to this comment:

Share to:
see all

All Comments (9)

Sign In or Sign Up now to post a comment!
  • @daivuk

    tried the code: float sinTheta = sinf(angle2) * spr->height * .5f; float cosTheta = cosf(angle2) * spr->width * .5f; topLeftX = x - cosTheta - sinTheta; topLeftY = y + sinTheta - cosTheta; topRightX = x - cosTheta + sinTheta; topRightY = y + sinTheta + cosTheta; bottomLeftX = x + cosTheta + sinTheta; bottomLeftY = y - sinTheta + cosTheta; bottomRightX = x + cosTheta - sinTheta; bottomRightY = y - sinTheta - cosTheta;

    but my sprites are rotated wrong and sliced

  • Hello very nice article!

    in my project my quads only rotate at fixed intervals (like it was sectioned), also the sprite is mirrored.

    i had a look at rotation code, but its somewhat magical and I dont know how to fix it, any hints? Thanks

  • He answers most of my question starting at 32:00. Sorry for not listening to all the talk before posting. It's still not clear to me why he's not using VBOs in the fireworks demo. Would the necessary transformation changes end up being too slow?

    Thanks a lot to ngmoco, and to Stanford for making all these videos available for free.

  • Doesn't the iPhone have buffer objects? It still doesn't sound fast to have all those vertex/tex coord/rgba data in arrays in client memory, modify it all the time (doing all the translation/rotation computations on the client), and then uploading it over and over again.

  • I think you overestimate the amount of extra overdraw for a single triangle

  • Good stuff for people to know. One thing tho, you are doing 4 sin and 4 cos per particle. Those are costly calls. You can do only 1:

    float sinTheta = sinf(rotation * TO_RADIANT) * size * .5f;

    float cosTheta = cosf(rotation * TO_RADIANT) * size * .5f;

    m_vertexArrayPtr[0] = x - cosTheta - sinTheta;

    m_vertexArrayPtr[1] = y + sinTheta - cosTheta;

    m_vertexArrayPtr[2] = x - cosTheta + sinTheta;

    m_vertexArrayPtr[3] = y + sinTheta + cosTheta;

    m_vertexArrayPtr[4] = x + cosTheta + sinTheta;

    ...

  • @TheLogicalError Then you will get more pixel coverage, more lag. Drawing 2 triangles is more optimized. Pixels with zero alpha are processed anyway, remember that.

  • In fact, since there's so much overdraw in this particular demo, you could draw this into an FBO at a smaller resolution, and then upscale using the hardware with bilinear filtering. Since the particles are fuzzy anyway, you probably wouldn't notice the difference, yet the speed should be a lot better.

  • Note that the particles can also be drawn using a single triangle instead of 2. just because the texture is square, doesn't mean that the triangle has to be too.. ... Especially since the texture itself contains a circular shape.

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more