資源描述:
《opengl繪制教室大作業(yè)源代碼wp》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、wp.h#include//Windows的頭文件#include//包含OpenGL實(shí)用庫#include//標(biāo)準(zhǔn)輸入/輸出庫的頭文件#include//GLaux庫的頭文件#include#include#include#include//..................................定義變量區(qū)..........................
2、..................................////.............................用于場(chǎng)景漫游有關(guān)變量........................................//GLfloatxrot=0.0f;//X旋轉(zhuǎn)量GLfloatyrot=0.0f;//Y旋轉(zhuǎn)量GLfloatx=0.0f;//X平移量GLfloaty=0.0f;//Y平移量GLfloatz=-40.0f;//深入屏幕的距離//.............................用
3、于鍵盤操作有關(guān)變量.......................................//BOOLlight=TRUE;//光源的開/關(guān)BOOLlp;//L鍵按下了么?BOOLfp;//F鍵按下了么?BOOLTurnOn=FALSE;//開燈GLUquadricObj*qobj;intfantheta=0;//風(fēng)扇轉(zhuǎn)過角度HGLRChRC=NULL;//窗口著色描述表句柄HDChDC=NULL;//OpenGL渲染描述表句柄HWNDhWnd=NULL;//保存我們的窗口句柄HINSTANCEhInstance
4、;//保存程序的實(shí)例boolkeys[256];//保存鍵盤按鍵的數(shù)組boolactive=TRUE;//窗口的活動(dòng)標(biāo)志,缺省為TRUEboolfullscreen=TRUE;//全屏標(biāo)志缺省,缺省設(shè)定成全屏模式//.................................光照材質(zhì)有關(guān)變量......................................//GLfloatlight_Ambient[]={0.1f,0.1f,0.1f,1.0f};//環(huán)境光參數(shù)GLfloatlight_Diffuse[
5、]={1.0f,1.0f,0.45f,1.0f};//漫射光參數(shù)GLfloatlight_position[]={0.0,29.9,0.0,1.0};//光源位置GLfloatlight_position1[]={20.0,29.9,0.0,1.0};GLfloatmat_ambient[]={0.05f,0.05f,0.05f,1.0f};//材質(zhì)環(huán)境光參數(shù)GLfloatmat_specular[]={0.8,1.0,1.0,1.0};//材質(zhì)鏡面光參數(shù)GLfloatmat_shininess[]={5.0};GLf
6、loatwhite_light[]={1.0,1.0,1.0,1.0};//光GLfloatno_mat[]={0.0f,0.0f,0.0f,1.0f};//無材質(zhì)色GLfloatno_shininess[]={0.0f};//無反光GLfloatmat_diffuse[]={1.0f,1.0f,1.0f,1.0f};//漫反射GLfloatdiffusion[]={0.521f,0.121f,0.0547f,1.0};//......................................紋理........
7、...................................................//GLuinttexture[6];//7種紋理的儲(chǔ)存空間//.....................................時(shí)鐘有關(guān)變量...................................................//GLfloatcx=35.0,cy=15.0,cz=-79.9,radius=5.0;GLfloathradius=2.0,mradius=3.0,sradius=4
8、.0;GLfloatsangle,mangle,hangle;GLuintsecond,miniter,hour;chartimebuffer[9];LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);//WndProc的定義wp.cpp#include"wp.h"http://.........