91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.7MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2024-01-27
  • 語言: 其他
  • 標簽: OpenGL??3D??

資源簡介

OpenGL 3D 貪吃蛇程序,適合初學者學習

資源截圖

代碼片段和文件信息

//?example003.cpp?:?定義控制臺應用程序的入口點。
//


/*==================================================================================*/
/*??????????????????????Computer?Graphics?Final?Project:?Snake??????????????????????*/
/*??????????????????????Prepared?By:?Salim?AWAD?????????????????????????????????????*/
/*-http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=254315*/
/*==================================================================================*/

/*Include?Files*/
#include?“stdafx.h“

#include?
#include?
#include?
#include?

#define?UP?1
#define?Down?2
#define?LEFT?3
#define?RIGHT?4

//?Status?Variables
GLint???lvl??????=?1;
GLint???points?=?0;
GLint???size??=?0;
GLbyte??gameOver?=?true;
GLbyte??EnableLight?=?true;????

//?Snake?Variables
GLint???bodyPos[2][100]?=?{{}};
GLint???_x???????=?5;
GLint???_z???????=?10;
GLint???_oldX[2]?=?{};
GLint???_oldZ[2]?=?{};
GLbyte??direction??=?0;

//?Food?Variables
GLint???_bx??????=?0;
GLint???_bz??????=?0;

//?Screen?variables
GLint???_w???????=?800;
GLint???_h???????=?550;
GLint???_Giw?????=?0;
GLint???_Gih?????=?0;
GLint???_Gfw?????=?150;
GLint???_Gfh?????=?150;

//Variables?for?the?Camera?Angle
static?GLfloat?view_rotx=45.0F?;
static?GLfloat?view_roty=0.0F?;
static?GLfloat?view_rotz=0.0F?;

static?GLfloat?headRotation=90.0F?;
static?GLfloat?zoom=-300.0F?;

//?Variables?to?check?the?FPS
DWORD???g_dwLastFPS?=?0;
int g_nFPS?=?0?g_nframes?=?0;

//Configure?the?lightning
void?initLight()
{
????//Add?ambient?light
????GLfloat?ambientColor[]?=?{0.3f?0.4f?0.5f?1.0f};?
????glLightModelfv(GL_LIGHT_MODEL_AMBIENT?ambientColor);

????//Add?positioned?light
????GLfloat?lightColor0[]?=?{0.5f?0.5f?0.5f?1.0f};?
????GLfloat?lightPos0[]?=?{4.0f?0.0f?8.0f?1.0f};?
????glLightfv(GL_LIGHT0?GL_DIFFUSE?lightColor0);
????glLightfv(GL_LIGHT0?GL_POSITION?lightPos0);

????//Add?directed?light
????GLfloat?lightColor1[]?=?{0.5f?0.2f?0.2f?1.0f};?
????//Coming?from?the?direction?(-1?0.5?0.5)
????GLfloat?lightPos1[]?=?{-1.0f?0.5f?0.5f?0.0f};
????glLightfv(GL_LIGHT1?GL_DIFFUSE?lightColor1);
????glLightfv(GL_LIGHT1?GL_POSITION?lightPos1);
}

//initialize?the?first?configurations
void?Initialize(void)?
{
????glEnable(GL_DEPTH_TEST);
????glClearColor(0.7f?0.9f?1.0f?1.0f);?//Change?the?background?to?sky?blue
????if(EnableLight){
????????glEnable(GL_COLOR_MATERIAL);?//Enable?color
????????glEnable(GL_LIGHTING);?//Enable?lighting
????????glEnable(GL_LIGHT0);?//Enable?light?#0
????????glEnable(GL_LIGHT1);?//Enable?light?#1
????????glEnable(GL_NORMALIZE);?//Automatically?normalize?normals
????}
}

//Configure?window?resize
void?resize?(int?w?int?h)
{
????glViewport(0?0?w?h);
????glMatrixMode(GL_PROJECTION);
????glLoadIdentity();
????gluPerspective(45.0?(double)w?/?(double)h?1?800.0);
}

void?Write(char?*string){//Write?string?on?the?screen
??

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-03-11?12:23??example003\
?????目錄???????????0??2014-03-11?12:22??example003\debug\
?????文件???????49152??2014-03-11?12:06??example003\debug\example003.exe
?????文件??????391232??2014-03-11?12:06??example003\debug\example003.ilk
?????文件??????412672??2014-03-11?12:06??example003\debug\example003.pdb
?????目錄???????????0??2014-03-11?12:22??example003\example003\
?????文件?????4000768??2014-03-11?12:23??example003\example003.ncb
?????文件?????????895??2014-03-10?17:13??example003\example003.sln
?????文件????????9216??2014-03-10?17:16??example003\example003.suo
?????目錄???????????0??2014-03-11?12:22??example003\example003\Debug\
?????文件???????10086??2014-03-11?12:06??example003\example003\Debug\BuildLog.htm
?????文件?????????403??2014-03-11?12:02??example003\example003\Debug\example003.exe.embed.manifest
?????文件?????????468??2014-03-11?12:02??example003\example003\Debug\example003.exe.embed.manifest.res
?????文件?????????385??2014-03-11?12:06??example003\example003\Debug\example003.exe.intermediate.manifest
?????文件???????46761??2014-03-11?12:06??example003\example003\Debug\example003.obj
?????文件?????1179648??2014-03-11?12:02??example003\example003\Debug\example003.pch
?????文件??????????65??2014-03-11?12:06??example003\example003\Debug\mt.dep
?????文件???????11805??2014-03-11?12:02??example003\example003\Debug\stdafx.obj
?????文件??????183296??2014-03-11?12:06??example003\example003\Debug\vc80.idb
?????文件??????118784??2014-03-11?12:06??example003\example003\Debug\vc80.pdb
?????文件???????12540??2014-03-11?12:06??example003\example003\example003.cpp
?????文件????????4496??2014-03-10?17:13??example003\example003\example003.vcproj
?????文件????????1409??2014-03-11?12:06??example003\example003\example003.vcproj.zjc-PC.zjc.user
?????文件?????????968??2014-03-10?17:13??example003\example003\ReadMe.txt
?????文件?????????215??2014-03-10?17:13??example003\example003\stdafx.cpp
?????文件?????????314??2014-03-11?12:02??example003\example003\stdafx.h

評論

共有 條評論