Recent

Author Topic: OpenGL smooth text/fonts  (Read 14036 times)

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 1313
OpenGL smooth text/fonts
« on: December 05, 2015, 02:37:43 am »
Would there be interest in a module that prints smooth (anti-aliased and such) fonts in any size, including user-defined?

Because there doesn't seem to be one for Lazarus, and I have a half completed one laying around.

AnthonyTekatch

  • Jr. Member
  • **
  • Posts: 78
Re: OpenGL smooth text/fonts
« Reply #1 on: December 05, 2015, 04:20:55 am »
Yes, there would be interest! Please continue.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: OpenGL smooth text/fonts
« Reply #2 on: December 05, 2015, 05:50:28 am »
hello,
have a look  here
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: OpenGL smooth text/fonts
« Reply #3 on: December 05, 2015, 01:25:55 pm »
Yes sure!
Jurassic Pork BGRA is very good but doing it in OpenGL is a different subject specially smooth font render.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: OpenGL smooth text/fonts
« Reply #4 on: December 05, 2015, 02:01:07 pm »
Yes, there is a demo that uses signed distance fonts, with antialiassing using shaders:

http://forum.lazarus.freepascal.org/index.php/topic,30556.msg194612.html#msg194612

It was actually the last post in the board when you posted :). But there are no fonts in the title, so I improved the title to include "signed distance fonts"

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: OpenGL smooth text/fonts
« Reply #5 on: December 05, 2015, 02:04:02 pm »
I check that demo before but it doesn't seem smooth.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: OpenGL smooth text/fonts
« Reply #6 on: December 05, 2015, 02:44:39 pm »
I check that demo before but it doesn't seem smooth.

As far as I can see it is smooth, but not anti aliased. Though afaik the code should do it, but maybe the outline support interfered. I haven't done much work on that (since the fontsupport it replaces is also not antialiased)

The original article is here: http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: OpenGL smooth text/fonts
« Reply #7 on: December 05, 2015, 02:55:19 pm »
Quote
As far as I can see it is smooth, but not anti aliased
An I meant anti aliased.
Anti aliased seems a problem in OpenGL and should made from us not OpenGL it self.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: OpenGL smooth text/fonts
« Reply #8 on: December 05, 2015, 04:05:34 pm »
Quote
As far as I can see it is smooth, but not anti aliased
An I meant anti aliased.
Anti aliased seems a problem in OpenGL and should made from us not OpenGL it self.

As said I haven't really investigated that since most my characters are relatively small, and the background is uneven anyway (hence the outline fonts).

IIRC I disabled blending, choosing clipping based on some hints in the delphigl forum, maybe it could be turned back on using an anti aliasing function.

Carver413

  • Full Member
  • ***
  • Posts: 119
Re: OpenGL smooth text/fonts
« Reply #9 on: December 05, 2015, 06:22:03 pm »
Yes sure!
Jurassic Pork BGRA is very good but doing it in OpenGL is a different subject specially smooth font render.
It is quite common to use textures for font display, in the end they often provide the best looking results. 

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: OpenGL smooth text/fonts
« Reply #10 on: December 05, 2015, 06:41:38 pm »
Quote
It is quite common to use textures for font display, in the end they often provide the best looking results.
I m doing this right now but for some cases OpenGL way is much faster especially when you change text a lot.

Carver413

  • Full Member
  • ***
  • Posts: 119
Re: OpenGL smooth text/fonts
« Reply #11 on: December 05, 2015, 08:04:19 pm »
Quote
It is quite common to use textures for font display, in the end they often provide the best looking results.
I m doing this right now but for some cases OpenGL way is much faster especially when you change text a lot.
using a more modern opengl will do a lot to improve performance. I am using a texture based gui on top of opengl and for the most part I am pleased with the results.I only have a single core cpu and an older graphics card. if I had a multi core I think I would focus more splitting up the texture rendering. I think that Vulkan will prove to be more useful in low level design so I'm not really digging too deep with the opengl but rather improving the cpu side of things and formulating Idea's of how it will work with Vulkan in the future. I would rather have a single design that would serve all my needs.

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: OpenGL smooth text/fonts
« Reply #12 on: December 05, 2015, 08:28:20 pm »
Quote
using a more modern opengl will do a lot to improve performance. I am using a texture based gui on top of opengl and for the most part I am pleased with the results.I only have a single core cpu and an older graphics card. if I had a multi core I think I would focus more splitting up the texture rendering. I think that Vulkan will prove to be more useful in low level design so I'm not really digging too deep with the opengl but rather improving the cpu side of things and formulating Idea's of how it will work with Vulkan in the future. I would rather have a single design that would serve all my needs.
yes Im interested in Vulkan to waiting for it.
About your gui system I like to know more about it because I tried to make a simple system for myself , if you want to share I be more than happy.

Carver413

  • Full Member
  • ***
  • Posts: 119
Re: OpenGL smooth text/fonts
« Reply #13 on: December 06, 2015, 04:41:56 pm »
Quote
using a more modern opengl will do a lot to improve performance. I am using a texture based gui on top of opengl and for the most part I am pleased with the results.I only have a single core cpu and an older graphics card. if I had a multi core I think I would focus more splitting up the texture rendering. I think that Vulkan will prove to be more useful in low level design so I'm not really digging too deep with the opengl but rather improving the cpu side of things and formulating Idea's of how it will work with Vulkan in the future. I would rather have a single design that would serve all my needs.
yes Im interested in Vulkan to waiting for it.
About your gui system I like to know more about it because I tried to make a simple system for myself , if you want to share I be more than happy.
The Explorer model is very different kind of framework as it doesn't follow the standard delphi design model. linklist design,scripted frontend, much more abstract as I like to tinker alot. the end goal for the Explorer is to create a RPG/Progcedural game engine/ design studio of a sort. nothing like skyrim of course since most of the content would be created with scripts and a little bit of cad intermixed. I do not know when it would be release as it is just a hobbie for me.
http://i67.tinypic.com/2cz3rfd.jpg

Carver413

  • Full Member
  • ***
  • Posts: 119
Re: OpenGL smooth text/fonts
« Reply #14 on: January 04, 2016, 01:16:05 am »
http://i66.tinypic.com/10753bo.jpg
I did a little experimenting to see if I could make a smoother looking font and this is what I ended up with.

 

TinyPortal © 2005-2018