Opengl Multilingual Rendering

I need to expand the OpenGL rendering system to support international characters (especially in Hebrew, Arabic and Cyrillic).

The development platform is Windows (XP | Vista | 7), alas, using Embercardero Delphi 2010.

I am currently using wglOutLineFont (...) to create a font display list and glCallLists(length(m_Text), UNSIGNED_SHORT, PWchar(m_Text) ) to render my lines.

Although it is possible for Latin-1 characters, building a complete Unicode character set in advance is quite time-consuming (about 8.5 minutes on my machine), so I'm looking for a more efficient solution. I was thinking of limiting the range from U + 0020 - and + 077f (Latin, Greek, Cyrillic, Arabic and Hebrew) to include only the glyphs I need, but it would just be a solution for my current needs, and it would not be enough once more coding.

On the other hand, I don’t need to worry about the direction from left to right or right-left, as our application can already handle this.

I would expect this to be a well-known issue, so I would like to ask if there is any background material on this issue on the Internet, or if you could share some insights on this issue?

Edit Explanation: I use polygonal representations of fonts. Each font is created with a block size (1.0) in advance and scaled accordingly using glScalef(...) before rendering. I decided against preliminary rasterization, since users can get much closer (the application is used for CAD), so raster artifacts become noticeable.

In addition, since the scene rarely exceeds more than a few hundred characters (mainly labels and measurements), the increase in speed from preliminary rasterization is negligible.

+7
winapi unicode delphi opengl
source share
3 answers

Do not create preliminary assemblies of display lists: - create an intermediate sprite that builds lists on demand and caches them. Trying to pre-compute lists - or pre-create rasterized textures for each font size, font face and for all characters - is impractical, especially if you scale to Far Eastern character sets.

+3
source share

You need to replace wglOutLineFont.

To do this, generate / edit the texture of the desired glyphs using wglOutLineFont, and then save the texture to a bitmap file. When the application loads, it needs to load the texture image and the texture coordinates of the glyphs (4 coordinates for each glyph) and create display lists (one list for each glyph, each displayed list should draw one glyph as a textured square).

Each short character representing a glyph must have an appropriate display list (their value matches a lot, and glListBase can help with this).

I believe texture loading is faster than creating font display lists at runtime. Pratic you are moving offline raster computing. But generating a display list can be difficult (many glyphs). In fact, you can run in a separate thread the creation of the display list or generate only the display lists that are necessary for your needs.

+2
source share

I managed to transliterate this tutorial in C ++, although I'm not sure how well it will go into Delphi.

+1
source share

All Articles