Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Font Rendering Practices  (Read 578 times)
0 Members and 1 Guest are viewing this topic.
Offline Slyth2727
« Posted 2014-04-29 01:51:07 »

I did this a while ago but I lost the code in an Arch to Arch transition. Something to do with my video drivers.

In order to render text on the screen with LWJGL I've seen that you can use a quad/triangles and just render each letter, called from a texture atlas with all the characters, to the quad. However I don't know if this is good practice or if there's even another way.
There's the way slick-util does it, and I don't have experience with that, but it seems pretty easy. I think this may use the solution I talked about above.

Is there some "generally accepted" way to render text to the screen that is suggested?

Thanks.

Edit: I just found this video that actually defines each vertex for the letters. This is usable, however it doesn't allow for any actual fonts. https://www.youtube.com/watch?v=JFQhhwVqqs8
Interesting anyway.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Offline orogamo
« Reply #1 - Posted 2014-04-29 08:57:00 »

If you're looking for the one you explained, here's a messy TextRenderer: TextRenderer.java
The font image:

Link to image: font.png
I know the image is not easy to see, but trust me it's there Tongue

I don't think this is the best way to render text...
But it worked in my case Smiley
Offline Slyth2727
« Reply #2 - Posted 2014-04-29 23:36:33 »

I saw the link to the file a bit earlier, that's how I knew what it was doing.
Thanks though Smiley

Any other suggestions would be appreciated.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline theagentd
« Reply #3 - Posted 2014-04-29 23:48:47 »

I saw the link to the file a bit earlier, that's how I knew what it was doing.
Thanks though Smiley

Any other suggestions would be appreciated.
There is no other way. You need to have your letters as textures in some form.You then need to draw quads for each letter to actually render each letter. If you're experienced with OpenGL, you can "simplify" the code a bit by using a 2D texture array where each layer is a single letter, and use a geometry shader to be able to render the fonts as points which gets expanded to quads by the GPU.

Myomyomyo.
Offline Slyth2727
« Reply #4 - Posted 2014-04-29 23:55:29 »

That was the kind of thing I expected. Ah well, so much for the magical easy route of happiness.
Thanks for clarifying.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (42 views)
2014-10-16 15:22:06

Norakomi (32 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (66 views)
2014-10-14 00:35:47

TehJavaDev (59 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (85 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!