Java-Gaming.org Hi !
 Featured games (84) games approved by the League of Dukes Games in Showcase (565) Games in Android Showcase (151) games submitted by our members Games in WIP (605) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
Pages: 1 [2]
 ignore  |  Print
 The Last Word in Text Rendering  (Read 13012 times) 0 Members and 1 Guest are viewing this topic.
Riven
« League of Dukes »

« JGO Overlord »

Medals: 947
Projects: 4
Exp: 16 years

 « Reply #30 - Posted 2007-01-09 02:19:24 »

It's easy enough to transform screen-coordinated to world-coordinates yourself.

The text is on a plane, just translate/scale/rotate until it fits your needs. (if you render the text at 0,0 it's easiest)

Let's say the bounding-rectangle of the text in screenspace is: (0, 0) (250x24)
Normalize vertices to (0, 0) (1x1) by scaling (1/w, 1/h)
As we're dealing with 3D now, we can as well add the Z (it is 0), (0, 0, 0) (1x1x0)
Which size do we want in world-coordinates? Let's say: 0x105x11cm, positioned at 143x168x78cm from the origin

 1  2  3  4  5  6  7 `glPushMatrix();glTranslate(1.43f, 1.68f, 0.78f);glRotatef(90, 0, 1, 0);glScalef(1.0f, 1.0f/250, 1.0f/24);glScalef(1.0f, 1.05f, 0.11f);   renderText();glPopMatrix();`

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Ken Russell

JGO Coder

Java games rock!

 « Reply #31 - Posted 2007-01-09 04:21:24 »

My basic point is this: what should the specification of the class say about the units in use in this scenario, compared to the orthographic, unscaled case? Do you want to specify a scale factor to be applied to both the width and height of the 3D rectangle? If you don't specify one (for example, if you normalize the rectangle to size (1, 1)), different lines of text will be rendered with different scales. What exactly should the new draw3D() method take as arguments, and what should the javadoc specification look like?
Riven
« League of Dukes »

« JGO Overlord »

Medals: 947
Projects: 4
Exp: 16 years

 « Reply #32 - Posted 2007-01-09 04:59:56 »

You don't normalize (0, 0, xEnd, yEnd) which results into each line having another scale (y axis)
if you normalize (xOff, yOff, xEnd, yEnd) to (0, 0, 1, 1), all lines have the same Y-scale.

The TextRenderer utility-class maybe shouldn't be too generic?
If people want text in their scene, they probably need 3d text anyway, or if they
want to project it: RTT using TextRenderer without any transformations.

(alpha blended) 2d text in the middle of your scene looks crap anyway.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Ken Russell

JGO Coder

Java games rock!

 « Reply #33 - Posted 2007-01-09 20:53:37 »

BTW, bienator, I couldn't PM you (full inbox? I've notified the admin) but send me an email with no attachment if you sent me something and didn't get a reply. My work email blocks mail with .zip attachments, for example.
Ken Russell

JGO Coder

Java games rock!

 « Reply #34 - Posted 2007-01-13 22:36:27 »

A new TextFlow demo has been checked in to the jogl-demos workspace which shows how to do dynamic text layout and how the TextRenderer handles it. A significant number of bug fixes and robustness improvements have gone into the TextRenderer and implementing classes as a side-effect of this, and it hopefully should "just work" in many more cases.

emzic: if you have a chance, could you retry your program with a nightly build dated 1/14 or later? I'd like to make sure I didn't introduce a bug which impacts your app.

We'll look into the issue of 2D text placement in 3D soon, hopefully next week.
emzic

Senior Devvie

 « Reply #35 - Posted 2007-01-14 13:44:51 »

ok, i will give it a try soon and report back here. thanks for the update!

edit: ok it works. nothing seems to be different as before. is there anything special i should look out for?

www.embege.com - personal website
webstart blendinspect - OpenGL BlendingModes visualization.
Ken Russell

JGO Coder

Java games rock!

 « Reply #36 - Posted 2007-01-16 07:09:12 »

edit: ok it works. nothing seems to be different as before. is there anything special i should look out for?

No, just making sure nothing was broken. Thanks.
zingbat

Senior Devvie

Medals: 1

Java games rock!

 « Reply #37 - Posted 2007-01-17 16:32:37 »

This is exactly what i was looking for, but how good is it? For example, can we render small sharp text with pixel precision like the letters in this post and do you have any screenshots?
Ken Russell

JGO Coder

Java games rock!

 « Reply #38 - Posted 2007-01-17 17:24:19 »

A picture is worth a thousand words...

