在OpenGL中绘制文本而没有胶合 [英] Draw Text In OpenGL Without Glut
本文介绍了在OpenGL中绘制文本而没有胶合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想使用opengl在我的win32应用程序中绘制文本而不会出现过剩现象.我尝试使用免费的Type 2库,但无法为其加载字体文件.
请帮助我解决此问题.
谢谢.
Hi All,
I want to draw text in my win32 app using opengl without glut. I tried with free type 2 library but i fail to load font file for it.
Please help me to fix this issue.
Thanks.
推荐答案
您可以创建包含所有字体字符的纹理图.然后通过适当的纹理映射绘制字体. 如果您不希望使用固定字体,还可以创建一个包含字符网格的3d文件(例如obj或3ds).然后加载并渲染它..
you can create texture map containing all font characters.. then draw the font by proper texture mapping..
If you don''t want fixed font , you can also create a 3d file (like obj or 3ds) containing meshes of characters. then load it and render it..
我们可以使用wglUseFontBitmaps
函数在OpenGL中绘制文本.
MSDN [
We can usewglUseFontBitmaps
function to draw text in OpenGL.
MSDN[^]
这篇关于在OpenGL中绘制文本而没有胶合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文