📄 glut
字号:
/*************************************************************************** * Copyright (C) 2004 - 2006 by ZJUBase *
* National Lab of Industrial Control Tech. * * Zhejiang University, China *
* * * Team members: *
* Currently the team leader is, * * Hao JIANG (jianghao@iipc.zju.edu.cn; riveria@gmail.com) *
* In the next season, the leader will be * * Yifeng ZHANG (yfzhang@iipc.zju.edu.cn) *
* ZJUBase 3D agent is created by * * Dijun LUO (djluo@iipc.zju.edu.cn) *
* All the members who has ever contributed: * * Jun JIANG *
* Xinfeng DU (xfdu@iipc.zju.edu.cn) *
* Yang ZHOU (yzhou@iipc.zju.edu.cn) *
* Zhipeng YANG *
* Xiang FAN *
* *
* Team Manager: *
* Ms. Rong XIONG (rxiong@iipc.zju.edu.cn) *
* *
* If you met any problems or you have something to discuss about * * ZJUBase. Please feel free to contact us through EMails given below. * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/
/////////////////////////////////////////////////////////
/////////////// GLUT Header Start ///////////////////////
#ifndef __glut_h__
#define QUAD_OBJ_INIT() { if(!quadObj) initQuadObj(); }
#define GLUT_STROKE_ROMAN ((void*)0)
#define GLUT_STROKE_MONO_ROMAN ((void*)1)
/* Bitmap font constants (use these in GLUT program). */
#define GLUT_BITMAP_9_BY_15 ((void*)2)
#define GLUT_BITMAP_8_BY_13 ((void*)3)
#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
#if (GLUT_API_VERSION >= 3)
#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
#endif
#if defined(_WIN32)
#pragma warning (disable:4244) /* disable bogus conversion warnings */
#pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */
#endif
typedef struct {
float x;
float y;
} CoordRec, *CoordPtr;
typedef struct {
int num_coords;
CoordRec *coord;
} StrokeRec, *StrokePtr;
typedef struct {
int num_strokes;
StrokeRec *stroke;
float center;
float right;
} StrokeCharRec, *StrokeCharPtr;
typedef struct {
char *name;
int num_chars;
StrokeCharRec *ch;
float top;
float bottom;
} StrokeFontRec, *StrokeFontPtr;
typedef void *GLUTstrokeFont;
static GLUquadricObj *quadObj;
char *__glutProgramName = NULL;
void (__cdecl *__glutExitFunc)(int retval) = NULL;
typedef void *GLUTbitmapFont;
typedef struct {
GLsizei width;
GLsizei height;
GLfloat xorig;
GLfloat yorig;
GLfloat advance;
GLubyte *bitmap;
} BitmapCharRec, *BitmapCharPtr;
typedef struct {
char *name;
int num_chars;
int first;
BitmapCharRec * *ch;
} BitmapFontRec, *BitmapFontPtr;
void
__glutFatalError(char *format,...)
{
va_list args;
va_start(args, format);
fprintf(stderr, "GLUT: Fatal Error in %s: ",
__glutProgramName ? __glutProgramName : "(unamed)");
vfprintf(stderr, format, args);
va_end(args);
putc('\n', stderr);
#ifdef _WIN32
if (__glutExitFunc) {
__glutExitFunc(1);
}
#endif
exit(1);
}
typedef void *GLUTbitmapFont;
#ifdef _WIN32
/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with
a height or width of zero does not advance the raster position
as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */
static GLubyte ch0data[] = { 0x0 };
static BitmapCharRec ch0 = {1,1,0,0,9,ch0data};
#else
static BitmapCharRec ch0 = {0,0,0,0,9,0};
#endif
#ifdef _WIN32
/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with
a height or width of zero does not advance the raster position
as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */
static GLubyte ch32data[] = { 0x0 };
static BitmapCharRec ch32 = {1,1,0,0,9,ch32data};
#else
static BitmapCharRec ch32 = {0,0,0,0,9,0};
#endif
#ifdef _WIN32
/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with
a height or width of zero does not advance the raster position
as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */
static GLubyte ch127data[] = { 0x0 };
static BitmapCharRec ch127 = {1,1,0,0,9,ch127data};
#else
static BitmapCharRec ch127 = {0,0,0,0,9,0};
#endif
#ifdef _WIN32
/* XXX Work around Microsoft OpenGL 1.1 bug where glBitmap with
a height or width of zero does not advance the raster position
as specified by OpenGL. (Cosmo OpenGL does not have this bug.) */
static GLubyte ch160data[] = { 0x0 };
static BitmapCharRec ch160 = {1,1,0,0,9,ch160data};
#else
static BitmapCharRec ch160 = {0,0,0,0,9,0};
#endif
/* char: 0xff */
static GLubyte ch255data[] = {
0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x28,0x28,
};
static BitmapCharRec ch255 = {6,14,-1,3,9,ch255data};
/* char: 0xfe */
static GLubyte ch254data[] = {
0x80,0x80,0x80,0xbc,0xc2,0x82,0x82,0x82,0xc2,0xbc,0x80,0x80,
};
static BitmapCharRec ch254 = {7,12,-1,3,9,ch254data};
/* char: 0xfd */
static GLubyte ch253data[] = {
0x78,0x84,0x4,0x74,0x8c,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x30,0x8,
};
static BitmapCharRec ch253 = {6,14,-1,3,9,ch253data};
/* char: 0xfc */
static GLubyte ch252data[] = {
0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x28,0x28,
};
static BitmapCharRec ch252 = {7,11,-1,0,9,ch252data};
/* char: 0xfb */
static GLubyte ch251data[] = {
0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x44,0x38,
};
static BitmapCharRec ch251 = {7,11,-1,0,9,ch251data};
/* char: 0xfa */
static GLubyte ch250data[] = {
0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x30,0x8,
};
static BitmapCharRec ch250 = {7,11,-1,0,9,ch250data};
/* char: 0xf9 */
static GLubyte ch249data[] = {
0x7a,0x84,0x84,0x84,0x84,0x84,0x84,0x0,0x0,0x18,0x20,
};
static BitmapCharRec ch249 = {7,11,-1,0,9,ch249data};
/* char: 0xf8 */
static GLubyte ch248data[] = {
0x80,0x7c,0xa2,0xa2,0x92,0x8a,0x8a,0x7c,0x2,
};
static BitmapCharRec ch248 = {7,9,-1,1,9,ch248data};
/* char: 0xf7 */
static GLubyte ch247data[] = {
0x10,0x38,0x10,0x0,0xfe,0x0,0x10,0x38,0x10,
};
static BitmapCharRec ch247 = {7,9,-1,0,9,ch247data};
/* char: 0xf6 */
static GLubyte ch246data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x28,0x28,
};
static BitmapCharRec ch246 = {7,11,-1,0,9,ch246data};
/* char: 0xf5 */
static GLubyte ch245data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x50,0x28,
};
static BitmapCharRec ch245 = {7,11,-1,0,9,ch245data};
/* char: 0xf4 */
static GLubyte ch244data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x44,0x38,
};
static BitmapCharRec ch244 = {7,11,-1,0,9,ch244data};
/* char: 0xf3 */
static GLubyte ch243data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x30,0x8,
};
static BitmapCharRec ch243 = {7,11,-1,0,9,ch243data};
/* char: 0xf2 */
static GLubyte ch242data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x0,0x18,0x20,
};
static BitmapCharRec ch242 = {7,11,-1,0,9,ch242data};
/* char: 0xf1 */
static GLubyte ch241data[] = {
0x82,0x82,0x82,0x82,0x82,0xc2,0xbc,0x0,0x0,0x50,0x28,
};
static BitmapCharRec ch241 = {7,11,-1,0,9,ch241data};
/* char: 0xf0 */
static GLubyte ch240data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x7c,0x8,0x50,0x30,0x48,
};
static BitmapCharRec ch240 = {7,11,-1,0,9,ch240data};
/* char: 0xef */
static GLubyte ch239data[] = {
0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x50,0x50,
};
static BitmapCharRec ch239 = {5,11,-2,0,9,ch239data};
/* char: 0xee */
static GLubyte ch238data[] = {
0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x90,0x60,
};
static BitmapCharRec ch238 = {5,11,-2,0,9,ch238data};
/* char: 0xed */
static GLubyte ch237data[] = {
0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x60,0x10,
};
static BitmapCharRec ch237 = {5,11,-2,0,9,ch237data};
/* char: 0xec */
static GLubyte ch236data[] = {
0xf8,0x20,0x20,0x20,0x20,0x20,0xe0,0x0,0x0,0x30,0x40,
};
static BitmapCharRec ch236 = {5,11,-2,0,9,ch236data};
/* char: 0xeb */
static GLubyte ch235data[] = {
0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x28,0x28,
};
static BitmapCharRec ch235 = {7,11,-1,0,9,ch235data};
/* char: 0xea */
static GLubyte ch234data[] = {
0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x44,0x38,
};
static BitmapCharRec ch234 = {7,11,-1,0,9,ch234data};
/* char: 0xe9 */
static GLubyte ch233data[] = {
0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x30,0x8,
};
static BitmapCharRec ch233 = {7,11,-1,0,9,ch233data};
/* char: 0xe8 */
static GLubyte ch232data[] = {
0x7c,0x80,0x80,0xfe,0x82,0x82,0x7c,0x0,0x0,0x18,0x20,
};
static BitmapCharRec ch232 = {7,11,-1,0,9,ch232data};
/* char: 0xe7 */
static GLubyte ch231data[] = {
0x30,0x48,0x18,0x7c,0x82,0x80,0x80,0x80,0x82,0x7c,
};
static BitmapCharRec ch231 = {7,10,-1,3,9,ch231data};
/* char: 0xe6 */
static GLubyte ch230data[] = {
0x6e,0x92,0x90,0x7c,0x12,0x92,0x6c,
};
static BitmapCharRec ch230 = {7,7,-1,0,9,ch230data};
/* char: 0xe5 */
static GLubyte ch229data[] = {
0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x18,0x24,0x18,
};
static BitmapCharRec ch229 = {7,11,-1,0,9,ch229data};
/* char: 0xe4 */
static GLubyte ch228data[] = {
0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x28,0x28,
};
static BitmapCharRec ch228 = {7,11,-1,0,9,ch228data};
/* char: 0xe3 */
static GLubyte ch227data[] = {
0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x50,0x28,
};
static BitmapCharRec ch227 = {7,11,-1,0,9,ch227data};
/* char: 0xe2 */
static GLubyte ch226data[] = {
0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x44,0x38,
};
static BitmapCharRec ch226 = {7,11,-1,0,9,ch226data};
/* char: 0xe1 */
static GLubyte ch225data[] = {
0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x30,0x8,
};
static BitmapCharRec ch225 = {7,11,-1,0,9,ch225data};
/* char: 0xe0 */
static GLubyte ch224data[] = {
0x7a,0x86,0x82,0x7e,0x2,0x2,0x7c,0x0,0x0,0x18,0x20,
};
static BitmapCharRec ch224 = {7,11,-1,0,9,ch224data};
/* char: 0xdf */
static GLubyte ch223data[] = {
0x80,0xbc,0xc2,0x82,0x82,0xfc,0x82,0x82,0x7c,
};
static BitmapCharRec ch223 = {7,9,-1,1,9,ch223data};
/* char: 0xde */
static GLubyte ch222data[] = {
0x80,0x80,0x80,0xfc,0x82,0x82,0x82,0xfc,0x80,0x80,
};
static BitmapCharRec ch222 = {7,10,-1,0,9,ch222data};
/* char: 0xdd */
static GLubyte ch221data[] = {
0x10,0x10,0x10,0x10,0x28,0x44,0x82,0x82,0x0,0x30,0x8,
};
static BitmapCharRec ch221 = {7,11,-1,0,9,ch221data};
/* char: 0xdc */
static GLubyte ch220data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x28,0x28,
};
static BitmapCharRec ch220 = {7,11,-1,0,9,ch220data};
/* char: 0xdb */
static GLubyte ch219data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x44,0x38,
};
static BitmapCharRec ch219 = {7,11,-1,0,9,ch219data};
/* char: 0xda */
static GLubyte ch218data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x30,0x8,
};
static BitmapCharRec ch218 = {7,11,-1,0,9,ch218data};
/* char: 0xd9 */
static GLubyte ch217data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x0,0x18,0x20,
};
static BitmapCharRec ch217 = {7,11,-1,0,9,ch217data};
/* char: 0xd8 */
static GLubyte ch216data[] = {
0x80,0x7c,0xc2,0xa2,0xa2,0x92,0x92,0x8a,0x8a,0x86,0x7c,0x2,
};
static BitmapCharRec ch216 = {7,12,-1,1,9,ch216data};
/* char: 0xd7 */
static GLubyte ch215data[] = {
0x82,0x44,0x28,0x10,0x28,0x44,0x82,
};
static BitmapCharRec ch215 = {7,7,-1,-1,9,ch215data};
/* char: 0xd6 */
static GLubyte ch214data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x28,0x28,
};
static BitmapCharRec ch214 = {7,11,-1,0,9,ch214data};
/* char: 0xd5 */
static GLubyte ch213data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x50,0x28,
};
static BitmapCharRec ch213 = {7,11,-1,0,9,ch213data};
/* char: 0xd4 */
static GLubyte ch212data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x44,0x38,
};
static BitmapCharRec ch212 = {7,11,-1,0,9,ch212data};
/* char: 0xd3 */
static GLubyte ch211data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x30,0x8,
};
static BitmapCharRec ch211 = {7,11,-1,0,9,ch211data};
/* char: 0xd2 */
static GLubyte ch210data[] = {
0x7c,0x82,0x82,0x82,0x82,0x82,0x82,0x7c,0x0,0x18,0x20,
};
static BitmapCharRec ch210 = {7,11,-1,0,9,ch210data};
/* char: 0xd1 */
static GLubyte ch209data[] = {
0x82,0x86,0x8a,0x92,0x92,0xa2,0xc2,0x82,0x0,0x50,0x28,
};
static BitmapCharRec ch209 = {7,11,-1,0,9,ch209data};
/* char: 0xd0 */
static GLubyte ch208data[] = {
0xfc,0x42,0x42,0x42,0x42,0xf2,0x42,0x42,0x42,0xfc,
};
static BitmapCharRec ch208 = {7,10,-1,0,9,ch208data};
/* char: 0xcf */
static GLubyte ch207data[] = {
0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x50,0x50,
};
static BitmapCharRec ch207 = {5,11,-2,0,9,ch207data};
/* char: 0xce */
static GLubyte ch206data[] = {
0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x88,0x70,
};
static BitmapCharRec ch206 = {5,11,-2,0,9,ch206data};
/* char: 0xcd */
static GLubyte ch205data[] = {
0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x60,0x10,
};
static BitmapCharRec ch205 = {5,11,-2,0,9,ch205data};
/* char: 0xcc */
static GLubyte ch204data[] = {
0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0xf8,0x0,0x30,0x40,
};
static BitmapCharRec ch204 = {5,11,-2,0,9,ch204data};
/* char: 0xcb */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -