LWJGL Forum

Programming => OpenGL => Topic started by: technik3k on August 30, 2015, 02:02:39

Title: Text overlay
Post by: technik3k on August 30, 2015, 02:02:39
How do I overlay Text in my window using openGL.
Title: Re: Text overlay
Post by: Cornix on August 30, 2015, 08:48:03
You render text the same way you render everything else. You get a texture with the text and render it. And if you want it to be an overlay you render it on top of everything else with an orthogonal projection and depth testing disabled.
Title: Re: Text overlay
Post by: spasi on August 30, 2015, 10:07:52
See the Truetype and EasyFont stb demos (https://github.com/LWJGL/lwjgl3/tree/master/modules/core/src/test/java/org/lwjgl/demo/stb).
Title: Re: Text overlay
Post by: technik3k on September 17, 2015, 01:02:53
Talking about text is there an easy way to read individual charachters from a string? ::)
Title: Re: Text overlay
Post by: pop_cs on September 17, 2015, 01:55:08
Quote from: technik3k on September 17, 2015, 01:02:53
Talking about text is there an easy way to read individual charachters from a string? ::)

I would say:

char a_char = a_text_string.charAt(i);
Title: Re: Text overlay
Post by: technik3k on September 19, 2015, 02:57:58
Would it work If I disable render with deapth when rendering text? And would I just do glDisable(GL_DEPTH_TEST); then when I'm done glEnable(GL_DEPTH_TEST);
Title: Re: Text overlay
Post by: abcdef on September 19, 2015, 06:08:16
yes, you also need to change your projection matrix to map coordinates to 2D instead of 3D