资源简介
计算机图形学基础[第2版][陆枫/何云峰][电子教案][电子工业出版社]
代码片段和文件信息
/* Copyright (c) Mark J. Kilgard 1994. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
/* capturexfont.c connects to an X server and downloads a
bitmap font from which a C source file is generated
encoding the font for GLUT‘s use. Example usage:
capturexfont.c 9x15 glutBitmap9By15 > glut_9x15.c */
#include
#include
#include
#include
#include
#include
#include
#define MAX_GLYPHS_PER_GRAB 512 /* This is big enough for 2^9
glyph character sets */
static void
outputChar(int num int width int height
int xoff int yoff int advance int data)
{
if (width == 0 || height == 0) {
printf(“#ifdef _WIN32\n“);
printf(“/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with\n“);
printf(“ a height or width of zero does not advance the raster position\n“);
printf(“ as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */\n“);
printf(“static const GLubyte ch%ddata[] = { 0x0 };\n“ num);
printf(“static const BitmapCharRec ch%d = {“ num);
printf(“%d“ 0);
printf(“%d“ 0);
printf(“%d“ xoff);
printf(“%d“ yoff);
printf(“%d“ advance);
printf(“ch%ddata“ num);
printf(“};\n“);
printf(“#else\n“);
}
printf(“static const BitmapCharRec ch%d = {“ num);
printf(“%d“ width);
printf(“%d“ height);
printf(“%d“ xoff);
printf(“%d“ yoff);
printf(“%d“ advance);
if (data) {
printf(“ch%ddata“ num);
} else {
printf(“0“);
}
printf(“};\n“);
if (width == 0 || height == 0) {
printf(“#endif\n“);
}
printf(“\n“);
}
/* Can‘t just use isprint because it only works for the range
of ASCII characters (ie TRUE for isascii) and capturexfont
might be run on 16-bit fonts. */
#define PRINTABLE(ch) (isascii(ch) ? isprint(ch) : 0)
void
captureXFont(Display * dpy Font font char *xfont char *name)
{
int first last count;
int cnt len;
Pixmap offscreen;
Window drawable;
XFontStruct *fontinfo;
XImage *image;
GC xgc;
XGCValues values;
int width height;
int i j k;
XCharStruct *charinfo;
XChar2b character;
GLubyte *bitmapData;
int x y;
int spanLength;
int charWidth charHeight maxSpanLength pixwidth;
int grabList[MAX_GLYPHS_PER_GRAB];
int glyphsPerGrab = MAX_GLYPHS_PER_GRAB;
int numToGrab;
int rows pages byte1 byte2 index;
int nullBitmap;
drawable = RootWindow(dpy DefaultScreen(dpy));
fontinfo = XQueryFont(dpy font);
pages = fontinfo->max_char_or_byte2 - fontinfo->min_char_or_byte2 + 1;
first = (fontinfo->min_byte1 << 8) + fontinfo->min_char_or_byte2;
last = (fontinfo->max_byte1 << 8) + fontinfo->max_char_or_byte2;
count = last - first + 1;
width = fontinfo->max_bounds.rbearing -
fontinfo->min_bounds.lbearing;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2008-11-03 18:59 chap6\
文件 16032 2001-11-08 00:20 chap6\WEILER-ATHERTON算法.SWF
文件 17366 2001-11-08 00:20 chap6\字符裁剪.SWF
文件 18028 2001-11-08 00:20 chap6\错切变换.SWF
目录 0 2008-11-03 19:18 chap7\
文件 48690 2001-11-08 00:20 chap7\三视图.SWF
目录 0 2008-11-03 23:42 OpenGL程序\
目录 0 2008-11-03 23:42 OpenGL程序\dll\
文件 315904 1997-11-21 17:01 OpenGL程序\dll\glu.dll
文件 119568 2000-01-10 12:00 OpenGL程序\dll\glu32.dll
文件 180224 1999-07-29 15:48 OpenGL程序\dll\GLUT32.DLL
文件 1214464 1997-11-21 17:01 OpenGL程序\dll\opengl.dll
文件 692496 2002-07-22 12:05 OpenGL程序\dll\OPENGL32.DLL
目录 0 2008-11-03 23:42 OpenGL程序\include\
目录 0 2008-11-03 23:42 OpenGL程序\include\gl\
文件 60468 1998-08-13 02:54 OpenGL程序\include\gl\FGL.H
文件 7273 1998-08-13 02:54 OpenGL程序\include\gl\FGLU.H
文件 10152 1998-08-13 02:54 OpenGL程序\include\gl\FGLUT.H
文件 71555 1997-11-07 02:34 OpenGL程序\include\gl\gl.h
文件 5150 1998-08-13 02:54 OpenGL程序\include\gl\GLSMAP.H
文件 14367 1997-10-31 02:18 OpenGL程序\include\gl\glu.h
文件 20844 1998-08-13 02:54 OpenGL程序\include\gl\GLUT.H
文件 8874 1998-08-13 02:54 OpenGL程序\include\gl\TUBE.H
目录 0 2008-11-03 23:42 OpenGL程序\lib\
文件 35606 1997-10-31 02:18 OpenGL程序\lib\glu.lib
目录 0 2008-11-03 23:42 OpenGL程序\lib\GLUT\
文件 11056 1998-08-13 02:49 OpenGL程序\lib\GLUT\capturexfont.c
文件 2277 1998-08-13 02:46 OpenGL程序\lib\GLUT\GLUT.DEF
文件 180224 1999-07-29 15:48 OpenGL程序\lib\GLUT\GLUT32.DLL
文件 17306 1999-07-29 15:48 OpenGL程序\lib\GLUT\GLUT32.EXP
文件 27096 1999-07-29 15:48 OpenGL程序\lib\GLUT\GLUT32.LIB
............此处省略128个文件信息
评论
共有 条评论