Code: Select all
CEGUI::Window* root = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow","root");
CEGUI::System::getSingleton().setGUISheet(root);
fw = (CEGUI::FrameWindow*) CEGUI::WindowManager::getSingleton().createWindow("Vanilla/StaticImage","HelloWorlWindow");
root->addChildWindow(fw);
fw->setPosition( UVector2( UDim( 0.1f, 0 ), UDim( 0.1f, 0 ) ) );
fw->setSize( UVector2( UDim( 0.5f, 0 ), UDim( 0.5f, 0 ) ) );
unsigned char* texPtr = 0;
unsigned int width2 = 0;
unsigned int height2 = 0;
if ( loadBMP("test.bmp", texPtr, width2, height2 ) )
{
bool test = 1;
}
CEGUI::Size sz;
sz.d_height = height2;
sz.d_width = width2;
pTex = (CEGUI::Texture*)
&CEGUI::System::getSingleton().getRenderer()->createTexture(sz);
pTex->loadFromMemory(texPtr, sz, CEGUI::Texture::PixelFormat::PF_RGB );
CEGUI::Imageset imgSet = CEGUI::ImagesetManager::getSingleton() .create("RTT", *pTex);
imgSet.setAutoScalingEnabled(true);
imgSet.defineImage("full_image",CEGUI::Point(0,0), CEGUI::Size(width2, height2), CEGUI::Point(0,0));
fw->setProperty( "Image", CEGUI::PropertyHelper::imageToString(& imgSet.getImage("full_image")) );
This is a temporary workaround loading a texture from file ( later I will attach texture from secondary OpenGL context ). This sample code won't display texture from memory and I don't know really why. It will show instead the Vanilla scheme default StaticImage ( default grey background ).
I really dont' know what to do... any suggestion?
PS: I am not using OGRE, just plain OpenGL.. texturing is enabled ( hello world FrameWindow will display indeed )