tags:

views:

939

answers:

4

What's the purpose of glNormal3f in OpenGL ES? If there is no immediate mode available in OpenGL ES, for what would I use glNormal3f? Example code would be nice.

+2  A: 

I think it's for the same reason that there is a glColor function. If the normal of your whole geometry is the same for all vertices you could specify it with glNormal before calling glDrawArrays/glDrawElements.

Maurice Gilden
Exactly that's it.. On OpenGL|ES it glNormal sets the default-normal. Imho they could would have done better if they had removed the function. glMultiTexCoord exists for the same reason btw.
Nils Pipenbrinck
A: 

The only reason I can think of is that it is there to support efficiently expressing surfaces where many vertices share the same normal. With the arrays-based approach, you'd have to create an array with the same value repeated for each vertex, which wastes memory.

I find it curious that the manual page (OpenGL ES 1.1, there) doesn't even mention it. I found one iPhone programming tutorial (PDF) that even claimed glNormal() was not there anymore.

unwind
A: 

OpenGL ES 1.1 does mention it but yes that's an error there in the iPhone programming tutorial.

A: 

You are not supposed to use these functions anymore. Stick to the glXXXXArray(). I suspect that they are just left overs hanging in there to make OpenGL to OpenGL ES transfer easier.

Magnus Skog