views:

135

answers:

1

I'm porting a 2d retro game to iPhone that has the following properties:

  • targets OpenGL ES 1.1
  • entire screen is filled with tiles (textured triangle strip
  • tile textured using a single 256x256 RGBA texture image
  • the texture is passed to OpenGL once at the start of the game
  • only 4 displayed colours are used
  • one of the displayed colours is black

The original game flashed the screen when time starts to run out by toggling the black pixels to white using an indexed palette.

What is the best (i.e. most efficient) way to achieve this in OpenGL ES 1.1?

My thoughts so far:

  1. Generate an alternative texture with white instead of black pixels, and pass to OpenGL when the screen is flashing
  2. Render a white poly underneath the background and render the texture with alpha on to display it
  3. Try and render a poly on top with some blending that achieves the effect (not sure this is possible)

I'm fairly new to OpenGL so I'm not sure what the performance drawbacks of each of these are, or if there's a better way of doing this.

+1  A: 

In the end I duplicated the tiles/sprites within the spare space of the texture, and simply render from this part of the texture.

Joe