Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 12:32:30 am
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)2DText on a surface
Pages: [1]
Print
Author Topic: 2DText on a surface  (Read 1366 times)
mowest
Just dropped in

Offline Offline

Posts: 4


View Profile
« on: 06. September 2007, 12:24:31 pm »

If I put a 2DText on the surface of a Box (2DText coordinates are the same as the front side of the box) the text is mixed with the surface (some parts of the text are shown, some parts are not).

I thought an OrderedGroup would do the trick, but just adding the 2Dtext after the Box, made no difference.

How can I make a 2Dtext appear to be on the surface of a shape?
Logged
kukanani
Fierce Warrior
****
Offline Offline

Posts: 504


My game is coming along fairly smoothly...


View Profile WWW
« Reply #1 on: 06. September 2007, 02:19:59 pm »

The best way would be to make a Texture2D for the shape, and then use a Graphics class to draw the text directly on the surface of the box.  Check out the wiki for more about the half-and-half thing -- it's called z-fighting.
Logged

xith.setCoolnessLevel(10);
jMe.setCoolnessLevel(0);
xith.rock();
mowest
Just dropped in

Offline Offline

Posts: 4


View Profile
« Reply #2 on: 06. September 2007, 04:00:41 pm »

Thanks for your reply.

I've had a look at the Character2D and TextureCreator class on how to do that. It's all a bit daunting on me. (Too advanced.) I'll have a look into this again this weekend.
API feature request here Grin : Text2D not just in thin air, but also applicable to a surface.

Chronotext.org has some beautiful examples (no source) that work with jogl: http://chronotext.org/scriptorium/behind/index.htm
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #3 on: 06. September 2007, 04:48:58 pm »

These two methods of TextureCreator should be exactly, what you need.

Code:
Texture createTexture(String text, Color3f color, Font font, int horizontalAlignment, boolean paddSizetoPower2)
Texture createTexture(String text, Color3f color, Font font, int horizontalAlignment)

It's very simple to use.

Marvin
Logged
kukanani
Fierce Warrior
****
Offline Offline

Posts: 504


My game is coming along fairly smoothly...


View Profile WWW
« Reply #4 on: 06. September 2007, 04:50:59 pm »

There is a thread about this, I think.

http://xith.org/forum/index.php/topic,471.0.html

The interesting code was by Amos about halfway down the first page.  The rest is all my silly questions  Smiley.  Hope this helps.

BTW, would it be too nosy to ask what you're using Xith for?  We are always on the lookout for demos or apps that show off what Xith can do.
Logged

xith.setCoolnessLevel(10);
jMe.setCoolnessLevel(0);
xith.rock();
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #5 on: 06. September 2007, 06:48:34 pm »

The interesting code was by Amos about halfway down the first page.
Wrong. Please, kukanani, don't give me credit I don't own Cheesy TextureCreator hasn't been written by me (even in parts), I just merely cited it.

BTW, would it be too nosy to ask what you're using Xith for?  We are always on the lookout for demos or apps that show off what Xith can do.
+1
Logged
mowest
Just dropped in

Offline Offline

Posts: 4


View Profile
« Reply #6 on: 10. September 2007, 10:01:53 am »

BTW, would it be too nosy to ask what you're using Xith for?  We are always on the lookout for demos or apps that show off what Xith can do.

I'm developing a 3D user interface, with widgets like a 3d-text-input-fields, 3d-sliders, etc. I design the models in Blender and, use the OBJLoader to import them. (I would prefer Collada, but the exports usually fail).
Once I've produced something useful, I will share it. But for now it's all about experimenting and learning.

Is there a way to prevent a texture from tiling?
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #7 on: 10. September 2007, 04:31:39 pm »

I would prefer Collada, but the exports usually fail.
Which version of the export script ? Which error ?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #8 on: 10. September 2007, 07:26:03 pm »

I'm developing a 3D user interface, with widgets like a 3d-text-input-fields, 3d-sliders, etc. I design the models in Blender and, use the OBJLoader to import them. (I would prefer Collada, but the exports usually fail).
Once I've produced something useful, I will share it. But for now it's all about experimenting and learning.

Do you know Xith's HUD or FengGUI? Shouldn't this suffer your needs? If not , you might be interested in participating in HUD development Smiley.

Is there a way to prevent a texture from tiling?

Yes. Change the boundary mode. But I suspect, you just used wrong texture coordinates. Normally textures shouldn't tile. TextureCoords are always [0..1] normalized. Textures only tile when you use coords greater than 1 and the boundary mode says, that it is to be wrapped in that case.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic