views:

188

answers:

1

Tim Omernick from ngmoco recently gave a talk at Stanford and demonstrated an interesting fireworks app for the iPhone that he posted up the code for here:

gamemakers.ngmoco.com/post/111712416/stanford-university-and-apple-were-kind-enough-to

I can get the app to run when I specify the EAGLView's parent class as a UIView in its header file. However, I want to be able to display the fireworks over an image and so when I tried to specify the parent class as a UIImageView, the background picture I specify seems to hide the firework animation.

Basically, I want to be able to display a UIImage and a EAGLView at the same time. Is this possible? Thanks

A: 

I suggest you take the time to learn some OpenGL. It's pretty basic once you understand how it works.

Here's an overview of what you'll need to do.

  1. Create a texture (must be power-of-two size) to hold your image
  2. Upload image pixel data to texture

On each frame:

  1. Bind the texture
  2. Take a quad made out of two triangles and corresponding texture coords and render it

  3. Render the fireworks as before

Andrew Pouliot