3

I'm trying to rotate a specific object in space with glRotatef. I'm not exactly sure how it works under the hood so I'm not sure if the normal vectors I've set for the vertices of the object will be rotated along with the vertex coordinates. I just need to know if it does in fact rotate the normals as well.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
myopunk
  • 55
  • 4
  • Yes, it does. Just one question - if you are new, why don't you start with a non-deprecated style? I don't see a reason to learn something that you will never be able to use. – Nico Schertler Sep 25 '19 at 00:54

1 Answers1

3

Short answer: Yes, because otherwise it would be really painful for programmers.

Longer: In classic OpenGL, not modern 3/4 with shaders, vertices and normals are affected by the current MODELVIEW matrix. (Colors and texture coords are not.) So as well as rotation there's translation, which has no effect because normals are vectors; and scaling, which can change the length of the normals and thus clobber your lighting calcs. So if you're scaling models that are lit, you might want to

glEnable(GL_NORMALIZE)
Hugh Fisher
  • 2,321
  • 13
  • 8