資源簡介
opengl圓柱貼圖程序,vc++6.0版本,可以直接運行。
代碼片段和文件信息
/*
?* This?Code?Was?Created?By?Jeff?Molofee?2000
?* A?HUGE?Thanks?To?Fredric?Echols?For?Cleaning?Up
?* And?Optimizing?This?Code?Making?It?More?Flexible!
?* If?You‘ve?Found?This?Code?Useful?Please?Let?Me?Know.
?* Visit?My?Site?At?nehe.gamedev.net
?*/
#include? //?Header?File?For?Windows
#include? //?Header?File?For?The?OpenGL32?Library
#include? //?Header?File?For?The?GLu32?Library
#include? //?Header?File?For?The?Glaux?Library
#include?
#include?
HDC hDC=NULL; //?Private?GDI?Device?Context
HGLRC hRC=NULL; //?Permanent?Rendering?Context
HWND hWnd=NULL; //?Holds?Our?Window?Handle
HINSTANCE hInstance; //?Holds?The?Instance?Of?The?Application
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
LRESULT CALLBACK?WndProc(HWND?UINT?WPARAM?LPARAM); //?Declaration?For?WndProc
GLvoid?ReSizeGLScene(GLsizei?width?GLsizei?height) //?Resize?And?Initialize?The?GL?Window
{
if?(height==0) //?Prevent?A?Divide?By?Zero?By
{
height=1; //?Making?Height?Equal?One
}
glViewport(00widthheight); //?Reset?The?Current?Viewport
glMatrixMode(GL_PROJECTION); //?Select?The?Projection?Matrix
glLoadIdentity(); //?Reset?The?Projection?Matrix
//?Calculate?The?Aspect?Ratio?Of?The?Window
gluPerspective(45.0f(GLfloat)width/(GLfloat)height0.1f100.0f);
glMatrixMode(GL_MODELVIEW); //?Select?The?Modelview?Matrix
glLoadIdentity(); //?Reset?The?Modelview?Matrix
}
GLfloat?fpoint[45][45][3]?=?{0};
GLfloat?step?=?1.0/45.0;
void?InitPoint()
{
for(GLuint?i?=?0;?i?45;?i++)
{
for(GLuint?j?=?0;?j?45;?j++)
{
fpoint[i][j][0]?=?(GLfloat)(i)/5.0?-?4.5;
fpoint[i][j][1]?=?(GLfloat)(j)/5.0?-?4.5;
fpoint[i][j][2]?=?/*sin(3.14*3/45*i)*/4.0/3.14;
}
}
}
void?SwapPoint()
{
static?float?ste?=?0.0;
for(GLuint?i?=?0;?i?45;?i++)
{
for(GLuint?j?=?0;?j?45;?j++)
{
//fpoint[i][j][2]?=?sqrt(4.5*4.5-fpoint[i][j][0]*fpoint[i][j][0]?-?fpoint[i][j][1]*fpoint[i][j][1]);
fpoint[i][j][2]?=?sin(3.14*3/45*i?+?ste);
}
}
ste?+=?0.01;
}
//?GLfloat?R?=?4.5/3.14;
//?
//?void?SwapPool()
//?{
//? GLfloat?a?=?0.0;
//? GLfloat?stp?=?9.0/45.0;
//? GLfloat?start_y?=?-4.5;
//?
//? for(GLuint?i?=?0;?i?45;?i++)
//? {
//? start_y?+=?stp;
//? for(GLuint?j?=?0;?j?45;?j++)
//? {
//? fpoint[i][j][0]?=?R?*?sin(a);
//? fpoint[i][j][1]?=?start_y;
//? fpoint[i][j][2] =?R?*?cos(a);
//? a?+=?2?*?3.14?/?45;
//? }
//? }
//?}
void?SwapPool()
{
GLint?r?=5;
for(GLuint?i?=?0;?i?45;?i++)
{
GLfloat?step?=?0.0;
for(GLuint?j?=?0;?j?45;?j++)
{
step?=?3.1415926*2/45*(j+1);
fpoint[i][j][0]?=r*cos(step);
fpoint[i][j][1]?=(GLfloat)(i)/5.0?-?4.5;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-12-18?22:04??openGL圓柱貼圖顯示\
?????目錄???????????0??2014-12-18?22:04??openGL圓柱貼圖顯示\Debug\
?????文件????????9924??2012-10-24?20:48??openGL圓柱貼圖顯示\Debug\BuildLog.htm
?????文件???????29124??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\CL.read.1.tlog
?????文件?????????808??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\CL.write.1.tlog
?????文件???????58399??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\Lesson1.obj
?????文件????????1450??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\cl.command.1.tlog
?????文件????????2967??2014-07-19?16:19??openGL圓柱貼圖顯示\Debug\lesson1.Build.CppClean.log
?????文件??????510976??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\lesson1.exe
?????文件?????????406??2014-07-19?16:19??openGL圓柱貼圖顯示\Debug\lesson1.exe.em
?????文件?????????472??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\lesson1.exe.em
?????文件?????????381??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\lesson1.exe.intermediate.manifest
?????文件?????1380320??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\lesson1.ilk
?????文件??????????87??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\lesson1.lastbuildstate
?????文件????????4477??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\lesson1.log
?????文件?????2558976??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\lesson1.pdb
?????文件?????????210??2014-07-19?16:19??openGL圓柱貼圖顯示\Debug\lesson1_manifest.rc
?????文件???????????2??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\li
?????文件???????????2??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\li
?????文件???????????2??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\li
?????文件???????????2??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\li
?????文件???????????2??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\li
?????文件???????????2??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\li
?????文件????????4574??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\li
?????文件???????11952??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\li
?????文件????????1834??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\li
?????文件?????????820??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\mt.command.1.tlog
?????文件??????????67??2012-10-24?20:48??openGL圓柱貼圖顯示\Debug\mt.dep
?????文件?????????710??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\mt.read.1.tlog
?????文件?????????422??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\mt.write.1.tlog
?????文件????????1154??2014-12-18?21:56??openGL圓柱貼圖顯示\Debug\rc.command.1.tlog
............此處省略36個文件信息
評論
共有 條評論