Hello,
what I need is simple: Text on a surface. I tried the addTextSceneNode, but a TextSceneNode is always the same size to the user. In my case, I have an object, and obove the object I need to display some information with text. Now I'm using a Billboard to display a background for that information, and I need to get some text onto the billboard.
How can I achieve this? Must I use rendering into texture so the billboard does use that texture? If yes, is there some tutorial? If no, what other possibilities do I have to display text?
(The text must of course not be a static texture, I must be able to change the text at runtime.)
Thanks a lot for your help!
How to display Text on a surface
changing texture at runtime
Does someone know how to change texture at runtime?????
Plizzzzzzzzzzzzz!
Thx
Plizzzzzzzzzzzzz!
Thx
Model each of the letters of the alphabet in a modeling program.
Build your words from these models.
You could even make a class that accepts a string and returns a node with the correct letter nodes attached in the right order.
I used this method to build a 3D string in VRML once upon a time.
You can see it here http://www.kencocomputers.com/
Hold the mouse down over the logo and when you move it you will see you are actually in a 3D world not just an animated logo. You can even fly through the logo and see it from behind.
Note: You will need the parallel graphics ActiveX VRML plug-in to see it.
Build your words from these models.
You could even make a class that accepts a string and returns a node with the correct letter nodes attached in the right order.
I used this method to build a 3D string in VRML once upon a time.
You can see it here http://www.kencocomputers.com/
Hold the mouse down over the logo and when you move it you will see you are actually in a 3D world not just an animated logo. You can even fly through the logo and see it from behind.
Note: You will need the parallel graphics ActiveX VRML plug-in to see it.
-
- Posts: 518
- Joined: Tue Mar 29, 2005 9:02 pm
- Location: Alex,Egypt
- Contact:
Re: changing texture at runtime
changing data of texture on the fly is so simple , just lock the texture to get a pointer to texture's data then get the pitch (width of line) then change the data and finally unlock the texture.sivagiri wrote:Does someone know how to change texture at runtime?????
Plizzzzzzzzzzzzz!
Thx
l have made a tutorial for playing movie on a texture , also made a texture manipulatore class that allows you to write a text on texture
here is a link to it in the wiki
http://www.irrforge.org/index.php/Drawi ... in_texture
also i have included this classes in my Magic Library for direct use.
hope it helps you.
Bey
Magic 2d Library For Irrlicht : http://www.freewebs.com/bcxgl/index.htm
http://www.freewebs.com/bcxdx/index.htm
http://groups.yahoo.com/group/bcxdxc/
http://www.freewebs.com/bcxdx/index.htm
http://groups.yahoo.com/group/bcxdxc/
This is part of my code when I draw text in texture and wanted to load the second text and clear the text before...
What's the problem with it??
sivagiri
Code: Select all
IAnimatedMeshSceneNode* GroupTherapyExercise::loadBoard(irr::scene::ISceneManager *smgr,
irr::video::IVideoDriver *driver)
{
MyMesh* mesh = new MyMesh("Virtual_Therapy/Models/Room/exported_objects/clearboard.3DS",
vector3df(-30,-60,0),
vector3df(4,4,3), vector3df(0,0,0));
IAnimatedMeshSceneNode* node = _meshLoader->loadMesh(mesh, smgr, driver); if (node) {
//node->setMD2Animation(scene::EMAT_STAND);
//node->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
if (getExercise() != NULL) {
drawExerciseToBoard(node, smgr, driver);
}
}
return node;
}
void GroupTherapyExercise::drawExerciseToBoard(irr::scene::IAnimatedMeshSceneNode *node,
irr::scene::ISceneManager *smgr, irr::video::IVideoDriver *driver)
{
ITexture* blackBoardTexture = node->getMaterial(0).Texture1;
bool needsUnlock = false;
if (blackBoardTexture != NULL) {
blackBoardTexture->lock();
needsUnlock = true;
}
blackBoardTexture = driver->getTexture(
"Virtual_Therapy/Models/Room/temp/boardtex120b.jpg");
driver->setTextureCreationFlag(ETCF_ALWAYS_32_BIT , true);
driver->setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
blackBoardTexture->regenerateMipMapLevels();
node->getMaterial(0).Texture1 = blackBoardTexture;
if (needsUnlock) {
blackBoardTexture->unlock();
}
/*if (_previousAnwerSet.size() != 0) {
doClearTable(_blackBoardTexture, driver);
}*/
if (_whiteFont == NULL) {
_whiteFont = new TFont(driver);
_whiteFont->load("Virtual_Therapy/Fonts/fontcourier.bmp",BGR(255,255,255));
}
_whiteFont->DrawString(blackBoardTexture,400,10,getExercise()->getTitle());
_whiteFont->DrawString(blackBoardTexture,60,30,getExercise()->getDescription());
set<Answer*> currentAnswers = getExercise()->getAnswersByDifficulty(_currentDifficultyLevel);
set<Answer*>::iterator it = currentAnswers.begin();
int index = 0;
while (it != currentAnswers.end()) {
if (index == 0) {
_whiteFont->DrawString(blackBoardTexture,100,50,(*it)->getQuestion());
}
_whiteFont->DrawString(blackBoardTexture,350,(70 + (index * 25)),(*it)->getText());
if ((*it)->isCorrect()) {
_correctAnswerIndex = index;
printf("\nCorrect index %i", index);
}
index++;
it++;
}
_previousAnwerSet = currentAnswers;
}
ITexture* GroupTherapyExercise::doClearTable(ITexture* texture, IVideoDriver *driver){
if (_greenFont == NULL) {
_greenFont = new TFont(driver);
_greenFont->load("Virtual_Therapy/Fonts/fontcourier.bmp",BGR(81,103,55));
}
set<Answer*>::iterator it = _previousAnwerSet.begin();
int index = 0;
while (it != _previousAnwerSet.end()) {
if (index == 0) {
_whiteFont->DrawString(texture,100,50,(*it)->getQuestion());
}
_whiteFont->DrawString(texture,350,(70 + (index * 25)),(*it)->getText());
index++;
it++;
}
return texture;
}
sivagiri
-
- Posts: 44
- Joined: Mon Dec 05, 2005 8:15 am
Re: changing texture at runtime
Hi..
the following link is brokend..
http://www.irrforge.org/index.php/Drawi ... in_texture
Is there any other link for that?
thanks
the following link is brokend..
http://www.irrforge.org/index.php/Drawi ... in_texture
Is there any other link for that?
thanks