glColorMaterial is only used with lighting, which I don't think you're using, so don't worry about it just yet!
glTexEnvi affects the way textures are applied to polygons. There are four modes, two of which are of usually of interest: GL_REPLACE and GL_MODULATE.
When you draw a polygon in GL, each vertex is given the colour last set by a call to glColor*. If it were untextured, it would draw that vertex in that colour.
If you enable texturing on the polygon, you've now got two colours for any pixel to choose from: the first, original colour you're getting with glColor* calls; and the second colour, which is looked up from the texture (ie. it's the texture pixels). These two are combined according to what glTexEnv is set to when the polygon is drawn.
If you use GL_REPLACE, the original glColor colours (known as the "fragment" colour) is simply ignored, and the texture colour is simply drawn.
If you use GL_MODULATE, the texture colour and the fragment colour are multiplied together, to give you a modulated or filtered colour. So setting glColor3f(1.0f, 0f, 0f) will completely filter out all the green and blue from the texture, giving it a blood red appearance.
Cas
