I can't display text on screen. (with font)

Started by Maetschl, April 18, 2016, 02:17:20

Previous topic - Next topic

Maetschl

Sorry guys, i hate to ask this but can not find much documentation or example of this.

I making game and need develop de HUD, render some text with some font format (TTF file for example).

But i can not find an not deprecated example  :'(

I hope someone can help me.

Stackoverflow question: http://stackoverflow.com/questions/36684285/render-text-with-lwjgl-and-ttf-file

Sorry if it is a duplicated question, but I found the solution.

Thanx!

Attached a actual photo of my game =)

Regards!

spasi

See the Truetype demos here. They demonstrate TTF rendering using stb_truetype from the stb library.

Maetschl

I tried but I have this error at compile  :-\

Exception in thread "main" java.lang.NoSuchMethodError: org.lwjgl.system.MemoryUtil.memUTF8(Ljava/nio/ByteBuffer;)Ljava/lang/String;
	at org.lwjgl.demo.stb.FontDemo.<init>(FontDemo.java:59)
	at org.lwjgl.demo.stb.Truetype.<init>(Truetype.java:26)
	at org.lwjgl.demo.stb.Truetype.main(Truetype.java:37)


And this errors on code:

Line 42: STBTTBakedChar.Buffer cdata = STBTTBakedChar.malloc(96); // Maybe can change it for mallocBuffer(int)?
Line 106: STBTTAlignedQuad q = STBTTAlignedQuad.mallocStack(stack);  // ??

spasi

Demos in the LWJGL repository require the latest nightly build to compile and run.

Maetschl