資源簡(jiǎn)介
OPENGL可一走動(dòng)的人

代碼片段和文件信息
//?OpenGLStarter.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?“stdafx.h“
//需要包含的頭文件
#include?
#include?
#include?
#include?
//定義輸出窗口的大小
#define?WINDOW_HEIGHT?300
#define?WINDOW_WIDTH?500
//攝像機(jī)離物體的距離
float?G_fDistance?=?10.0f;
//物體的旋轉(zhuǎn)角度?
float?G_fAngle_horizon?=?0.0;
float?G_fAngle_vertical?=?0.0f;
float?G_fAngle_gebol=0.0f;
float?G_fAngle_gebol1=0.0f;
float?G_fAngle_tui=0.0f;
float?G_fAngle_tui1=0.0f;
float?a=16.5f;
//光照參數(shù)
float?G_vLitAmbient[4]?=?{?16.8f?1.8f?0.8f?1.0f?};
float?G_vLitDiffuse[4]?=?{?25.8f?0.75f?0.6f?1.0f?};
float?G_vLitSpecular[4]?=?{?30.5f?0.5f?1.5f?1.0f?};
float?G_vLitPosition[4]?=?{?-5.0f?0.0f?5.0f?1.0f?};
float?G_vMaterialSpecu[4]?=?{?1.0f?1.0f?1.0f?1.0f?};
/*float?G_vLitAmbient[4]?=?{?0.8f?0.8f?0.8f?1.0f?};
float?G_vLitDiffuse[4]?=?{?0.8f?0.75f?0.6f?1.0f?};
float?G_vLitSpecular[4]?=?{?0.5f?0.5f?0.5f?1.0f?};
float?G_vLitPosition[4]?=?{?-5.0f?0.0f?5.0f?1.0f?};
float?G_vMaterialSpecu[4]?=?{?1.0f?1.0f?1.0f?1.0f?};*/
////////////////////////////////////////////////
void?myinit(void);
void?CALLBACK?myReshape(GLsizei?w?GLsizei?h);
void?CALLBACK?display(void);
???//?void?CALLBACK?G_vLitPosition(void?void?void?void);
//響應(yīng)鍵盤輸入?從而設(shè)定物體移近移遠(yuǎn)以及旋轉(zhuǎn)的回調(diào)函數(shù)
void?CALLBACK?MoveNear(void);
void?CALLBACK?MoveFar(void);
void?CALLBACK?RotateLeft(void);
void?CALLBACK?RotateRight(void);
void?CALLBACK?RotateUp(void);
void?CALLBACK?RotateDown(void);
void?CALLBACK?Rotategeborzuo(void);
void?CALLBACK?Rotategeboryou(void);
void?CALLBACK?Rotatuizuo(void);
void?CALLBACK?Rotatuiyou(void);
void?CALLBACK?zoulu(void);
void?CALLBACK?guang(void);
void?CALLBACK?guang1(void);
////////////////////////////////////////////////
//主函數(shù)
int?main(int?argc?char*?argv[])
{
//初始化OPENGL顯示方式
????auxInitDisplayMode(AUX_DOUBLE?|?AUX_RGB);
//設(shè)定OPENGL窗口位置和大小
????auxInitPosition(0?0?WINDOW_WIDTH?WINDOW_HEIGHT);
//打開(kāi)窗口
????auxInitWindow(“OpenGL“);?//?window?title
//調(diào)用初始化函數(shù)
????myinit();
//設(shè)定窗口大小變化的回調(diào)函數(shù)
????auxReshapeFunc(myReshape);
//設(shè)定鍵盤控制的回調(diào)函數(shù)
????auxKeyFunc(‘A‘?MoveNear);
????auxKeyFunc(‘a(chǎn)‘?MoveFar);
auxKeyFunc(AUX_LEFT?RotateLeft);
????auxKeyFunc(AUX_RIGHT?RotateRight);
auxKeyFunc(AUX_UP?RotateUp);
????auxKeyFunc(AUX_DOWN?RotateDown);
auxKeyFunc(‘q‘Rotategeborzuo);//左胳膊旋轉(zhuǎn)
auxKeyFunc(‘w‘Rotategeboryou);//右胳膊旋轉(zhuǎn)
auxKeyFunc(‘p‘Rotatuizuo);//左腿旋轉(zhuǎn)
auxKeyFunc(‘o‘Rotatuiyou);//右腿旋轉(zhuǎn)
auxKeyFunc(‘z‘zoulu);//走路
auxKeyFunc(‘g‘guang);//光照變化
auxKeyFunc(‘h‘guang1);//
???
//使display函數(shù)一直被調(diào)用
//??auxIdleFunc(display);
//開(kāi)始OPENGL的循環(huán)g
????auxMainLoop(display);
return?0;
}
////////////////////////////////////////////////
//用戶初始化函數(shù)
void?myinit(void)
{
//your?initialization?code
//打開(kāi)深度檢測(cè)
glEnable(GL_DEPTH_TEST);
}
//窗口大小變化時(shí)的回調(diào)函數(shù)
void?CALLBACK?myReshape(GLsizei?w?GLsizei?h)
{
//設(shè)定視區(qū)
????glViewport(0?0?w?h);
/
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????7368??2007-12-30?00:11??ROBORT\OpenGLStarter.cpp
?????文件???????4679??2006-10-27?22:47??ROBORT\OpenGLStarter.dsp
?????文件????????551??2006-10-14?15:02??ROBORT\OpenGLStarter.dsw
?????文件??????91136??2008-01-26?19:37??ROBORT\OpenGLStarter.ncb
?????文件??????49664??2008-01-26?19:37??ROBORT\OpenGLStarter.opt
?????文件???????2617??2007-12-31?20:13??ROBORT\OpenGLStarter.plg
?????文件???????1250??2006-10-14?15:00??ROBORT\ReadMe.txt
?????文件????????300??2006-10-14?15:00??ROBORT\StdAfx.cpp
?????文件????????667??2006-10-14?15:00??ROBORT\StdAfx.h
?????文件????3367936??2007-12-31?20:13??ROBORT\Debug\OpenGLStarter.bsc
?????文件?????241770??2007-12-31?20:13??ROBORT\Debug\OpenGLStarter.exe
?????文件?????532372??2007-12-31?20:13??ROBORT\Debug\OpenGLStarter.ilk
?????文件??????60710??2007-12-31?20:13??ROBORT\Debug\OpenGLStarter.obj
?????文件?????187184??2007-12-06?13:47??ROBORT\Debug\OpenGLStarter.pch
?????文件?????672768??2007-12-31?20:13??ROBORT\Debug\OpenGLStarter.pdb
?????文件??????????0??2007-12-31?20:13??ROBORT\Debug\OpenGLStarter.sbr
?????文件???????2167??2007-12-06?13:47??ROBORT\Debug\StdAfx.obj
?????文件????????275??2007-12-06?13:47??ROBORT\Debug\StdAfx.sbr
?????文件?????156672??2008-01-26?19:34??ROBORT\Debug\vc60.idb
?????文件?????233472??2007-12-31?20:13??ROBORT\Debug\vc60.pdb
?????目錄??????????0??2008-05-25?15:11??ROBORT\Debug
?????目錄??????????0??2008-05-25?15:11??ROBORT
-----------?---------??----------?-----??----
??????????????5613558????????????????????22
- 上一篇:雙積分AD仿真
- 下一篇:基于小波變換的彩色圖像分割
評(píng)論
共有 條評(píng)論