What I did was to show the Ogre material as an overlay (because CEGUI doesn't know anything about Ogre materials) and sync the position of the overlay to the gui window.
Another idea I had was to use render to texture... but maybe Eddie has a better solution?
HTH,
mac
Help Material -> Image
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Help Material -> Image
To do this you'll need to hack the code in the OgreGUIRenderer project. Basically what you're after is using an existing Ogre material/texture as the basis for an imageset. Then programatically define a CEGUI::Image on that imageset, and then use that Image for your StaticImage (and thus allowing you to put dynamically rendered content into CEGui elements. This functionality is not there *yet* but it will be a bit later on. Until then you have to hack the code yourself
CE.
CE.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Help Material -> Image
I spotted a potential bug
Should possibly be:
Although due to the nature of the tests, the original version would work okay
I'm not sure I understand your code though Parts of that code were on the right track and other parts just do the same as what we have now, perhaps I missed the point entirely?
What I was going to do was something like this:
If someone could test this out, if it works okay I'll stick it in CVS
CE.
Code: Select all
if ((d_ogre_texture != NULL)&(link == false))
Should possibly be:
Code: Select all
if ((d_ogre_texture != NULL) && (link == false))
Although due to the nature of the tests, the original version would work okay
I'm not sure I understand your code though Parts of that code were on the right track and other parts just do the same as what we have now, perhaps I missed the point entirely?
What I was going to do was something like this:
Code: Select all
//----- ogretexture.h -----
/*!
\brief
Set the internal Ogre::Texture object.
\param texture
Reference to an Ogre::Texture object that is to be used by this Texture object.
\return
Nothing.
*/
void setOgreTexture(Ogre::Texture& texture);
//----- ogretexture.cpp -----
/*************************************************************************
Set the internal Ogre::Texture object.
*************************************************************************/
void OgreTexture::setOgreTexture(Ogre::Texture& texture)
{
freeOgreTexture();
d_ogre_texture = &texture;
d_width = d_ogre_texture->getWidth();
d_height = d_ogre_texture->getHeight();
d_isLinked = true;
}
void OgreTexture::freeOgreTexture(void)
{
if ((d_ogre_texture != NULL) && !d_isLinked)
{
Ogre::TextureManager::getSingleton().unload(d_ogre_texture->getName());
d_ogre_texture->destroy();
d_ogre_texture = NULL;
}
}
//----- ogrerenderer.h -----
/*!
\brief
Create a texture from an existing Ogre::Texture object
\param texture
pointer to an Ogre::Texture object to be used as the basis for the new CEGUI::Texture
\return
Pointer to the newly created CEGUI::Texture object.
*/
Texture* createTexture(Ogre::Texture* texture);
//----- ogrerenderer.cpp -----
/*************************************************************************
Create a texture from an existing Ogre::Texture object
*************************************************************************/
Texture* OgreRenderer::createTexture(Ogre::Texture* texture)
{
OgreTexture* t = (OgreTexture*)createTexture();
if (texture != NULL)
{
t->setOgreTexture(*texture);
}
return t;
}
If someone could test this out, if it works okay I'll stick it in CVS
CE.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Help Material -> Image
That's excellent. A lof of people are going to be using this ability now, I think
CE.
CE.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Help Material -> Image
What about calling TextureManager::getByName(), passing the string returned from a call to RenderTexture::getName()?
Help Material -> Image
Doesn't Ogre::Texture derive from Resource? If so, you can just cast that Resource* to a Texture*
J.W.
J.W.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Help Material -> Image
Cool, I'll add these new bits later today I think. I'll probably add a note in the docs about how to get a Texture from a RenderTexture
[Edit]
This new code and ability is now in CVS
[/Edit]
CE.
[Edit]
This new code and ability is now in CVS
[/Edit]
CE.
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 11 guests