default shader variable passing

The orange book says you can create a vertex shader, w/o a fragment shader, and that OpenGL will provide a default shader for the unimplemented part. That seems to work, however, what they don’t say is how do you handle variable passing between shaders in this case?

For example, if I use the trivial vertex shader code shown below, I see my geometry as I expect, but it’s all black. I’ve got colors and texture coordinates assigned to the vertices and the state is configured correctly to apply a texture. I assumed the default fragment shader would provide my texture and just give me flat shading, but that appears not to be the case. Is there “gl_Position” like built-in variables that I need to set to pass the colors and texture coordinates to the fragment shader or is it supposed to just pick up the input parameters automatically? Is there anything I can do to get the flat shading and texturing I desire short of implementing the fragment shader?


in vec4 position;

void main()
{
gl_Position = gl_ModelViewProjectionMatrix * position;
}

Never mind, I found it. The answer is to use the following

in vec4 position;
in vec4 color;
in vec4 texCoord0;

void main()
{
gl_Position = gl_ModelViewProjectionMatrix * position;
gl_FrontColor = color;
gl_TexCoord[0] = texCoord0;
}