Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
FontGL.cpp
Package: eluosifangkuai.rar [view]
Upload User: apollo_111
Upload Date: 2022-08-09
Package Size: 2146k
Code Size: 2k
Category:
OpenGL program
Development Platform:
Visual C++
- // FontGL.cpp: implementation of the CFontGL class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "Tetris.h"
- #include "FontGL.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CFontGL::CFontGL()
- {
- }
- CFontGL::~CFontGL()
- {
- }
- void CFontGL::BuildFont(struct HDC__ *hhdc)
- {
- HFONT font;
- // 生成显示列表的索引
- m_iBaseFont = glGenLists(96);
- // 定义字体
- font = CreateFont( 25,
- 0,
- 0,
- 0,
- FW_BOLD,
- FALSE,
- FALSE,
- FALSE,
- ANSI_CHARSET,
- OUT_TT_PRECIS,
- CLIP_DEFAULT_PRECIS,
- ANTIALIASED_QUALITY,
- FF_DONTCARE|DEFAULT_PITCH,
- "ARIAL");
- SelectObject(hhdc, font);
- // 生成显示列表
- wglUseFontBitmaps(hhdc, 32, 96, m_iBaseFont);
- }
- void CFontGL::glPrint(const char *fmt, ...)
- {
- char text[256];
- va_list ap;
- if (fmt == NULL)
- return;
- va_start(ap, fmt);
- vsprintf(text, fmt, ap);
- va_end(ap);
- glPushAttrib(GL_LIST_BIT);
- glListBase(m_iBaseFont - 32);
- glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);
- glPopAttrib();
- }
- void CFontGL::KillFont(void)
- {
- glDeleteLists(m_iBaseFont, 96);
- }