Multitexturing and Cubic Env Mapping

Hi,
I am using the GL extensions for multitexturing and for the cubic environment mapping. But when I enable environment mapping, only the environment map is visible and not the original texture of the objects. I want to know that how can I combine environment mapping with multitexturing to get the effect of environment being mapped on the texture of the object.

I do something like this:

			glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);

			glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_REPLACE);
			glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_INTERPOLATE_EXT);

			glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_CONSTANT_EXT);
			if (materials[0].textureid)
				glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT);
			else
				glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
				
			glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
			glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_PREVIOUS_EXT);

			glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
			glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_EXT, GL_SRC_ALPHA);
			glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
			glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_EXT, GL_SRC_ALPHA);
			glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_COLOR);
			glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND2_ALPHA_EXT, GL_SRC_ALPHA);


			if (utilConsole.variables[TEST_FULLCHROME].bValue)
				{
				fCol[0] = fCol[1] = fCol[2] = fCol[3] = 1.0f;
				glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, fCol);
				}
			else
				{
				fCol[0] = fCol[1] = fCol[2] = fCol[3] = materials[0].reflectivity;
				glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, fCol);
				}

Thanks rgpc,
But its still not working :frowning: . My problem is that when using the ARB Multitexturing we specify the ActiveTextures and bind our texture doing something like:

glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, TextureID);

Now how can I specify that the next texture to be blended with this one is the Environment Map.

Check out the glTexEnv() function, and the description of texture environment application in the spec.

(hint: you want GL_ADD environment function for an environment map, and GL_MODULATE for a base diffuse map that sees vertex lit color as input)

I looked at the specs and am totally confused now :confused:
It says in the specs that if TEXTURE_CUBE_MAP is enabled and any of the three, two or One Dimensional texturing is also enabled then only cube map texturing is used. And in my case the textures that I want to apply to my objects are 2D textures and does it mean that if I want to have the effect of multitexturing (With one texture being the original texture I apply to the object and the other being the Cube Map) I will have to use two pass texturing using Blending.
Please correct me if Iam wrong, because the impression Iam having now is that I can not apply both 2D Texture and Cube Map Texure in a single Rendering Pass.
Regards,
Hussain