I just upgraded CEGUI and OGRE to the newest versions,
I am running the GUI example in the OGRE Samples Directory,
my text is not displaying correctly in the CEGUI Widgets.
It has a yellow backgroud.
Fonts on MacOSX
Moderators: CEGUI MVP, CEGUI Team
Re: Fonts on MacOSX
Are you sure your app is linked with the right library? After compiling CEGUI, you have to check that your ogre project accesses the new files before compiling it again.
It could also be a font problem (if you use a static font with no alpha in your image file for example). Did you modified something related with that?
--
Chris
It could also be a font problem (if you use a static font with no alpha in your image file for example). Did you modified something related with that?
--
Chris
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Fonts on MacOSX
This is an endian issue. I'm not sure where this got broken since nothing in CEGUI was changed. Obviously I want to fix this, but it's rather difficult since I don't have access to a Mac, and as such I can't reproduce the issue to debug it
CE.
![Confused :?](./images/smilies/icon_confused.gif)
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Fonts on MacOSX
* Bump *
This yellow background is bugging me too. It makes the fonts almost unreadable. If somebody can point me in the right direction, I will attempt to fix the problem.
This yellow background is bugging me too. It makes the fonts almost unreadable. If somebody can point me in the right direction, I will attempt to fix the problem.
Re: Fonts on MacOSX
Unforunately I am in the same situation as CE was with regards to OSX. I'll see if I can get temas to take a look if he has time, otherwise if anyone with OSX wants to take a stab at fixing this I'd greatly appreciate it.
- zakalawe
- Just popping in
- Posts: 7
- Joined: Mon May 09, 2005 07:17
- Location: Edinburgh, Scotland
- Contact:
Re: Fonts on MacOSX
On the quite likely assumption that I'm going to hit this issue in the near future (trying to get our 'ember' client which is Ogre + CEGUI running), could someone provide a few hints on where this problem lies, so I don't have to learn the entire codebase.
Eg, is it specific to the OGRE renderer? Does it happen on Linux-PPC? Any other hints as to where to start debugging?
Eg, is it specific to the OGRE renderer? Does it happen on Linux-PPC? Any other hints as to where to start debugging?
Re: Fonts on MacOSX
In case someone is interested, this is quite an easy fix. As Crazy Eddie suggested, it's an endian issue. All i did was to implement byte swapping in the OgreCEGUITexture.cpp file inside the loadFromMemory member function.
It looks like this now:
//--asu start
//byte swapping utils
void _ByteSwap(unsigned char * b, int n)
{
register int i = 0;
register int j = n-1;
while (i<j)
{
std::swap(b[i], b[j]);
i++, j--;
}
}
#define ByteSwap(x) _ByteSwap((unsigned char *) &x,sizeof(x))
//--asu end
void OgreCEGUITexture::loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight)
{
using namespace Ogre;
// get rid of old texture
freeOgreTexture();
// wrap input buffer with an Ogre DataChunk
uint32 bytesize = ((buffWidth * sizeof(uint32)) * buffHeight);
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
//do byte swapping -- asu start
uint32 *swappedBuffer = new uint32[bytesize/4];
memcpy(swappedBuffer, buffPtr, bytesize);
for (int i=0;i<bytesize/4;i++)
ByteSwap(swappedBuffer[i]);
DataStreamPtr odc(new MemoryDataStream((void*)(swappedBuffer), bytesize, false));
// -- asu end
#else
DataStreamPtr odc(new MemoryDataStream(const_cast<void*>(buffPtr), bytesize, false));
#endif
// try to create a Ogre::Texture from the input data
d_ogre_texture = TextureManager::getSingleton().loadRawData(getUniqueName(), "General", odc, buffWidth, buffHeight, PF_A8R8G8B8, TEX_TYPE_2D, 0, 1.0f);
// if we got a pointer cache some details
if (!d_ogre_texture.isNull())
{
d_width = d_ogre_texture->getWidth();
d_height = d_ogre_texture->getHeight();
}
// no texture from memory so throw.
else
{
throw RendererException((utf8*)"Failed to create Texture object from memory: Ogre returned a NULL Ogre::Texture pointer.");
}
}
Sorry for the formating. I'm not really used to this...
It looks like this now:
//--asu start
//byte swapping utils
void _ByteSwap(unsigned char * b, int n)
{
register int i = 0;
register int j = n-1;
while (i<j)
{
std::swap(b[i], b[j]);
i++, j--;
}
}
#define ByteSwap(x) _ByteSwap((unsigned char *) &x,sizeof(x))
//--asu end
void OgreCEGUITexture::loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight)
{
using namespace Ogre;
// get rid of old texture
freeOgreTexture();
// wrap input buffer with an Ogre DataChunk
uint32 bytesize = ((buffWidth * sizeof(uint32)) * buffHeight);
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
//do byte swapping -- asu start
uint32 *swappedBuffer = new uint32[bytesize/4];
memcpy(swappedBuffer, buffPtr, bytesize);
for (int i=0;i<bytesize/4;i++)
ByteSwap(swappedBuffer[i]);
DataStreamPtr odc(new MemoryDataStream((void*)(swappedBuffer), bytesize, false));
// -- asu end
#else
DataStreamPtr odc(new MemoryDataStream(const_cast<void*>(buffPtr), bytesize, false));
#endif
// try to create a Ogre::Texture from the input data
d_ogre_texture = TextureManager::getSingleton().loadRawData(getUniqueName(), "General", odc, buffWidth, buffHeight, PF_A8R8G8B8, TEX_TYPE_2D, 0, 1.0f);
// if we got a pointer cache some details
if (!d_ogre_texture.isNull())
{
d_width = d_ogre_texture->getWidth();
d_height = d_ogre_texture->getHeight();
}
// no texture from memory so throw.
else
{
throw RendererException((utf8*)"Failed to create Texture object from memory: Ogre returned a NULL Ogre::Texture pointer.");
}
}
Sorry for the formating. I'm not really used to this...
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Fonts on MacOSX
Cool
Somebody should get this change into CVS.
Do you know if the issue affects the plain OpenGL renderer as well as the Ogre one?
Thanks for that.
CE.
![Smile :)](./images/smilies/icon_smile.gif)
Somebody should get this change into CVS.
Do you know if the issue affects the plain OpenGL renderer as well as the Ogre one?
Thanks for that.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Fonts on MacOSX
I've committed this to the OGRE renderer with a small modification. Thanks!
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 15 guests