#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <gl/glaux.h>
#include <stdio.h>
#include <io.h>
#include <math.h>
#include <math.h> // Header File For Windows Math Library
#include <iostream>
#include <string>
#include <strstream>
#include <sstream>
using namespace std;
using namespace :: std;
inline std::string IntToString(int i)
{
std::stringstream ss;
ss<< i;
return ss.str();
}
char* filePath = (char*)malloc(MAX_PATH);
char* filePath1 = (char*)malloc(MAX_PATH);
char* filePath2 = (char*)malloc(MAX_PATH);
BOOL getMediaFileName(LPSTR szName)
{
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = NULL;
ofn.lpstrFilter = NULL;
//ofn.lpstrFilter = "Video files (*.mpg; *.3gp; *.mp4)\0*.mpg; *.mpeg; *.mp4\0\0";
//ofn.lpstrFilter = "Audio files (*.mp3; *.wma; *.amr)\0*.mp3; *.wma; *.amr\0\0";
//ofn.lpstrFilter = "Image files (*.jpg; *.gif; *.bmp)\0*.jpg; *.gif; *.bmp\0\0";
//ofn.lpstrFilter = "Chess files (*.cnd)\0*.cnd\0\0";
//ofn.lpstrDefExt = "CND";
ofn.lpstrCustomFilter = NULL;
ofn.nFilterIndex = 1;
*szName = 0;
ofn.lpstrFile = szName;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = NULL;
ofn.lpstrFileTitle = NULL;
ofn.Flags = OFN_PATHMUSTEXIST;
return GetOpenFileName((LPOPENFILENAME)&ofn);
}
//add bygai
HWND hWnd;
HDC hDC;
HGLRC hRC=NULL; //定义渲染环境
HINSTANCE hInstance; //得到程序的例子
RECT rect;
int h,v;
double i;
int k;
float chaV;
float chaH;
float savespeedx=0;
float savespeedy=0;
bool flag=false;
float j_shuiping=0;
float j_chuizhi=0;
float k_shuiping=0;
float k_chuizhi=0;
int Hspeed[8],Vspeed[8];
int time[4];
int sw = 1024;
int sh = 768;
float speedx=0.0f;
float speedy=0.0f;
bool cont;
float shuiping=0.0f,chuizhi=0.0f;//add by yy
float Hfreq,Vfreq;
float saveoldx=0.0f,saveoldy=0.0f;
float savex=0.0f,savey=0.0f;
bool fullscreen = 1;
GLfloat aspect;
GLfloat xrot; // X轴旋转 ( 新 )
GLfloat yrot; // Y轴旋转 ( 新 )
GLfloat zrot; // Z轴旋转 ( 新 )
GLuint texture[1]; //纹理的存储空间 ( 新 )
GLuint texture1[1];//add by yy //纹理的存储空间 ( 新 )
GLuint texture2[1];//add by yy //纹理的存储空间 ( 新 )
GLuint texture3[1];//add by yy //纹理的存储空间 ( 新 )
GLuint texture4[1];//add by yy //纹理的存储空间 ( 新 ) //add gai
bool keys[256]; // Array Used For The Keyboard Routine
bool active=TRUE; // Window Active Flag Set To TRUE By Default
//bool fullscreen=TRUE; // Fullscreen Flag Set To Fullscreen Mode By Default
GLuint base; // Base Display List For The Font
//GLuint texture[2]; // Storage For Our Font Texture
GLuint loop; // Generic Loop Variable
GLfloat cnt1; // 1st Counter Used To Move Text & For Coloring
GLfloat cnt2; // 2nd Counter Used To Move Text & For Coloring
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration For WndProc
#pragma comment( lib, "opengl32.lib" ) // 链接时使用OpenGL32.lib
#pragma comment( lib, "glu32.lib" ) // 链接时使用GLu32.lib
#pragma comment( lib, "glaux.lib" ) // 链接时使用GLaux.lib
AUX_RGBImageRec *LoadBMP(char *Filename) // 读取位图图象
{
FILE *File=NULL; // 文件句柄
if (!Filename) // 确定文件名已给出
{
return NULL; // 如果文件名未给出则返回NULL
}
File=fopen(Filename,"r"); // 检测文件是否存在
if (File) // 文件是否存在?
{
fclose(File); // 关闭文件
return auxDIBImageLoad(Filename); // 读取位图并返回一个指针
}
return NULL; //如果调用文件失败则返回NULL
}
/*
/////////////
name LoadFontTextures
fuction
load Font textures sprate from loading map,
*/
int LoadFontTextures() //调用Bitmap并转换成纹理
{
int Status=FALSE; //状态确定
AUX_RGBImageRec *TextureImage4[1];//add by yy //为纹理创建存储空间 //add gai
memset(TextureImage4,0,sizeof(void *)*1); //将指针设为NULL //add gai
if (TextureImage4[0]=LoadBMP("Data/Font.bmp")) //add gai
{
Status=TRUE; //设Status为TRUE
glGenTextures(1, &texture4[0]); //创建纹理
//用位图中的数据进行典型的纹理生成
glBindTexture(GL_TEXTURE_2D, texture4[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage4[0]->sizeX, TextureImage4[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage4[0]->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
if (TextureImage4[0]) //纹理是否存在
{
if (TextureImage4[0]->data) //纹理图象是否存在
{
free(TextureImage4[0]->data); //释放纹理图象所占用内存
}
free(TextureImage4[0]); //释放图象结构
}
return Status;
}
int LoadGLTextures() //调用Bitmap并转换成纹理
{
int Status=FALSE; //状态确定
AUX_RGBImageRec *TextureImage[1]; //为纹理创建存储空间
AUX_RGBImageRec *TextureImage1[1];//add by yy //为纹理创建存储空间
AUX_RGBImageRec *TextureImage2[1];//add by yy //为纹理创建存储空间
AUX_RGBImageRec *TextureImage3[1];//add by yy //为纹理创建存储空间
// AUX_RGBImageRec *TextureImage4[1];//add by yy //为纹理创建存储空间 //add gai
string c1,c2,c3;
c1=IntToString(sw);
c2=IntToString(sh);
c3="你选择的不是"+c1+"*"+c2+"图片"+","+"确定选择这个图片吗?";
memset(TextureImage,0,sizeof(void *)*1); //将指针设为NULL
memset(TextureImage1,0,sizeof(void *)*1); //将指针设为NULL
memset(TextureImage2,0,sizeof(void *)*1); //将指针设为NULL
memset(TextureImage3,0,sizeof(void *)*1); //将指针设为NULL
// memset(TextureImage4,0,sizeof(void *)*1); //将指针设为NULL //add gai
// getMediaFileName(filePath); //get bmp path gai
while(0)
{
if (TextureImage[0]=LoadBMP(filePath))
{
if((TextureImage[0]->sizeX==sw)&&(TextureImage[0]->sizeY==sh))
break;
if((TextureImage[0]->sizeX!=sw)&&(TextureImage[0]->sizeY!=sh))
//if (MessageBox(NULL,c3.c_str(), "确定选择",MB_YESNO|MB_ICONQUESTION)==IDOK
break;
// c1=c2;
getMediaFileName(filePath); //get bmp path
}
}
//读取位图,检查错误。如果位图不存在则退出
if(filePath==NULL)
{
MessageBox(NULL,"load BMP again Press F4", "Reload BMP?",MB_YESNO|MB_ICONQUESTION);
return 0;
}
if (TextureImage[0]=LoadBMP(filePath))
{
Status=TRUE; //设Status为TRUE
glGenTextures(1, &texture[0]); //创建纹理
//用位图中的数据进行典型的纹理生成
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
/*
//////////////////////////////////////////////////////////
// add by yy
if (TextureImage1[0]=LoadBMP(filePath))
{
Status=TRUE; //设Status为TRUE
glGenTextures(1, &texture1[0]); //创建纹理
//用位图中的数据进行典型的纹理生成
glBindTexture(GL_TEXTURE_2D, texture1[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage1[1]->sizeX, TextureImage1[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage1[0]->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}
if (TextureImage1[0]) //纹理是否存在
{
if (TextureImage1[0]->data) //纹理图象是否存在
{
free(TextureImage1[0]->data); //释放纹理图象所占用内存
}
free(TextureImage1[0]); //释放图象结构
}
/////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
// add by yy
if (TextureImage2[0]=LoadBMP(filePath))
{
Statu
没有合适的资源?快使用搜索试试~ 我知道了~
VC 连续打开三个图片
共38个文件
bmp:7个
ico:2个
dsp:2个
需积分: 3 31 下载量 193 浏览量
2010-01-08
14:34:09
上传
评论
收藏 2.28MB RAR 举报
温馨提示
VC 源代码 连续打开三个图片。F1 F2 F3 切换三个图片。要好的显卡呦!
资源推荐
资源详情
资源评论
收起资源包目录
FULL-Screen_load_bmp.rar (38个子文件)
FULL-Screen_load_bmp
fdsfsad.PRI 4KB
resource.h 456B
Data
25.bmp 5.93MB
TX.bmp 2.93MB
Font.bmp 65KB
50.bmp 5.93MB
Thumbs.db 27KB
TX1.bmp 192KB
TX2.bmp 6.59MB
1.bmp 5.93MB
fdsfsad.IAD 368B
newogl6.plg 248B
fdsfsad.SearchResults 298B
Script2.aps 20KB
fdsfsad.WK3 24KB
newogl6.dsp 4KB
lesson6.dsp 3KB
newogl6.ncb 81KB
newogl6.dep 183B
fdsfsad.PO 776B
lesson6.plg 918B
fdsfsad.PR 1KB
newogl6.opt 51KB
Script1.aps 17KB
lesson6.opt 48KB
lesson6.cpp 39KB
newogl6.dsw 537B
fdsfsad.IAB 4KB
Script2.rc 2KB
fdsfsad.PS 20KB
newogl6.mak 4KB
lesson6.ncb 41KB
fdsfsad.IMD 368B
fdsfsad.PFI 8B
Script1.rc 2KB
28.ICO 4KB
icon1.ico 766B
fdsfsad.IMB 4KB
共 38 条
- 1
资源评论
wanligai
- 粉丝: 2
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 奥迪A8D4仪表开机报文
- apache-skywalking-java-agent 8.8.0-9.2.0,一共12个版本
- DTS7001-VB一款SOT23封装P-Channel场效应MOS管
- ZTE-C300 OLT常用命令
- 6666666666666666
- DTS6410-VB一款SOT23封装N-Channel场效应MOS管
- SpyGlass-PowerVerifyMethodology-GuideWare2.0-UserGuide
- DTS6401-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- 基于树莓派、OpenCV及Python语言的人脸识别-i
- 游戏开发 UE蓝图 分支(Branch)节点和源码.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功