About Store Forum Documentation Contact



Post Reply 
Draw text on texture - need help
Author Message
ksubox Offline
Member

Post: #1
Draw text on texture - need help
Hello,

I'm trying to render text on 3d surface, but from beginning stuck with making texture. D.text outputs text to screen, but I need output to texture.
Could somebody help ?

Have a good day.
03-06-2013 09:01 AM
Find all posts by this user Quote this message in a reply
gwald Offline
Member

Post: #2
RE: Draw text on texture - need help
Hi,
Sorry I can't tell you how to do it, I don't know myself.
But if you look at the header files of font,TextStyle, image & maybe gui I"m sure it can be done smile

My Blog
http://www.esenthel.com/community/showthread.php?tid=6043

I hang out at Esenthel IRC Channel
http://webchat.freenode.net/?channels=#Esenthel
(This post was last modified: 03-06-2013 01:05 PM by gwald.)
03-06-2013 01:04 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #3
RE: Draw text on texture - need help
You may have to code a system to take individual letter images and render them to a texture. It's not as difficult as it sounds.
03-06-2013 02:41 PM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #4
RE: Draw text on texture - need help
Take a look at the Render to Texture tutorial (under Rendering). Set this up, then draw your text as per normal. Create a material from this texture and apply it to a mesh.
03-06-2013 03:36 PM
Find all posts by this user Quote this message in a reply
ksubox Offline
Member

Post: #5
RE: Draw text on texture - need help
I tried to modify Render To Texture, but can't get it work.
Where should I insert: D.text(0, 0, "my test text"); ???
03-06-2013 04:50 PM
Find all posts by this user Quote this message in a reply
ksubox Offline
Member

Post: #6
RE: Draw text on texture - need help
I didn't find how to render text in Image (actually same for lines and so on).

But I found two functions:
static void fxBegin(Bool clear);
static C Image& fxEnd ( );

I wonder is this ONLY way for EE to draw something on texture ???
And how to ADD text to already existed Image ?
03-08-2013 06:23 AM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #7
RE: Draw text on texture - need help
I don't think D.Text() works with render to texture, fatcoder, unless there's a trick I'm missing. Calling it in the function to create the texture in the tutorial doesn't do anything.

ksubox, D.Text seems to be an exception, but anything else can be rendered to the texture the same way you would render something normally, but with the render target set to your texture instead. You can see in the tutorial where it calls Renderer(Render) and the scene is drawn the first time to the texture, then the second time to the default viewport.
Adding to an existing image will require you to write some custom code, as render to texture will overwrite it completely.
03-08-2013 03:04 PM
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #8
RE: Draw text on texture - need help
Use D.text(); and ToScreenRect().

Something like this, :

Ball myballobjectinsideworld;
Rect MyTextRectangle;

ToScreenRect(myballobjectinsideworld, MyTextRectangle);
D.text(MyTextRectangle,"", AUTO_LINE_NONE);

Considering your Ball object may be handled by the Game::ObjMemx, and let's say those are cubes inside the world ->
Rect rect[];
Game::ObjMemx<MyStructForObject> obj;
.setObjType(obj, OBJ_MYTYPEOBJ);

REPA(obj){
ToScreenRect(obj.boundingbox or whatnot, rect[i]);
D.text(rect[i],"Lala");
}

Man, it's always that semicolon...
03-08-2013 03:39 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: Draw text on texture - need help
Perhaps you could tell us what kind of effect are you trying to achieve?

Render to texture via Renderer.dest_rt is meant only for 3D not 2D.

D.fxBegin is good choice for some simple 2D effects
03-09-2013 09:09 PM
Find all posts by this user Quote this message in a reply
Post Reply