opengl圆柱贴图程序,可以直接运行


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圆柱贴图显示DebugBuildLog.htm
     文件       29124  2014-12-18 21:56  openGL圆柱贴图显示DebugCL.read.1.tlog
     文件         808  2014-12-18 21:56  openGL圆柱贴图显示DebugCL.write.1.tlog
     文件       58399  2014-12-18 21:56  openGL圆柱贴图显示DebugLesson1.obj
     文件        1450  2014-12-18 21:56  openGL圆柱贴图显示Debugcl.command.1.tlog
     文件        2967  2014-07-19 16:19  openGL圆柱贴图显示Debuglesson1.Build.CppClean.log
     文件      510976  2014-12-18 21:56  openGL圆柱贴图显示Debuglesson1.exe
     文件         406  2014-07-19 16:19  openGL圆柱贴图显示Debuglesson1.exe.embed.manifest
     文件         472  2014-12-18 21:56  openGL圆柱贴图显示Debuglesson1.exe.embed.manifest.res
     文件         381  2014-12-18 21:56  openGL圆柱贴图显示Debuglesson1.exe.intermediate.manifest
     文件     1380320  2014-12-18 21:56  openGL圆柱贴图显示Debuglesson1.ilk
     文件          87  2014-12-18 21:56  openGL圆柱贴图显示Debuglesson1.lastbuildstate
     文件        4477  2014-12-18 21:56  openGL圆柱贴图显示Debuglesson1.log
     文件     2558976  2014-12-18 21:56  openGL圆柱贴图显示Debuglesson1.pdb
     文件         210  2014-07-19 16:19  openGL圆柱贴图显示Debuglesson1_manifest.rc
     文件           2  2014-12-18 21:56  openGL圆柱贴图显示Debuglink-cvtres.read.1.tlog
     文件           2  2014-12-18 21:56  openGL圆柱贴图显示Debuglink-cvtres.write.1.tlog
     文件           2  2014-12-18 21:56  openGL圆柱贴图显示Debuglink.2232-cvtres.read.1.tlog
     文件           2  2014-12-18 21:56  openGL圆柱贴图显示Debuglink.2232-cvtres.write.1.tlog
     文件           2  2014-12-18 21:56  openGL圆柱贴图显示Debuglink.2232.read.1.tlog
     文件           2  2014-12-18 21:56  openGL圆柱贴图显示Debuglink.2232.write.1.tlog
     文件        4574  2014-12-18 21:56  openGL圆柱贴图显示Debuglink.command.1.tlog
     文件       11952  2014-12-18 21:56  openGL圆柱贴图显示Debuglink.read.1.tlog
     文件        1834  2014-12-18 21:56  openGL圆柱贴图显示Debuglink.write.1.tlog
     文件         820  2014-12-18 21:56  openGL圆柱贴图显示Debugmt.command.1.tlog
     文件          67  2012-10-24 20:48  openGL圆柱贴图显示Debugmt.dep
     文件         710  2014-12-18 21:56  openGL圆柱贴图显示Debugmt.read.1.tlog
     文件         422  2014-12-18 21:56  openGL圆柱贴图显示Debugmt.write.1.tlog
     文件        1154  2014-12-18 21:56  openGL圆柱贴图显示Debug
c.command.1.tlog
............此处省略36个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)