Hi Robert
  
 OpenSceneGraph-2.6.0, In function "bmp_load ", there are code to complete swap 
BGR to RGB. code like this:
  if (ncomp>2) { // yes bill, colours are usually BGR aren't they
                 for(int i=0; i<inf.width; i++) {
                     int ijw=i+j*inf.width;
               unsigned char blu=buffer[3*ijw+0];
                     buffer[3*ijw+0]=buffer[3*ijw+2]; // swap order of colours
                     buffer[3*ijw+2]=blu;
               
   }
             }
   
  
 }
when bmp is 32bit, the swap result is wrong!  the correct code may be 
 if (ncomp>2) { // yes bill, colours are usually BGR aren't they
                 for(int i=0; i<inf.width; i++) {
                     int ijw=i+j*inf.width;
               unsigned char blu=buffer[ncomp*ijw+0];
                     buffer[ncomp*ijw+0]=buffer[ncomp*ijw+2]; // swap order of 
colours
                     buffer[ncomp*ijw+2]=blu;
               
   }
             }
   
  
 }
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to