资源简介
三维立体STY字母模型,可旋转移动等。字母S可动。代码比较简单。

代码片段和文件信息
/*
* WireframeScene.c
*
* Author: Samuel R. Buss
*
* Bug reports: Sam Buss sbuss@ucsd.edu.
*
* base code for homework project #3 Math 155A Spring 2005
*
* USAGE: Please keep these controls in your homework assignment!!! (请保持以下控制不变!!!)
*
* Press arrow keys to control view position. (用方向键控制视点位置)
* left and right keys rotate the viewpoint left and right (向左和向右箭头分别将视点向左和向右旋转)
* Up and down keys rotate viewpoint up and down (up to 80 degrees).(向上和向下箭头分别将视点向上和向下旋转(最多转80度))
*
* Press “R“ key to make step size bigger (if moving too slowly) (按“R“键使得步长增大(如果觉得移动太慢的话按此键))
* Press “r“ key to make step size smaller (if moving too fast).(按“r“键使得步长减小(如果觉得移动太快的话按此键))
*
* Press “w“ key to toggle wireframe mode on and off (按“w“键来切换线框模式开关)
*
* Press “M“ “m“ to increase decrease Mesh Resolution (按“M““m“键来增加或减小网格分辨率)
*
* Press “c“ to toggle culling backfaces.(按“c“来剔除背面)
*
* Press ESCAPE to exit.(按ESC键退出)
*
*/
#include // For math routines (such as sqrt & trig). (为使用数学函数(如sqrt和trig))
#include
#include // For the “exit“ function (为使用exit函数)
#include // OpenGL Graphics Utility Library
#include “WireframeScene.h“
// The next global variable controls the animation‘s state and speed.(下面的全局变量控制动画的状态和速度)
float RotateAngle = 0.0f; // Angle in degrees of rotation around y-axis (绕y轴旋转的角度)
float Azimuth = 0.0; // Rotated up or down by this amount (向上或向下旋转的角度)
float AngleStepSize = 3.0f; // Step three degrees at a time (旋转视点时步长为3度)
const float AngleStepMax = 10.0f; // 步长最大值
const float AngleStepMin = 0.1f; // 步长最小值
// Some global state variables (一些全局状态变量)
int MeshCount = 6; // The mesh resolution for the mushroom top (蘑菇顶的网格分辨率)
int WireframeOn = 1; // == 1 for wire frame mode (==1时为线框模式)
int CullBackFacesOn = 0; // == 1 if culling back faces.(==1时剔除背面)
const int MeshCountMin = 3; // 网格分辨率最小值
// Animation (动画相关的控制变量)
const float timeStep = 0.01;
float t = 0;
// glutKeyboardFunc is called below to set this function to handle
// all “normal“ key presses.(处理普通按键事件的函数)
void myKeyboardFunc( unsigned char key int x int y )
{
switch ( key ) {
case ‘c‘:// 面剔除
CullBackFacesOn = 1-CullBackFacesOn;
if ( CullBackFacesOn ) {
glEnable( GL_CULL_FACE ); // Enable culling of back faces (开启面剔除(initRendering函数中已设置了剔除背面))
}
else {
glDisable( GL_CULL_FACE ); // Show all faces (front and back)(关闭面剔除,即显示所有面)
}
glutPostRedisplay();
break;
case ‘m‘:// 减小网格分辨率
MeshCount = (MeshCount>MeshCountMin) ? MeshCount-1 : MeshCount;
glutPostRedisplay();
break;
case ‘M‘:// 增加网格分辨率
MeshCount ++;
glutPostRedisplay();
break;
case ‘w‘: // 切换线框模式
WireframeOn = 1-WireframeOn;
if ( WireframeOn ) {
glPolygonMode ( GL_FRONT_AND_BACK GL_LINE ); // Just show wireframes (开启线框模式(通过设置多边形显示模式为GL_LINE))
}
else {
glPolygonMode ( GL_FRONT_AND_BACK GL_FILL ); // Show sol
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 40960 2010-06-23 02:25 STY孙滔佑 实验四\Debug\STY.exe
文件 662516 2010-06-23 02:25 STY孙滔佑 实验四\Debug\STY.ilk
文件 478208 2010-06-23 02:25 STY孙滔佑 实验四\Debug\STY.pdb
文件 6570 2010-06-23 02:25 STY孙滔佑 实验四\STY\Debug\BuildLog.htm
文件 67 2010-06-23 02:25 STY孙滔佑 实验四\STY\Debug\mt.dep
文件 663 2010-06-23 01:54 STY孙滔佑 实验四\STY\Debug\STY.exe.em
文件 728 2010-06-23 01:54 STY孙滔佑 实验四\STY\Debug\STY.exe.em
文件 621 2010-06-23 02:25 STY孙滔佑 实验四\STY\Debug\STY.exe.intermediate.manifest
文件 93184 2010-06-23 02:25 STY孙滔佑 实验四\STY\Debug\vc90.idb
文件 69632 2010-06-23 02:25 STY孙滔佑 实验四\STY\Debug\vc90.pdb
文件 43948 2010-06-23 02:25 STY孙滔佑 实验四\STY\Debug\Wirefr
文件 3986 2010-06-23 01:44 STY孙滔佑 实验四\STY\STY.vcproj
文件 1427 2010-06-23 09:34 STY孙滔佑 实验四\STY\STY.vcproj.SUNTAOYO-4DEB7C.suntaoyou.user
文件 14048 2010-06-23 02:25 STY孙滔佑 实验四\STY\Wirefr
文件 460 2010-05-28 10:00 STY孙滔佑 实验四\STY\Wirefr
文件 625664 2010-06-23 09:34 STY孙滔佑 实验四\STY.ncb
文件 875 2010-06-23 01:40 STY孙滔佑 实验四\STY.sln
..A..H. 9216 2010-06-23 09:34 STY孙滔佑 实验四\STY.suo
目录 0 2010-06-23 02:25 STY孙滔佑 实验四\STY\Debug
目录 0 2010-06-23 02:23 STY孙滔佑 实验四\Debug
目录 0 2010-06-23 02:25 STY孙滔佑 实验四\STY
目录 0 2010-06-23 09:33 STY孙滔佑 实验四
----------- --------- ---------- ----- ----
2052773 22
- 上一篇:局域网时间同步工具
- 下一篇:VC读取JPG的EXIF信息的一个类
相关资源
- OpenGL参考手册
- VisualStudioUninstaller vs卸载工具
- 组态王驱动开发包3.0.0.7(中文)
- 多窗口后台鼠标连点器
- 使用选择性重传协议实现UDP可靠通信
- VC 获得文件属性 获取文件的创建时
- 读者写者问题(读者优先,写者优先
- 用VC 编写的仿QQ聊天室程序源代码
- 外点法程序
- 外罚函数程序
- Qt Creator opengl实现四元数鼠标控制轨迹
- qt-电子点菜系统
- 推箱子及人工智能寻路C 源代码
- OpenGL文档,api大全,可直接查询函数
- 自己写的航空订票系统c 版--数据结构
- 数据结构实验魔王语言
- MUSIC算法c 实现
- C 餐厅叫号系统(QT平)
- opengl轮廓字体源代码
- 国际象棋c 完整版
-
ob
jectARX给Auto CAD加工具条 - MFC读三维模型obj文件
- 画图程序MFC/VC/VC CRectTracker 串行化
- MFC网络编程实例
- c 课程设计 职工信息管理系统
- VC 游戏编程—附源代码
- IpHlpApi.h&IpHlpApi.lib
- 清华大学 c 郑莉 ppt课件
- c 程序判断离散数学中命题公式
- 利用OpenGL写毛笔字算法
评论
共有 条评论