texture map - I can't get the right color

I use a function and generate a texture .In which I use glTexImage2D(GL_TEXTURE_2D, 0, 3, nTextureWidth, nTextureHeight, 0, GL_BGR_EXT, GL_UNSIGNED_BYTE, pBitmapData);
And I use other Command to map this picture onto an object with command
glActiveTexture(GL_TEXTURE0_ARB);
glBindTexture (GL_TEXTURE_2D, texName[1]);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE);

glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);

but I can’t get the correct color of the origin texture. who can help me!

Because you don’t post what the problem actually is, except “wrong color” (which can be “off by 1 bit in the green component” or can be “yellow where it should be azure”) I can’t give you more than general advice.

I suggest reading the OpenGL specification, which you can download in PDF format from the front page of this site.

Specifically, I suggest you look at the “texture application” and “fragment coloring” parts of the pipeline, and pay special attention to the “texture image specification” part. Especially the part about GL_RGB(A), GL_BGR(A), GL_UNSIGNED_BYTE and compound pixel formats (including the _REV versions). Also, the sized internal formats might be of some importance (GL_RGB(A)8, and friends).

If for some reason you don’t already know what endian-ness or component order your host machine uses, or your image data file stores data in, I suggest finding this out in the appropriate reference manuals.

Thank you,jwatte,I will take your suggestion!