i'm using Eihort 1.4.0, i'll update to the next version once i resolve this problem :
I'm displaying some texts on a texture that is used in the material of a multiple quads mesh.
I write on the texture using this code snipet (that i just updated on the wiki, please check if my modification did'nt change anything but i doubt about that).
Here is the code initializing the texture content :
Code: Select all
//.....
m_texture = TextureManager::getSingleton().createManual(textureName,"NetRush",TEX_TYPE_2D, 1024, 1024, MIP_UNLIMITED , PF_X8R8G8B8, TU_DYNAMIC_WRITE_ONLY_DISCARDABLE | TU_AUTOMIPMAP);
//Draw the background to the new texture
m_texture->getBuffer( )->blit( m_backgroundTexture->getBuffer( ));
/// some temporary texts
std::wstring text( L"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris ac mi auctor turpis nonummy tempus. Praesent arcu. Sed vestibulum sapien ac justo. Etiam viverra elit et tortor. Vivamus et lectus ut eros consectetuer condimentum. Donec ullamcorper posuere." );
for( int i = 0; i < 48 ; ++i)
text += L"\n> The NetRush Reloaded!! 01001 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//write the test texts on the texture
WriteTextToTexture( text ,m_texture,Image::Box(0,0,1024,1024),m_font.getPointer(),ColourValue(1.0,1.0,1.0,1.0),'l');
// Create the material :
std::string materialName ( "QuadMat_" + getName() );
m_material = Ogre::MaterialManager::getSingleton().create( materialName , "NetRush");
m_material->setSceneBlending( Ogre::SBT_TRANSPARENT_COLOUR );
TextureUnitState* texUnit = m_material->getTechnique(0)->getPass(0)->createTextureUnitState( textureName );
// create the entity (from scratch) for this display
//m_graphicData = new Ogre::Entity( "CQuad_" + m_name, static_cast< ConsoleDisplayFactory* >(m_type)->getConsoleDisplayMesh() );
m_graphicData = scene->createEntity( "ConsoleDisplay_" + getName(), static_cast< ConsoleDisplayFactory* >(getType())->getConsoleDisplayMesh()->getName() );
m_graphicData->setVisible( true );
m_graphicData->setMaterialName( materialName );
Now i have another function that is called each time i press a key and that display another text on the same texture. Here is the code :
Code: Select all
// build the text to display...
//...
// draw the background
m_texture->getBuffer( )->blit( m_backgroundTexture->getBuffer( ));
// write the result text to the texture (in white)
WriteTextToTexture( textToDisplay ,m_texture,Ogre::Image::Box(0,0,1024,1024), m_font.getPointer(), Ogre::ColourValue(1.0,1.0,1.0,1.0),'l');
But it seem that only the mipmap 0 is updated...
I tried to call WriteTextToTexture two times in the initilization function with two different texts and there is the same problem.
I don't understand why it works the first time and not the other ones. I tried to call material->touch() and material->compile() to make it update the texture mipmaps but it don't seem to work.
Any idea?