Menu

#117 Red/Blue channels swapped

closed
None
5
2012-10-31
2009-04-16
No

Ogre3D is seeing an issue with FreeImage swapping the red and blue channels.
This problem was apparently introduced in 3.10 (3.9.3 worked), and persists through 3.12.
http://www.ogre3d.org/forums/viewtopic.php?f=2&t=49326

Discussion

  • Hervé Drolon

    Hervé Drolon - 2009-04-20

    Hi,

    your problem is linked to the FreeImage.h header file and the following #define :

    // This really only affects 24 and 32 bit formats, the rest are always RGB order.

    define FREEIMAGE_COLORORDER_BGR 0

    define FREEIMAGE_COLORORDER_RGB 1

    if defined(APPLE) || defined(FREEIMAGE_BIGENDIAN)

    define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB

    else

    define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR

    endif

    I don't know how to check that you run an APPLE with a Little Endian processor ...
    Can you try this :

    if defined(APPLE) && defined(FREEIMAGE_BIGENDIAN)

    and tell me if it works for you ?

     
  • Ethan Tira-Thompson

    Ah, thanks for tracking that down.

    I don't think you should be testing APPLE at all as an indication of byte order. Intel macs are little endian, PowerPC macs are big endian.

    So for instance, I tested that this gives an accurate report:

    include <freeimage.h></freeimage.h>

    include <stdio.h></stdio.h>

    int main(int argc, char** argv) {

    if defined(FREEIMAGE_BIGENDIAN)

    printf("big-end detected\n");
    

    else

    printf("little-end detected\n");
    

    endif

    return 0;
    

    }

    but if you add the '|| defined(APPLE)' it always picks big-end regardless of the actual host architecture...

     
  • Hervé Drolon

    Hervé Drolon - 2009-04-20

    I've fixed the FreeImage.h header file in the CVS by removing the APPLE #define

     
  • Ethan Tira-Thompson

    Might want to ask ark42 why he introduced FREEIMAGE_COLORORDER in the first place... seems equivalent to FREEIMAGE_BIGENDIAN... just wanted a more descriptive name for what was being tested?

     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.

MongoDB Logo MongoDB