Tuesday, December 23, 2008

OpenGL ES Extensions on the iPhone

I was recently re-reading Brian Greenstone's excellent (if slightly dated) Pangea Software's Ultiamte Game Programming Guide for Mac OS X (which is now available as a free download), and was wondering if I could use one of the optimizations Brian talked about in his book: vertex array ranges.

Brian Greenstone, if you don't know, has been writing games for years, starting on the Apple //gs, if I remember correctly, then moving to the Mac, then later the iPhone. He knows probably better than any living person - at very least any living person outside of 1 Infinite Loop, Cupertino, CA - how to get the best 3D performance out of Apple hardware, so if he suggests something, it's a good idea to listen.

To discover whether Vertex Array Ranges were supported, I used the following code:
    NSString *extensionString = [NSString stringWithUTF8String:(char *)glGetString(GL_EXTENSIONS)];
NSArray *extensions = [extensionString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
for (NSString *oneExtension in extensions)
NSLog(oneExtension);
Which simply dumps a list of the OpenGL extensions supported by the device to the console. Here is the list I get when running on my first generation iPhone (Note: running against the simulator will give you a slightly different list):

GL_EXT_texture_filter_anisotropic
GL_EXT_texture_lod_bias
GL_IMG_read_format
GL_IMG_texture_compression_pvrtc
GL_IMG_texture_format_BGRA8888
GL_OES_blend_subtract
GL_OES_compressed_paletted_texture
GL_OES_depth24
GL_OES_draw_texture
GL_OES_framebuffer_object
GL_OES_mapbuffer
GL_OES_matrix_palette
GL_OES_point_size_array
GL_OES_point_sprite
GL_OES_read_format
GL_OES_rgb8_rgba8
GL_OES_texture_mirrored_repeat

Unless I'm reading it wrong, it looks like vertex array ranges are not supported on the iPhone.

Let's hope Brian decides to write an iPhone Ultimate Game Programming Guide.

No comments:

Post a Comment