资源简介
OpenGL超级宝典(第五版)(传说中的蓝宝书)源码
代码片段和文件信息
/* CallbackMaker.c */
/*
* Program to invoke all the callbacks that “freeglut“ supports
*/
#include
#include
#include
#include
static int sequence_number = 0 ;
int reshape_called = 0 key_called = 0 special_called = 0 visibility_called = 0
keyup_called = 0 specialup_called = 0 joystick_called = 0 mouse_called = 0
mousewheel_called = 0 motion_called = 0 passivemotion_called = 0 entry_called = 0
close_called = 0 overlaydisplay_called = 0 windowstatus_called = 0
spacemotion_called = 0 spacerotation_called = 0 spacebutton_called = 0
buttonbox_called = 0 dials_called = 0 tabletmotion_called = 0 tabletbutton_called = 0
menudestroy_called = 0 menustatus_called = 0 ;
int reshape_width = -1 reshape_height = -1 reshape_seq = -1 ;
int key_key = -1 key_x = -1 key_y = -1 key_seq = -1 ;
int special_key = -1 special_x = -1 special_y = -1 special_seq = -1 ;
int visibility_vis = -1 visibility_seq = -1 ;
int keyup_key = -1 keyup_x = -1 keyup_y = -1 keyup_seq = -1 ;
int specialup_key = -1 specialup_x = -1 specialup_y = -1 specialup_seq = -1 ;
int joystick_a = -1 joystick_b = -1 joystick_c = -1 joystick_d = -1 joystick_seq = -1 ; /* Need meaningful names */
int mouse_button = -1 mouse_updown = -1 mouse_x = -1 mouse_y = -1 mouse_seq = -1 ;
int mousewheel_number = -1 mousewheel_direction = -1 mousewheel_x = -1 mousewheel_y = -1 mousewheel_seq = -1 ;
int motion_x = -1 motion_y = -1 motion_seq = -1 ;
int passivemotion_x = -1 passivemotion_y = -1 passivemotion_seq = -1 ;
static void
bitmapPrintf (const char *fmt ...)
{
static char buf[256];
va_list args;
va_start(args fmt);
#if defined(WIN32) && !defined(__CYGWIN__)
(void) _vsnprintf (buf sizeof(buf) fmt args);
#else
(void) vsnprintf (buf sizeof(buf) fmt args);
#endif
va_end(args);
glutBitmapString ( GLUT_BITMAP_HELVETICA_12 (unsigned char*)buf ) ;
}
static void
Display(void)
{
int window = glutGetWindow () ;
glClear ( GL_COLOR_BUFFER_BIT );
glDisable ( GL_DEPTH_TEST );
glMatrixMode ( GL_PROJECTION );
glPushMatrix();
glLoadIdentity();
glOrtho(0 glutGet ( GLUT_WINDOW_WIDTH )
0 glutGet ( GLUT_WINDOW_HEIGHT ) -1 1 );
glMatrixMode ( GL_MODELVIEW );
glPushMatrix ();
glLoadIdentity ();
glColor3ub ( 0 0 0 );
glRasterPos2i ( 10 glutGet ( GLUT_WINDOW_HEIGHT ) - 10 );
if ( reshape_called )
{
bitmapPrintf ( “Reshape %d: %d %d\n“ reshape_seq reshape_width reshape_height );
}
if ( key_called )
{
bitmapPrintf ( “Key %d: %d(%c) %d %d\n“ key_seq key_key key_key key_x key_y );
}
if ( special_called )
{
bitmapPrintf ( “Special %d: %d(%c) %d %d\n“ special_seq special_key special_key special_x special_y );
}
if ( visibility_called )
{
bitmapPrintf ( “Visibility %d: %d\n“ visibility_seq visibility_vis );
}
if ( keyup_called )
{
bitmapPrintf ( “Key Up %d: %
相关资源
- 微信商城系统源码---.NET平台
- QtitanRibbon含源码 试用版
- 人才系统源码
- Qt实现中文输入法面板集成谷歌输入法
- 安卓蓝牙app源码
- 自己写了一个火车票售卖系统,实现
- Unity圣典+UnityApi手册
- 家校通系统源码强大保证能用带数据
- 韦东山教程所有源码包
- CC2540/CC2541主从一体化透传源码支持串
- github上面B站源码
- OpenGL游戏程序设计+源码
- Robocup学习资料帮助手册基础源码合集
- 基于SNMP++提取进程内存使用,CPU占用
- caffe2源码
- 微电子电路第五版习题答案 Microelec
- 智能电话机器人源码,电销ai机器人源
- 海康流媒体开发包完整版含客户端源
- .net商品销售管理系统完整源码(进销
- .net经典会员管理项目完整源码(包含
- maxwell 16.0 官方教程
- spark-2.2.0源码
- vue资料 笔记 源码
- 小程序各行业模板源码
-
typesc
ript.zip - 消除游戏源码商用
- ddos资源 源代码!
- jdk1.8.0_121源码
- 严慧敏数据结构高清版及源码
- 千图千库等12网素材解析源码程序
评论
共有 条评论