Pro OpenGL ES for iOS

(singke) #1

CHAPTER 5: Textures (^157)
are actually using filtering. The shimmery one on top is using the GL_LINEAR and the
GL_NEAREST filtering. The bottom is doing the same but using the additional
information that the mipmaps provide. Just for kicks, you might want to do comparisons
of some of the other settings. For example, which is better: GL_NEAREST or
GL_LINEAR?
Filtering might eventually go the way of 8-bit coloring as the retina-level displays
become more common.
One more thing: if you look really closely at the bottom image, you might actually see it
swap to another texture size. It’s subtle, but it’s there.
Figure 5-20. All filtering turned off (left), bilinear filtering turned on (right)
OpenGL Extensions and PVRTC Compression
Even though OpenGL is a standard, it was designed with extensibility in mind, letting
various hardware manufacturers add their own special sauce to the 3D soup using
extension strings. In OpenGL, developers can poll for possible extensions and then use
them if they exist. To get a look at this, use the following line of code:
char *extentionList=glGetString(GL_EXTENSIONS);
This will return a space-separated list of the various extra options in iOS for OpenGL ES,
looking something like this (from iOS 4.3):
GL_OES_blend_equation_separate GL_OES_blend_func_separate GL_OES_blend_subtract
GL_OES_compressed_paletted_texture GL_OES_depth24 GL_OES_draw_texture
GL_OES_fbo_render_mipmap GL_OES_framebuffer_object GL_OES_mapbuffer
GL_OES_matrix_palette GL_OES_packed_depth_stencil GL_OES_point_size_array
GL_OES_point_sprite GL_OES_read_format GL_OES_rgb8_rgba8 GL_OES_stencil_wrap
GL_OES_stencil8 GL_OES_texture_mirrored_repeat GL_OES_vertex_array_object
GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_EXT_read_format_bgra
GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod_bias
GL_APPLE_framebuffer_multisample GL_APPLE_texture_2D_limited_npot
GL_APPLE_texture_format_BGRA8888 GL_APPLE_texture_max_level GL_IMG_read_format
GL_IMG_texture_compression_pvrtc
The last line, in bold, points out that iOS can handle a special compressed texture
format called PVRTC used by the brand of graphics processing units (GPUs) in iOS
devices. The first two generations of iPhones and iPod/Touches used a PowerVR MBX

Free download pdf