Colors and light

I am rendering with this code. If light is disabled a get colors, for example red. If I enable light and shading there is no colors. Is this behavior correct?

 85 void Geometry::render(State &state){
 86 
 87 
 88     glEnable(GL_VERTEX_ARRAY);
 89     glEnableClientState(GL_COLOR_ARRAY);
 90     glEnableClientState(GL_NORMAL_ARRAY);
 91     glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 92 
 93     //TODO bind texture
 94     glTexCoordPointer(2, GL_FLOAT,0,&m_textureCoordinates[0]);
 95     glColorPointer(3, GL_FLOAT,0,&m_vertexColors[0]);
 96     glNormalPointer(GL_FLOAT,0,&m_normals[0]);
 97     glVertexPointer(3 ,GL_FLOAT,0,&m_vertices[0]);
 98 
 99     glDrawArrays(GL_TRIANGLES,0,m_vertices.size());
100 
101     glDisable(GL_VERTEX_ARRAY);
102     glDisable(GL_COLOR_ARRAY);
103     glDisable(GL_NORMAL_ARRAY);
104     glDisable(GL_TEXTURE_COORD_ARRAY);
105 }

Yes, to obtain correct results of lighting, You must define light parameters first. I do not see any light setup in your code.

I have light and the shading are working. Except when I use the colors. I render without the colors then I have shadows. I have lights in my code and I do believe it is correct because its working without the colors.

For the fixed function pipeline, vertex color attributes and lighting are not combined.

When GL_LIGHTING is enabled, the color of the vertex is calculated by the lights and material properties. Then the vertex color attribute is neglected.

When GL_LIGHTING is disabled, the color of the vertex will be the same as the vertex color attribute.

However, some material properties can be tracked by the GL if you enable GL_COLOR_MATERIAL. See glColorMaterial for more info.

Thanks! Then I suppose everything is correct.