Reputation:
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.
Upvotes: 8
Views: 6042
Reputation: 111
In OpenGL|ES glNormal3f() is not a deprecated function,
because it is useful for rendering flat 2D shapes in the {X,Y} plane:
instead of using:
glEnableClientState( GL_NORMAL_ARRAY );
glNormalPointer( GL_FLOAT, 0, vbuf + normal_offset );
it is simpler and it requires less VBO memory to call:
glNormal3f( 0, 0, 1 );
Upvotes: 0
Reputation: 133118
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.
Upvotes: 0
Reputation:
OpenGL ES 1.1 does mention it but yes that's an error there in the iPhone programming tutorial.
Upvotes: 0
Reputation: 399959
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.
Upvotes: 0
Reputation: 1954
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.
Upvotes: 6