Text Rendering In OpenGL // OpenGL Tutorial #46.1

preview_player
Показать описание
This is the first of two videos on font and text rendering in OpenGL using the FreetypeGL library. In this video we learn how to build FreetypeGL and its dependencies on Windows. In the next one we will integrate it into an OpenGL application.

Here's a short summary of the steps presented in the video:

1. Install CMake.
2. Create ‘work’ directory
3. Create ‘work\lib’
5. Open solution from freetype\builds\windows\vc2010
6. Change to ‘Release’ build and build solution.
10. If asked, upgrade solution.
11. Change to ‘Release’ build
12. Add to C/C++ - General - Additional include directories:
C:\Users\emeir\Documents\work\freetype-2.13.0\include
ogldev\Include
14. Copy "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64\OpenGL32.Lib" to work\lib.

* Create Freetype-GL demos
2. Unzip the package, open terminal in the extract directory and execute:
cmake -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -S . -B build
3. Open build/GLFW.sln and build in release build.
4. Execute in terminal:
cmake --install build --prefix install
5. cd freetype-gl/demo
list(APPEND CMAKE_PREFIX_PATH "../../glfw-3.3.8/install")
8. Add to demo-utils project include:
C:\Users\emeir\Documents\work\freetype-gl
ogldev\include
9. Remove include config.h from opengl.h
Add link directory to Ansi project: ..\..\Lib

Timecodes:
0:00 Intro
1:45 Download Freetype
2:34 Building Freetype
3:43 Clone FreetypeGL sources
4:01 Build FreetypeGL
8:28 FreetypeGL demos
8:40 Download GLFW
9:21 Build GLFW
10:14 Build FreetypeGL demos
14:30 Running the demos
15:19 Outro

Feel free to comment below.

Instagram: @ogldev1
Twitter: @ogldev

Music credits:
Track: Moonlight — Next Route [Audio Library Release] Music provided by Audio Library Plus Watch: • Moonlight — Next Route |
––––––––––––––––––––––––––––––
––––––––––––––––––––––––––––––
––––––––––––––––––––––––––––––
––––––––––––––––––––––––––––––
––––––––––––––––––––––––––––––
Track: Ocean Tide — Jay Someday [Audio Library Release] Music provided by Audio Library Plus Watch: • Ocean Tide — Jay Someday |

Enjoy,

Etay Meiri

#opengl #ogldev #opengtutorials
Рекомендации по теме
Комментарии
Автор

Clone the sources:

If you want to get the same version that was used in the video you can checkout the tag 'TUT_46_FREETYPEGL'.

Build on Windows:
Open the Visual Studio solution:
Build the project 'OpenGL

OGLDEV
Автор

For comparison, if you _just_ want to draw basic text with OpenGL, using Freetype to load and render out (SDF) glyphs is maybe 100ish lines of code plus a 10-line shader.

Freetype is pretty easy to work with.

cacheman
Автор

I like to do everything from scratch. In my current indie game project I have hand drawn the font characters to a texture (atlas) in Gimp. Then I set structs with the characters info containing their UV coords and pointer to their opengl texture. So I have an array of reusable text structs that can contain a maximum of 2048 characters per text. Then I have functions to create texts that find a free text in the text array and set them to the desired text. When drawing the text I merge all character and UI sprites into a single mesh with their correct draw order, then I can draw all of the UI and text with one draw call. I also use vertex colors on the character's and UI sprites, so I can set colors and gradients to the the text and sprites individually still keeping them in a single draw call. Because I do it all in a single draw call I can draw about 90k sprites per frame at 60fps in my reasonably old (10+ years old) PC. (I'm working in C)

Vicente_Lopes_Senger
Автор

Thank you for the video. I love your content even if I work on Metal. I had to do everything from scratch for text rendering since libraries are not a thing in Metal.

nimrod
Автор

interesting and important topic in computer graphics

EgorChebotarev
Автор

Thank you.
Wooooah, I tried to use ftgl lib which looks like pretty similar, but it just won't to read lib definitions, I think it is just too old.
Is it possible to generate vertices from fonts with that library to generate 3D volumetric fonts?

tematoscybersage
Автор

Hi, thanks for your content :)
Does any of your series teach about things like normal maps etc...?
I mean very basic gamedev concepts but I just would like to know so that I can follow them.
I tried searching that in both your beginner and intermediate OpenGL series but can't find it.

laurapeterson
Автор

14:47
This is where I have problems. I do not know how to correctly input my path to the different directories.

LumenBrewer
Автор

when I run the demos it said it can not find or open the file screenshot-util.obj and shader.obj

samuelappiagyei
Автор

I was looking to render symbols like integrals on textures with Latex, but it turned out to be too complicated for me.

TiramisuCorleone
Автор

hahahaa you just reminded me what a nightmare is to program under windows LOL

PaulMetalhero
Автор

super simple now just include vcpkg with manifest mode and a vcpkg.config and it'll download whatever you want automatically any os

adamrushford
Автор

hey man, house the city now? Ryan, your british friend (ill visit in may for a beer! or coffee with my g/f)

AlbertRyanstein
join shbcf.ru