views:

733

answers:

3

I want to make metallic 3d object that appears to be reflective. I want to accomplish this using an environment shader that uses either a sphere or cube map that I can assign an image or texture as the "reflection" source.

Does OpenGL ES on the iPhone support this in any versions?

+3  A: 

OpenGL ES 2.0 provides shader support. However, it isn't available in many mobile devices that are on the market today. It would be important for you to code both ES 1.1 and ES 2.0 versions of the graphics.

Apple Dev Center has tons of information on the transition:

The fixed-function pipeline of OpenGL ES 1.1 provides good baseline behavior for a 3D graphics pipeline, from transforming and lighting vertices to blending the final pixels with the framebuffer. If you choose to implement an OpenGL ES 2.0 application, you will need to duplicate this functionality. On the other hand, OpenGL ES 2.0 is more flexible than OpenGL ES 1.1. Custom vertex and fragment operations that would be difficult or impossible to implement using OpenGL ES 1.1 can be trivially implemented with an OpenGL ES 2.0 shader. Implementing a custom operation in an OpenGL ES 1.1 application often requires multiple rendering passes and complex changes to OpenGL ES state that obscure the intent of the code. As your algorithms grow in complexity, shaders convey those operations more clearly and concisely and with better performance.

http://developer.apple.com/iphone/library/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/DeterminingOpenGLESCapabilities/DeterminingOpenGLESCapabilities.html#//apple_ref/doc/uid/TP40008793-CH102-SW1

Kai
+1  A: 

In the old days "metallic" look was achieved using technique called "environment mapping" or "reflection mapping".

Since no programmable shaders are available for OpenGL ES 1.1, simple reflection mapping can be done with software. Just transform vertex normals according to reflection source/camera and get texture UV-coordinates from transformed normal vector. iPhone has horsepower to do this easily, at least with decent vertex counts.

Virne
Is it safe to assume 2.0 has environment mapping?
Soviut
With GLSL ES shading language yes. Environment mapping vertex shader can be written easily. There's less code and hassle than with software solution.
Virne
A: 

OpenGL ES Supports most of the features of OpenGL (and some extra features for mobile devices). If I recall correctly the iPhone 3Gs supports fragment shaders, while the older iPhone 3G just supports a fixed pipeline.

Nils