计算机图形学视角、纹理
标签:
•
文件类型: .rar
•
文件大小: 15.14MB
•
下载次数: 1
•
东南大学计算机图形学中间某次作业,少了一些内容,实现了视角切换等
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 46465024 2015-01-05 12:37 test2ipch est2-2809e542 est2-aaf1d2be.ipch
文件 324774 2014-12-15 23:32 test2 est2k1.bmp
文件 1968 2015-01-05 12:37 test2 est2Debugcl.command.1.tlog
文件 49798 2015-01-05 12:37 test2 est2DebugCL.read.1.tlog
文件 640 2015-01-05 12:37 test2 est2DebugCL.write.1.tlog
文件 3708 2015-01-05 12:37 test2 est2Debuglink.command.1.tlog
文件 6216 2015-01-05 12:37 test2 est2Debuglink.read.1.tlog
文件 1128 2015-01-05 12:37 test2 est2Debuglink.write.1.tlog
文件 1226 2015-01-05 12:37 test2 est2Debugmt.command.1.tlog
文件 692 2015-01-05 12:37 test2 est2Debugmt.read.1.tlog
文件 294 2015-01-05 12:37 test2 est2Debugmt.write.1.tlog
文件 132181 2015-01-05 12:37 test2 est2Debug est.obj
文件 381 2015-01-05 12:37 test2 est2Debug est2.exe.intermediate.manifest
文件 70 2015-01-05 12:37 test2 est2Debug est2.lastbuildstate
文件 2322 2015-01-05 12:37 test2 est2Debug est2.log
文件 707 2015-01-02 14:11 test2 est2Debug est2.vcxprojResolveAssemblyReference.cache
文件 0 2015-01-02 14:11 test2 est2Debug est2.write.1.tlog
文件 560128 2015-01-05 12:37 test2 est2Debugvc100.idb
文件 290816 2015-01-05 12:37 test2 est2Debugvc100.pdb
文件 1264640 2015-01-02 13:38 test2 est2Debugvc110.idb
文件 405504 2015-01-02 13:38 test2 est2Debugvc110.pdb
文件 12065 2010-09-01 16:37 test2 est2glaux.h
文件 1312394 2005-10-19 15:55 test2 est2GLAUX.LIB
文件 234006 2014-12-15 16:07 test2 est2glext.h
文件 18282 2005-10-19 15:55 test2 est2GLU.H
文件 49514 2005-10-19 15:55 test2 est2GLU32.LIB
文件 27705 2011-11-07 13:55 test2 est2GLUT.H
文件 352998 2014-12-15 23:42 test2 est2mf2.bmp
文件 336274 2005-10-19 15:55 test2 est2OPENGL32.LIB
文件 22160 2015-01-05 09:48 test2 est2 est.cpp
............此处省略25个文件信息
#define GLUT_DISABLE_ATEXIT_HACK
#include
#include “glut.h“
#include
#include
#include
#include “glaux.h“
#include “GLU.h“
#include “Path.h“
using namespace std;
int axis; //马旋转轴编号
int axis2; //猫旋转轴编号
GLfloat theta[3] ={0.0 0.0 0.0}; //马每个轴的旋转角
GLfloat theta2[3] ={0.0 0.0 0.0}; //猫每个轴的旋转角
const int n = 1000;
GLfloat ax = -1.0f; //马的初始坐标
GLfloat ay = 0.0f;
GLfloat az = 0.0f;
GLfloat bx= 1.0f; //猫的初始坐标
GLfloat by = 0.0f;
GLfloat bz = 0.0f;
GLfloat cx= 1.0f; //猫的目标坐标
GLfloat cy = 0.0f;
GLfloat cz = 0.0f;
GLfloat mx = 1.0f; //马缩放倍数
GLfloat my = 1.0f;
GLfloat mz = 1.0f;
GLfloat nx = 1.0f; //猫缩放倍数
GLfloat ny = 1.0f;
GLfloat nz = 1.0f;
GLint view = 0;
GLfloat ex[4] = {0.0 0.0 0.00.01}; //观察者位置
GLfloat ey[4] = {1.0 0.0 0.04.0};
GLfloat ez[4] = {4.0 0.0 0.00.0};
GLfloat fx[4] = {0.0 0.0 0.00.0}; //观察对象位置
GLfloat fy[4] = {0.0 0.0 0.00.0};
GLfloat fz[4] = {0.0 0.0 0.00.0};
GLint flag;
const GLfloat Pi = 3.1415926536f; //圆周率
GLfloat Lox;
GLfloat xrot1; //x轴旋转角度
GLfloat yrot1; //y轴旋转角度
GLfloat zrot1; //z轴旋转角度
GLfloat Lox1;
GLuint texture[1]; //纹理命名空间
GLUquadricObj *quadratic; // 二次几何体
Path* path = new Path(00NULL);
Path* p = path;
AUX_RGBImageRec *LoadBMP(char *Filename) //加载位图图像
{
FILE *File = NULL; //文件句柄先设置为空
if (!Filename) //确定文件是否载入
{
return NULL; //如果没载入返回值为空
}
File = fopen(Filename “r“); //尝试打开文件
if (File) //文件存在吗
{
fclose(File); //关闭句柄
return auxDIBImageLoadA(Filename); //加载位图返回指针
}
return NULL; //加载失败返回空
}
int LoadGLTextures() //调用上面的代码转换成纹理
{
int Status = FALSE; //设置一个叫做 Status 的变量。我们使用它来跟踪是否能够载入位图以及能否创建纹理。
AUX_RGBImageRec *TextureImage[2]; //创建纹理存储空间
memset(TextureImage 0 sizeof(void *)* 2); //初始化
if ((TextureImage[0] = LoadBMP(“bk1.bmp“)) && // 加载背景图
(TextureImage[1] = LoadBMP(“mf2.bmp“))) // 反射图(球形纹理图)
Status = TRUE;
glGenTextures(2 &texture[0]); // 创建两个纹理
for (int i = 0; i < 2; i++)
{
//使用来自位图数据生成的典型纹理
glBindTexture(GL_TEXTURE_2D texture[i]);
//设置纹理属性
glTexImage2D(GL_TEXTURE_2D 0 3 TextureImage[i]->sizeX TextureImage[i]->sizeY 0 GL_RGB GL_UNSIGNED_BYTE TextureImage[i]->data);
glTexParameteri(GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER GL_LINEAR); //线性过滤
glTexParameteri(GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_LINEAR_MIPMAP_NEAREST); //相邻mipmaps层线性过滤
//创建mipmaps
gluBuild2DMipmaps(GL_TEXTURE_2D GL_RGB TextureImage[i]->sizeX TextureImage[i]->sizeY GL_RGB GL_UNSIGNED_BYTE TextureImage[i]->data);
glTexEnvi(GL_TEXTURE_ENV GL_TEXTURE_ENV_MODE GL_REPLACE); //设置纹理环为代替
}
for (int loop = 0; loop <= 1; loop++) //纹理是否存在
{
if (TextureImage[loop]) // 如果图像存在则清除
{
if (TextureImage[loop]->data)
{
free(TextureImage[loop]->data); //释放纹理图像占用的内存
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 46465024 2015-01-05 12:37 test2ipch est2-2809e542 est2-aaf1d2be.ipch
文件 324774 2014-12-15 23:32 test2 est2k1.bmp
文件 1968 2015-01-05 12:37 test2 est2Debugcl.command.1.tlog
文件 49798 2015-01-05 12:37 test2 est2DebugCL.read.1.tlog
文件 640 2015-01-05 12:37 test2 est2DebugCL.write.1.tlog
文件 3708 2015-01-05 12:37 test2 est2Debugli
文件 6216 2015-01-05 12:37 test2 est2Debugli
文件 1128 2015-01-05 12:37 test2 est2Debugli
文件 1226 2015-01-05 12:37 test2 est2Debugmt.command.1.tlog
文件 692 2015-01-05 12:37 test2 est2Debugmt.read.1.tlog
文件 294 2015-01-05 12:37 test2 est2Debugmt.write.1.tlog
文件 132181 2015-01-05 12:37 test2 est2Debug est.obj
文件 381 2015-01-05 12:37 test2 est2Debug est2.exe.intermediate.manifest
文件 70 2015-01-05 12:37 test2 est2Debug est2.lastbuildstate
文件 2322 2015-01-05 12:37 test2 est2Debug est2.log
文件 707 2015-01-02 14:11 test2 est2Debug est2.vcxprojResolveAssemblyReference.cache
文件 0 2015-01-02 14:11 test2 est2Debug est2.write.1.tlog
文件 560128 2015-01-05 12:37 test2 est2Debugvc100.idb
文件 290816 2015-01-05 12:37 test2 est2Debugvc100.pdb
文件 1264640 2015-01-02 13:38 test2 est2Debugvc110.idb
文件 405504 2015-01-02 13:38 test2 est2Debugvc110.pdb
文件 12065 2010-09-01 16:37 test2 est2glaux.h
文件 1312394 2005-10-19 15:55 test2 est2GLAUX.LIB
文件 234006 2014-12-15 16:07 test2 est2glext.h
文件 18282 2005-10-19 15:55 test2 est2GLU.H
文件 49514 2005-10-19 15:55 test2 est2GLU32.LIB
文件 27705 2011-11-07 13:55 test2 est2GLUT.H
文件 352998 2014-12-15 23:42 test2 est2mf2.bmp
文件 336274 2005-10-19 15:55 test2 est2OPENGL32.LIB
文件 22160 2015-01-05 09:48 test2 est2 est.cpp
............此处省略25个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)