Game Development Community

Endian Color Issues

by Michael Gesner · in Torque Game Engine · 10/31/2003 (12:09 pm) · 4 replies

So I've heard from a few sources that there are more endian issues than we mac developers would like to admit.

I'm currently running into a few of them.

One of them being the famous inverted fog bug.

I have changed the code in color.h in terms of how colors are 'reported' in Torque, however, I have not been able to see any resulting change in the rendering of fog.

I am also running into a problem with highlights on drop downs.

I feel that both are endian issues related to the selection of colors.

I know a few of you out there have fixed this before. What files did you end up changing to solve the fog problem ? Am I just working with a stale header here ? Or is there another series of changes to consider.

#1
10/31/2003 (1:04 pm)
Ok, first off, I thought that the fix for color.h had been submitted. But if you are already working from the latest copy, or somehow cannot update color.h, here's the fix:

color.h : ~line 438
inline U32 ColorI::getRGBEndian() const
{
        // this used to be RGBPack for PC, but someone changed if bc of haze errors?
    // paul - this was "fixed" by someone, but really just fouled up the mac side in favor of the pc.
    // fixed this using cpp flag
#if defined(TORQUE_OS_MAC)
   return(getRGBPack());
#else
   return(getBGRPack());
#endif
// - paul
}

inline U32 ColorI::getARGBEndian() const
{ //!!!!! if above was incorrect, this may be too!
#if defined(TORQUE_OS_MAC) // !!!!TBD probably want a diff if-switch here.
        return(getABGRPack());
#else
        return(getARGBPack());
#endif
}

And that little change will fix the fog issue.

If you are using Melv May's improved waterblock, there was an endian issue there too. If you dont have the fix, you arent seeing the full beauty of the new waterblocks, you're missing out. I believe it has been fixed, but in case it hasn't, or in case you need the fix, here it is:

waterBlock.cc : ~line 301
*pTexelBlockOutput = convertLEndianToHost(FluidPointColour);

And that will fix shorline transperancy on macs.

I suppose there are other issues in there, but I dont know of them.
#2
10/31/2003 (5:02 pm)
I actually have both of these changes in. My fear is that I'm missing other relevant changes which are causing this problem.

It turns out that I also have problems with ignition.

I'm starting to wonder what else my codebase is missing.

Thanks for posting this. Anyone else have any other ideas ? I've applied these already... :(
#3
11/01/2003 (5:50 pm)
I hate to ask, but did you do a clean build after changing color.h? You will not see a change until everything relevant is recompiled. Given torque's interconnectedness, a clean build is neccesary after any change to a popular header.
#4
11/05/2003 (11:17 am)
I've been too bogged down in code to be able to respond to this... but:

1. Yes, I have recompiled cleanly. I've removed the object files completely, including all build artifacts.

Some changes have been reflected recently, however, they do not seem to be similar across missions.

Compounded with the fact that I now have problems rendering specific difs (they flicker back and forth between a shade of grey and the expected color.)

2. In color.h, there are some inherent errors that no one seems to have taken the time to address.

I am going to open a new thread to discuss this, as these changes actually cause problems in the suggested 'changes' to make fog render properly.