Printing on player-skin in-game
by Martin Schultz · in Torque Game Engine · 04/14/2005 (8:31 am) · 10 replies
Hi all,
I would like to dynamically update the player's skin once the player gets into the game, but not just to a different texture on disk via setSkinName(...), I rather would like to print a text on a specific region on his current texture (skin). The idea behind this is that the player's name or a claim he could choose is beeing printed as text on his back.
Has anybody done this before? I searched the forums and the resources but wasn't successful finding something.
Any hints would be great! :-)
Martin
I would like to dynamically update the player's skin once the player gets into the game, but not just to a different texture on disk via setSkinName(...), I rather would like to print a text on a specific region on his current texture (skin). The idea behind this is that the player's name or a claim he could choose is beeing printed as text on his back.
Has anybody done this before? I searched the forums and the resources but wasn't successful finding something.
Any hints would be great! :-)
Martin
#2

Any other idea? :-)
04/14/2005 (12:45 pm)
Thanks for the reply. The decal stuff is not what I want to archive. Please see the screenshot below. The text on the Smileys back ("Have a nice day") is what I want to be able to create dynamically - now it's written on the texture I load from disk.
Any other idea? :-)
#3
The simpliest way to get it working without going into pBuffers is use a small region of the screen to draw your text in. You first copy that small are into a texture (so you can restore it back), draw the texture you want to modify, draw the text on top of it, copy the result back into a new texture, and then copy the original buffer contets back.
You can avoid copying and pasting the buffer contents if you do all your render to texture operations before drawing everything else in the scene.
04/14/2005 (2:00 pm)
You'll need to implement some sort of render to texture, and use the dgl text drawing functions to draw the text to that texture.The simpliest way to get it working without going into pBuffers is use a small region of the screen to draw your text in. You first copy that small are into a texture (so you can restore it back), draw the texture you want to modify, draw the text on top of it, copy the result back into a new texture, and then copy the original buffer contets back.
You can avoid copying and pasting the buffer contents if you do all your render to texture operations before drawing everything else in the scene.
#4
I would implement the ImageMagick Library to create a temp skin with the info already imprinted on it, and have it load that dynamically, then delete when no longer needed. This type of thing is done all of the time with those login things that have like a name, number or word imprinted on top of an image, for making sure you aren't a bot like http://www.egold.com/'s login system.
04/14/2005 (2:08 pm)
Just a thought, that may be easier that playing around with all of that...I would implement the ImageMagick Library to create a temp skin with the info already imprinted on it, and have it load that dynamically, then delete when no longer needed. This type of thing is done all of the time with those login things that have like a name, number or word imprinted on top of an image, for making sure you aren't a bot like http://www.egold.com/'s login system.
#5
Dreamer: Sounds like a good idea to use those temp. images. I could clean them up on each game start.
04/14/2005 (10:37 pm)
Is Torque able to do a render2texture?Dreamer: Sounds like a good idea to use those temp. images. I could clean them up on each game start.
#6
04/14/2005 (11:09 pm)
@Martin: OpenGL does render to texture.
#7
04/16/2005 (10:49 am)
@Martin: I am actually doing something similar for our game. Except we are adding different eyes and scars and skin color. I am just using stuff from the engine. I am planning on adding the code in a resource after I clean it up a bit. But if you would like to get an unfinished copy to start with now just send me an email. All it is doing is generating a custom GBitmap and replacing the material on a TSShapeInstance. To do text you can use something like ImageMagick or SDL_ttf.
#8
I'd be glad to talk to you to get already the unfinished stuff. Sounds interesting! I'll send you an e-mail right away.
Yeah, please post it as a resource as soon as its ready. I think that'll be very useful also for others!
Martin
04/16/2005 (12:13 pm)
Hi Marc,I'd be glad to talk to you to get already the unfinished stuff. Sounds interesting! I'll send you an e-mail right away.
Yeah, please post it as a resource as soon as its ready. I think that'll be very useful also for others!
Martin
#9
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7650
04/28/2005 (7:06 am)
Here is the resource:www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7650
#10
04/28/2005 (9:02 pm)
Seems like a very cool resource, looking forward to implimenting this soon :)
Torque Owner Dreamer
Default Studio Name