0

I cannot find any simple solutions for text rendering in internet.

I saw approaches with mapping characters as textures and than make some search and draw as texture. This way seems to be too complex for such primitive action as text drawing. Isn't it?

So, my question is about simple ways to render text with SharpGL. How can it be accomplished?

frankie
  • 728
  • 1
  • 10
  • 28

2 Answers2

1

Well text rendering is not as primitive as it seems :)

You should try some third party libraries for this task. FTGL is a nice font rendering library for OpenGL. It has a c# port also available may be you should try that.

Abhishek Bansal
  • 5,197
  • 4
  • 40
  • 69
1

It's one of 2 ways to render text

The other is creating a mesh for each of the letters and rendering them where you need to. However this is expensive compared to the texture method.

Both require some more effort in creating the characters glyphs on your part (or using pre-made stuff from the web). The texture method allows caching of larger strings/common words to minimize rendering effort.

Using uniforms to pass the character you want to render using int you can then calculate the location of the glyph in the charmap. This can be expanded to multiple chars per quad depending on where the fragment is in the quad.

ratchet freak
  • 47,288
  • 5
  • 68
  • 106