This demo is checked in to the jogl-demos workspace under demos.j2d.TextFlow. On-line web start demos of this and other new stuff are coming.
zingbat

Senior Devvie

Medals: 1

Java games rock!

 « Reply #39 - Posted 2007-01-17 18:32:25 »

Thats really Impressive. Congratulations.
Ken Russell

JGO Coder

Java games rock!

 « Reply #40 - Posted 2007-01-17 18:37:22 »

Thanks. Please try it and let us know how it works for you.

By the way, if anyone wants to see how the caching algorithm works, run the TextFlow demo with -Djogl.debug.TextRenderer and it will display both the on-screen rendering results as well as the contents of the backing store in a second window. It's interesting to watch.
bienator

Senior Devvie

OutOfCoffeeException

 « Reply #41 - Posted 2007-01-17 19:44:20 »

Good work!

I have tested the demo (and added some random numbers as separate text ) and its running very smooth. The only thing I noticed is that the caching algorithm resizes the texture sometimes very often in a short period of time. To prevent this I would recommend to add (if possible) a time delay before the cache texture size could be decreased next time.
but again good work

Ken Russell

JGO Coder

Java games rock!

 « Reply #42 - Posted 2007-01-17 21:47:07 »

The only thing I noticed is that the caching algorithm resizes the texture sometimes very often in a short period of time. To prevent this I would recommend to add (if possible) a time delay before the cache texture size could be decreased next time.

Thanks for the suggestion. I've filed Issue 261 to track this. If you have a modified test case which shows the poor behavior, please attach it to the bug report.
zingbat

Senior Devvie

Medals: 1

Java games rock!

 « Reply #43 - Posted 2007-01-19 19:27:19 »

This is probably a naive question but do you think that your render algorithm will work with Unicode fonts?

I presume that eclipse can work with unicode chars but i never tested it myself.

http://en.wikipedia.org/wiki/Unicode_fonts
http://en.wikipedia.org/wiki/List_of_typefaces#Unicode_fonts

This one looks nice:

http://en.wikipedia.org/wiki/DejaVu_fonts
http://dejavu.sourceforge.net/wiki/index.php/Testing
http://dejavu.sourceforge.net/wiki/index.php/PDF_samples
http://dejavu.sourceforge.net/wiki/index.php/Main_Page

It's allways nice to know that we can translate our game or application to a load of different languages in their native charset.

Ken Russell

JGO Coder

Java games rock!

 « Reply #44 - Posted 2007-01-19 21:36:50 »

A major goal of this TextRenderer was complete Unicode support and I can basically guarantee that it will work properly. The String-by-String caching algorithm has been vetted by Sun's Java 2D font expert, Phil Race, and was informed by his advice. It would be possible to also get complete Unicode support by dynamically caching individual rendered glyphs, but the algorithms involved are more complicated and we haven't yet seen a strong need to go this route. For the cases where the String-by-String approach works well, it will also be faster than glyph-by-glyph caching and rendering.
Pages: 1 [2]
 ignore  |  Print

You cannot reply to this message, because it is very, very old.

 theagentd (11 views) 2015-03-27 23:08:20 wxwsk8er (52 views) 2015-03-20 15:39:46 Fairy Tailz (46 views) 2015-03-15 21:52:20 Olo (28 views) 2015-03-13 17:51:59 Olo (30 views) 2015-03-13 17:50:51 Olo (37 views) 2015-03-13 17:50:16 Olo (43 views) 2015-03-13 17:47:07 ClaasJG (56 views) 2015-03-10 11:36:42 ClaasJG (41 views) 2015-03-10 11:33:01 Pippogeek (47 views) 2015-03-05 14:36:23
 LiquidNitrogen 22x BurntPizza 21x KevinWorkman 21x basil_ 21x EgonOlsen 17x theagentd 16x Roquen 16x princec 12x Riven 11x Varkas 10x SHC 9x Ashedragon 8x NegativeZero 7x Ecumene 7x nsigma 7x phu004 7x
 How to: JGO Wikiby Mac702015-02-17 20:56:162D Dynamic Lighting2015-01-01 20:25:42How do I start Java Game Development?by gouessej2014-12-27 19:41:21Resources for WIP gamesby kpars2014-12-18 10:26:14Understanding relations between setOrigin, setScale and setPosition in libGdx2014-10-09 22:35:00Definite guide to supporting multiple device resolutions on Android (2014)2014-10-02 22:36:02List of Learning Resources2014-08-16 10:40:00List of Learning Resources2014-08-05 19:33:27
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org