I render a mesh using basic texture mapping , the texture coordinate is correct , however the color of some parts are too strange , like red channel is masked .
the result is like this screen shot:

this is original image for texture

I use VS2005 and OpenGL to render.
the following is image reading and texture generation process :
System::Drawing::Bitmap *TexImage ; System::Drawing::Rectangle Rec ; System::Drawing::Imaging::BitmapData *bmdata ; // read image TexImage = new System::Drawing::Bitmap( gTexfilename.c_str() ) ;// read image Rec.X = 0 ; Rec.Y = 0 ; Rec.Width = TexImage->Width ; Rec.Height = TexImage->Height ; bmdata = new System::Drawing::Imaging::BitmapData ; TexImage->LockBits( Rec , System::Drawing::Imaging::ImageLockMode::ReadOnly , Imaging::PixelFormat::Format24bppRgb , bmdata ) ; // generation texture glGenTextures( 1 , &tid ) ; glBindTexture( GL_TEXTURE_2D , tid ) ; glTexParameteri( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_LINEAR ) ; glTexParameteri( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_LINEAR ) ; glTexEnvi( GL_TEXTURE_ENV , GL_TEXTURE_ENV_MODE , GL_REPLACE ) ; glTexImage2D( GL_TEXTURE_2D , 0 , GL_RGB8 , TexImage->Width , TexImage->Height , 0 , GL_RGB , GL_UNSIGNED_BYTE , (void*) bmdata->Scan0 ) ;
and render process is following :
glBindTexture( GL_TEXTURE_2D , gTexid ) ; // bind texture itri glEnable( GL_TEXTURE_2D ) ; glDisable( GL_LIGHTING ) ; glDisable( GL_BLEND ) ; glColorMask( 1.0 , 1.0 , 1.0 , 1.0 ) ; glBegin( GL_TRIANGLES ) ; // do vertex and texture draw glEnd() ; glDisable( GL_TEXTURE_2D ) ;
Does anyone know where is the key process I go wrong ? Thanks in advance .
NDark











