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

  • 大小: 450KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-13
  • 語言: 其他
  • 標簽: opengl??

資源簡介

opengl通過鍵盤對3d圖像進行顏色,光照,旋轉等變化,VS2013上可運行,opengl通過鍵盤對3d圖像進行顏色,光照,旋轉等變化,opengl通過鍵盤對3d圖像進行顏色,光照,旋轉等變化,opengl通過鍵盤對3d圖像進行顏色,光照,旋轉等變化,opengl通過鍵盤對3d圖像進行顏色,光照,旋轉等變化,opengl通過鍵盤對3d圖像進行顏色,光照,旋轉等變化,opengl通過鍵盤對3d圖像進行顏色,光照,旋轉等變化,opengl通過鍵盤對3d圖像進行顏色,光照,旋轉等變化

資源截圖

代碼片段和文件信息

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

#include?“stdafx.h“
#include?
#include
#include
#include
#include
#include
#include

using?namespace?std;


GLfloat?position[]?=?{?1.0?1.0?5.0?0.0?};
void?init(void)
{

GLfloat?ambient[]?=?{?0.0?0.0?0.0?1.0?};
GLfloat?diffuse[]?=?{?1.0?1.0?1.0?1.0?};
GLfloat?specular[]?=?{?1.0?1.0?1.0?1.0?};

//光源位置


GLfloat?lmodel_ambient[]?=?{?0.2?0.2?0.2?1.0?};
GLfloat?local_view[]?=?{?0.0?};

glLightfv(GL_LIGHT0?GL_AMBIENT?ambient);
glLightfv(GL_LIGHT0?GL_DIFFUSE?diffuse);
glLightfv(GL_LIGHT0?GL_POSITION?position);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT?lmodel_ambient);
glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER?local_view);

glFrontFace(GL_CW);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_AUTO_NORMAL);
glEnable(GL_NORMALIZE);
glEnable(GL_DEPTH_TEST);
}
int?N?=?0;
GLfloat?mat[3][4]?=?{?{?0.1?0.1?0.1?}?{?0.5?0.1?0.9?}?{?0.3?0.9?0.9?}?};

void?display(void)
{


glClear(GL_COLOR_BUFFER_BIT?|?GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(4?8?0.0);
//teapot的顏色

glMaterialfv(GL_FRONT?GL_DIFFUSE?mat[N]);

glutSolidTeapot(3.0);

glPopMatrix();



glFlush();
}

void?reshape(int?w?int?h)
{
glViewport(0?0?(GLsizei)w?(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if?(w?<=?h)
glOrtho(0.0?16.0?0.0?16.0*(GLfloat)h?/?(GLfloat)w
-10.0?10.0);
else
glOrtho(0.0?16.0*(GLfloat)w?/?(GLfloat)h?0.0?16.0
-10.0?10.0);
glMatrixMode(GL_MODELVIEW);
}
void?rotation(int?x)
{
glRotatef(2?0.0f?1.0f?0.0f);
glutPostRedisplay();
glutTimerFunc(100?rotation?1);
}
void?keyboard(unsigned?char?key?int?x?int?y)
{
switch?(key)?{
case?‘a‘:
exit(0);
break;
case?27:
exit(0);
break;
}
if?(key?==?99)
{
glutPostRedisplay();
N++;
if?(N?>?3)
N?=?0;


}
if?(key?==?114){
glutTimerFunc(100?rotation?1);
cout?< }
}


void?keyboard1(int?key?int?x?int?y)
{
if?(key?==?GLUT_KEY_RIGHT)
{
position[0]?=?position[0]?+?0.5;
init();
glutPostRedisplay();
}
if?(key?==?GLUT_KEY_LEFT)
{
position[0]?=?position[0]?-?0.5;
init();
glutPostRedisplay();
}
if?(key?==?GLUT_KEY_UP)?{
position[1]?=?position[1]?+?0.5;
init();
glutPostRedisplay();
}
if?(key?==?GLUT_KEY_DOWN)
{
position[1]?=?position[1]?-?0.5;
init();
glutPostRedisplay();
}
}
/*void?obj::parse(const?char*filename)
{
string?s;
ifstream?fin(“cube.obj“);
if?(!fin)
return;
while?(fin?>>?s)
{
switch?(*s.c_str())
{
case‘v‘:
???{
???vertex?v;
???fin?>>?v.x?>>?v.y?>>?v.z;
? ???this->vertexs.push_back(v);
???}
break;
case‘f‘:
{
face?f;
fin?>>?f.v1?>>?f.v2?>>?f.v3;
faces.push_back(f);

}
break;

}

????????????
}
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????29264??2005-08-29?13:03??pratice\bunny_1k.obj

?????文件???????5410??2005-08-29?13:03??pratice\bunny_200.obj

?????文件????????172??2005-08-29?13:03??pratice\cube.obj

?????文件????????949??2017-09-06?17:43??pratice\Debug\pratice.Build.CppClean.log

?????文件???????2753??2017-09-10?19:44??pratice\Debug\pratice.log

?????文件?????180209??2017-09-10?19:44??pratice\Debug\pratice.obj

?????文件????1638400??2017-09-06?17:43??pratice\Debug\pratice.pch

?????文件???????1898??2017-09-10?19:44??pratice\Debug\pratice.tlog\cl.command.1.tlog

?????文件??????18044??2017-09-10?19:44??pratice\Debug\pratice.tlog\CL.read.1.tlog

?????文件???????1078??2017-09-10?19:44??pratice\Debug\pratice.tlog\CL.write.1.tlog

?????文件???????2036??2017-09-10?19:44??pratice\Debug\pratice.tlog\link.command.1.tlog

?????文件???????3880??2017-09-10?19:44??pratice\Debug\pratice.tlog\link.read.1.tlog

?????文件????????572??2017-09-10?19:44??pratice\Debug\pratice.tlog\link.write.1.tlog

?????文件????????168??2017-09-10?19:44??pratice\Debug\pratice.tlog\pratice.lastbuildstate

?????文件??????11169??2017-09-06?17:43??pratice\Debug\stdafx.obj

?????文件?????543744??2017-09-10?19:44??pratice\Debug\vc120.idb

?????文件?????503808??2017-09-10?19:44??pratice\Debug\vc120.pdb

?????文件????????225??2017-09-06?17:06??pratice\packages.config

?????文件???????3760??2017-09-10?19:46??pratice\pratice.cpp

?????文件???????5035??2017-09-10?15:08??pratice\pratice.vcxproj

?????文件???????1474??2017-09-10?15:08??pratice\pratice.vcxproj.filters

?????文件???????2329??2017-09-10?20:01??pratice\ReadMe.txt

?????文件????????351??2017-09-10?15:41??pratice\readobj.h

?????文件????????213??2017-09-06?17:01??pratice\stdafx.cpp

?????文件????????234??2017-09-06?17:01??pratice\stdafx.h

?????文件????????236??2017-09-06?17:01??pratice\targetver.h

?????目錄??????????0??2017-09-10?19:44??pratice\Debug\pratice.tlog

?????目錄??????????0??2017-09-10?19:44??pratice\Debug

?????目錄??????????0??2017-09-10?20:01??pratice

-----------?---------??----------?-----??----

............此處省略2個文件信息

評論

共有 條評論