Ogre::TexturePtr to CEGUI::Texture conversion
Posted: Thu Apr 21, 2005 14:02
Hello Everybody
In My application I want to convert ogre::TexturePtr to CEGUI::Texture and then want to display it on our Widget. My application is crashing on startRendering ()
Below is block of code –
OgreCEGUIRenderer* renderer = (OgreCEGUIRenderer*)CEGUI::System::getSingleton().getRenderer();
CEGUI::Texture *myTextureC = renderer->createTexture((utf8*)"Cam3.jpg");
Ogre::TexturePtr txtC = ((OgreCEGUITexture*)myTextureC)->getOgreTexture();
void* tmpTxtC = (void*)(&txtC);
Ogre::TexturePtr myTexture = (Ogre::TexturePtr &)(tmpTxtC);
uint height = txtC->getHeight();
uint width = txtC->getWidth();
CEGUI::Texture *orgTexture = renderer->createTexture(myTexture);
CEGUI::Imageset* ImageSet1 =
CEGUI::ImagesetManager::getSingleton().createImageset(
(CEGUI::utf8*)"DefineImageset", orgTexture);
ImageSet1->defineImage((CEGUI::utf8*)"ogreImage",
CEGUI::Point(0.0f, 0.0f),
CEGUI::Size(width, height),
CEGUI::Point(0.0f,0.0f));
CEGUI::StaticImage* si = (CEGUI::StaticImage*)CEGUI::WindowManager::getSingleton().createWindow((CEGUI::utf8*)"TaharezLook/StaticImage", (CEGUI::utf8*)"staticimage1");
si->setSize(CEGUI::Size(0.3f, 0.2f));
si->setImage(&ImageSet1->getImage((CEGUI::utf8*)"ogreImage"));
fwnd1->addChildWindow(si);
si->setPosition(Point(0.1f,0.1f));
All code is running perfectly if I remove these lines
void* tmpTxtC = (void*)(&txtC);
Ogre::TexturePtr myTexture = (Ogre::TexturePtr &)(tmpTxtC);
but according to my requirement i have to don in this way only.
Anyone tell me what is the problem when I convert TexturePtr to (Void*) and again in TexturePtr.
Thanks
Regards
Parul
In My application I want to convert ogre::TexturePtr to CEGUI::Texture and then want to display it on our Widget. My application is crashing on startRendering ()
Below is block of code –
OgreCEGUIRenderer* renderer = (OgreCEGUIRenderer*)CEGUI::System::getSingleton().getRenderer();
CEGUI::Texture *myTextureC = renderer->createTexture((utf8*)"Cam3.jpg");
Ogre::TexturePtr txtC = ((OgreCEGUITexture*)myTextureC)->getOgreTexture();
void* tmpTxtC = (void*)(&txtC);
Ogre::TexturePtr myTexture = (Ogre::TexturePtr &)(tmpTxtC);
uint height = txtC->getHeight();
uint width = txtC->getWidth();
CEGUI::Texture *orgTexture = renderer->createTexture(myTexture);
CEGUI::Imageset* ImageSet1 =
CEGUI::ImagesetManager::getSingleton().createImageset(
(CEGUI::utf8*)"DefineImageset", orgTexture);
ImageSet1->defineImage((CEGUI::utf8*)"ogreImage",
CEGUI::Point(0.0f, 0.0f),
CEGUI::Size(width, height),
CEGUI::Point(0.0f,0.0f));
CEGUI::StaticImage* si = (CEGUI::StaticImage*)CEGUI::WindowManager::getSingleton().createWindow((CEGUI::utf8*)"TaharezLook/StaticImage", (CEGUI::utf8*)"staticimage1");
si->setSize(CEGUI::Size(0.3f, 0.2f));
si->setImage(&ImageSet1->getImage((CEGUI::utf8*)"ogreImage"));
fwnd1->addChildWindow(si);
si->setPosition(Point(0.1f,0.1f));
All code is running perfectly if I remove these lines
void* tmpTxtC = (void*)(&txtC);
Ogre::TexturePtr myTexture = (Ogre::TexturePtr &)(tmpTxtC);
but according to my requirement i have to don in this way only.
Anyone tell me what is the problem when I convert TexturePtr to (Void*) and again in TexturePtr.
Thanks
Regards
Parul