Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (702)
Games in Android Showcase (203)
games submitted by our members
Games in WIP (774)
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 1308 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.
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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline theagentd

« JGO Bitwise Duke »


Medals: 903
Projects: 4
Exp: 8 years



« 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.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
Lunch (45 views)
2016-12-06 16:01:40

ral0r2 (271 views)
2016-11-23 16:08:26

ClaasJG (404 views)
2016-11-10 17:36:32

CoffeeChemist (500 views)
2016-11-05 00:46:53

jay4842 (547 views)
2016-11-01 19:04:52

theagentd (571 views)
2016-10-24 17:51:53

theagentd (553 views)
2016-10-24 17:50:08

theagentd (504 views)
2016-10-24 17:43:15

CommanderKeith (499 views)
2016-10-22 15:22:05

Roquen (461 views)
2016-10-22 01:57:43
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21
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!