opengl绘制位图字体c语言源代码,OpenGL文字绘制(OpenGL text rendering).doc

OpenGL文字绘制(OpenGL text rendering)

OpenGL文字绘制(OpenGL text rendering)

OpenGL text output, Tuesday, 05 2009, 13:47, 26

OpenGL is a 3D graphical interface, where text is displayed differently from text displayed in a Windows graphic environment. On OpenGL, text requires some special methods, because there are flat text and 3D text on the 3D graphical interface. Especially the display of Chinese characters is more troublesome, because the bottom of the OpenGL does not support the double byte encoding of Chinese characters. The solution in this article can be implemented in three different ways of text display:

Regular text

This text display is an efficient way to draw fonts in bitmaps. It uses a graphic method, so it shows flat text. Unfortunately, this flat text display method can not support Chinese characters.

3D text

Text in OpenGL can also be displayed as a 3D object. This 3D text can scale, rotate, map, and have all the properties of other 3D objects. We also added special processing to the double byte Chinese characters in the program, so it can also display stereoscopic Chinese characters.

Flat Chinese characters

OpenGL flat Chinese characters. The basic principle is: build a certain font equipment scene within the system (MDC), GDI will form a monochrome bitmap in the text equipment in the scene, and then the OpenGL plane bitmap display function glBitmap (...) Show the text.

Here is the source code:

//GLFont.h----------------------------------------------------------------------

Interface for the CGLFont class. / / GLFont.h:

#if! Defined (AFX_GLFONT_H__88F1F000_50F5_452A_B95E_60ED83712FA5__INCLUDED_)

#define AFX_GLFONT_H__88F1F000_50F5_452A_B95E_60ED83712FA5__INCLUDED_

#if _MSC_VER > 1000

#pragma once

#endif / _MSC_VER > 1000

Class CGLFont

{

Public:

Void, entext (float, x, float, y, LPCTSTR, STR, HFONT, hFont, float, R, float, G, float, B);

Void c3dtext (LPCTSTR, STR, HFONT, hFont, float, Z);

Void Printfc3d (LPCTSTR, strText, HFONT, hFont, float, z=0.05f);

Void, Printftext (int, x, int, y, LPCTS

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值