如何使用 OpenGL、SDL 和 C++ 绘制文本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52431/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 12:29:24  来源:igfitidea点击:

How do I draw text using OpenGL, SDL and C++?

c++openglsdl

提问by Haim Bender

I heard about SDL_TFF which I read about herebut I don't understand how am I supposed to connect the TrueType2 library.

我听说过我在这里读到的 SDL_TFF,但我不明白我应该如何连接 TrueType2 库。

Maybe there is something better out there?

也许那里有更好的东西?

回答by RJFalconer

I came across this great guideon linking in SDL extensions for those new to SDL, which you may find useful.

我遇到了这个关于 SDL 扩展链接的很棒的指南,您可能会发现它很有用。

That said, when I had your problem, I eventually went with FTGLas the way SDL-ttf produces an SDL-Surface with its font rendered on itovercomplicated matters in my situation. This may not be the case in your situation though

也就是说,当我遇到你的问题时,我最终选择了FTGL,因为SDL-ttf 生成 SDL-Surface 的方式,其上呈现的字体在我的情况下过于复杂。不过,您的情况可能并非如此