OpenGL里面如何显示汉字?

来源:百度知道 编辑:UC知道 时间:2024/09/28 13:56:39
我目前只制作出了如何显示英文,而且使用的还是glut的功能。但是这个功能并不支持显示中文,我就上网查找。结果大部分都是说要使用显示列表(DisplayList)来制作,还有范例代码。

可是那些范例代码都太老了(都还是基于win95和winNT的),里面有些功能比如wglUseFontOutlines或者是类型GLYPHMETRICSFLOAT完全不存在于gl.h或者glu.h里面,这些代码也就无法运行。。。

希望高手指点,如何才能在OpenGL里面显示中文字体?

如果我测试能够使用会追加50分。。。=v=)/
虽然已经include了wingdi.h,但是编译的时候居然出了一大堆错误,而且都来自于wingdi.h里面。。。可是这个文件我根本就没动过,仅仅是include了以后再编译就出错,这是怎么回事?而且出的错误都是1>E:\Microsoft Visual Studio 8\VC\PlatformSDK\include\wingdi.h(268) : error C2146: syntax error : missing ';' before identifier 'ptPosition'
这类错误,可是我看了并没有什么地方忘记加;啊。

wglUseFontOutlines 要求
头文件 wingdi.h
库 opengl32.lib

要学会查msdn,这里有个例子的自己看吧
OpenGL
wglUseFontOutlines
The wglUseFontOutlines function creates a set of display lists, one for each glyph of the currently selected outline font of a device context, for use with the current rendering context. The display lists are used to draw 3-D characters of TrueType fonts. Each display list describes a glyph outline in floating-point coordinates.

The run of glyphs begins with the first glyph of the font of the specified device context. The em square size of the font, the notional grid size of the original font outline from which the font is fitted, is mapped to 1.0 in the x- and y-coordinates in the display lists. The extrusion parameter sets how much depth the font has in the z direction.

The lpgmf parameter returns a GLYPHMETRICSFLOAT structure that contains information about the placement and orientation of each glyph in a character cell.