Page 1 of 1

can OgreImageCodec load dds format image?

Posted: Wed Aug 18, 2010 02:23
by wang37921
how to make OgreImageCodec load dds format image?
through operate bit, like FreeImageImageCodec.

Code: Select all

        for (uint i = 0; i < height; ++i)
        {
            for (uint j = 0; j < width; ++j)
            {
                uint p = *(((uint*)(rawBuf + i * pitch)) + j);
                uint r = (p >> 16) & 0x000000FF;
                uint b = (p << 16) & 0x00FF0000;
                p &= 0xFF00FF00;
                p |= r | b;
                // write the adjusted pixel back
                *(((uint*)(rawBuf + i * pitch)) + j) = p;
            }
        }

Re: can OgreImageCodec load dds format image?

Posted: Sun Aug 22, 2010 09:42
by CrazyEddie
This is not really supported at the moment, due to the fact that, internally, CEGUI only supports RGB and RGBA uncompressed formats, so while the Ogre based ImageCodec should be able to load and parse the dds file ok, when the resulting data gets passed back to CEGUI it is rejected as being in an unsupported format.

There is some work going on in this area and, one way or another, such support should be available from the 0.8.0 release (but that will not be available until some time next year)

CE.

Re: can OgreImageCodec load dds format image?

Posted: Mon Aug 23, 2010 06:48
by wang37921
If I use compressed format(e.g. dds) force and cheat ce's code, like
"case DDS:
case ARGB:
...
", will be punished? --->crash? :oops:
that is, i want to know has ce's code operation texture byte information.

Re: can OgreImageCodec load dds format image?

Posted: Tue Aug 24, 2010 08:39
by CrazyEddie
No, as far as I remember (without looking at a lot of code!), we do not access texture data directly within CEGUI, so to hack it in, it's literally just a case of adding some new cases for alternative formats (done correctly we need detection on various platforms and APIs, so that's why it's not there yet, but it will be coming).

So, yes, give that code a try, because either that - or something similar (you need the texture where the data is transferred to be the same format, I think) - should work with a bit of playing around. I don't think it would crash, but you might not get the right imagery ;)

CE