Normals in a vertex shader

Quick Question: I just started using vertex shaders and I’m wondering, if a vertex is rotated before it is drawn does the rotated normal get passed to the shader or do you have to do the math in the shader?

When you say that a vertex is rotated, I assume you mean you’ve used some form of the glRotate* call. In that case, what you’ve really done is modified the currently-active matrix (most likely the GL_MODELVIEW matrix).

The vertex position that comes in as input to the vertex shader has NOT been modified in any way. It is your responsibility within the vertex shader code to perform the appropriate / desired transformations on it. In many cases, you need to multiply it by the modelview matrix (which includes the rotation above) and then the camera’s projection matrix.

Hope this helps.

Eric

Yep, thats what I wanted to know, thanks a lot.