Recent

Author Topic: [Solved] How can I show text with OpenGL?  (Read 7848 times)

loaded

  • Hero Member
  • *****
  • Posts: 824
[Solved] How can I show text with OpenGL?
« on: March 02, 2018, 02:57:03 pm »
Hi All,

The methods I tried;

The method here is rather slow and simple
-https://www.entwickler-ecke.de/topic_2D+Text+in+OpenGL_39104,0.html

The method here is nice but slow
-https://stackoverflow.com/questions/17733965/strange-behaviour-in-opengl

Are there alternative methods for displaying text with Opengl?
Thank you for helping.

« Last Edit: March 04, 2018, 04:35:48 pm by loaded »
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.

loaded

  • Hero Member
  • *****
  • Posts: 824
Re: How can I show text with OpenGL?
« Reply #2 on: March 03, 2018, 05:29:36 am »
Hi Marcov
I downloaded the samples and started working on the subject right now.
Also, thank you very much for your precious reply.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

comingnine

  • New Member
  • *
  • Posts: 25
Re: How can I show text with OpenGL?
« Reply #3 on: March 03, 2018, 09:03:31 am »
IIRC, TextSuite could be used together with OpenGL to draw text.

loaded

  • Hero Member
  • *****
  • Posts: 824
Re: How can I show text with OpenGL?
« Reply #4 on: March 03, 2018, 09:35:10 am »
comingnine, thank you for your answer.
What is IIRC? Could you show me an example of the subject?

Check out  loaded on Strava
https://www.strava.com/athletes/109391137

comingnine

  • New Member
  • *
  • Posts: 25
Re: How can I show text with OpenGL?
« Reply #5 on: March 03, 2018, 11:26:34 am »
The source & sample can be found here http://www.dev-center.de/projects/textsuite

PS: There seems to be an updated version https://git.bergmann89.de/opengl/TextSuite

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: How can I show text with OpenGL?
« Reply #6 on: March 03, 2018, 11:33:02 am »
What is IIRC?
"If I remember correctly"

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: How can I show text with OpenGL?
« Reply #7 on: March 03, 2018, 11:47:18 am »
The source & sample can be found here http://www.dev-center.de/projects/textsuite

PS: There seems to be an updated version https://git.bergmann89.de/opengl/TextSuite
I don't like libraries which introduce an unneeded dependence on other libraries, here: bitSpaceOpenGL. Isn't the built-in OpenGL support enough? Why does everybody have to reinvent the wheel?

In TAChart's TADrawerOpenGL there is text support for OpenGL using FreeType (based on units which comes with FPC and Lazarus). It is not directly usable, but could easily be copied and pasted into a separate standalone unit; the basic work is done by the TGLFreeTypeHelper class.

[EDIT]
For the current trunk version of lazarus, I extracted the OpenGL text support into a separate unit, TAOpenGL.
But not: text rendering is only supported as 2D texture
« Last Edit: March 03, 2018, 12:41:42 pm by wp »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: How can I show text with OpenGL?
« Reply #8 on: March 03, 2018, 02:03:14 pm »
The method here is rather slow and simple
-https://www.entwickler-ecke.de/topic_2D+Text+in+OpenGL_39104,0.html

I currently still use this (wglusefontbitmap + callists) for small text because it is the fastest. It is not portable though, but for me that is not (yet) really a problem.  Fast as in time spend in opengl overall per frame, so that is drawing and  preparation. The preparation with the array of vertices for signed distance fonts is quite slow, and for me that happens every frame.

I only work on opengl from time to time though, but some improvements have been made since the last upload of that code.

Note that if you somewhat can understand German like me, there is also https://delphigl.com/forum/index.php though, while it is not as active anymore as it used to be, I did get some nice answers there.

ChrisR

  • Full Member
  • ***
  • Posts: 247
Re: How can I show text with OpenGL?
« Reply #9 on: March 03, 2018, 03:25:19 pm »
I think multi-channel signed distance fonts are the best solution. You can see my Lazarus solution here (Project 5):
  https://github.com/neurolabusc/OpenGLCoreTutorials
This approach uses minimal dependencies, is scalable, can be rotated, and is very fast.

loaded

  • Hero Member
  • *****
  • Posts: 824
Re: How can I show text with OpenGL?
« Reply #10 on: March 04, 2018, 07:00:35 am »
ChrisR and marcov and wp and howardpc and comingnine
Thank you all individually thank you.

comingnine,
The source & sample can be found here http://www.dev-center.de/projects/textsuite

PS: There seems to be an updated version https://git.bergmann89.de/opengl/TextSuite

TextSuite has seen my work.
The text has to be rotated, I think I should solve it with math functions.Respects
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

 

TinyPortal © 2005-2018