• 大小: 2.91MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-15
  • 语言: 其他
  • 标签: OpenGL  

资源简介

在一个漫天飘雪的冬天,一个孤零零的雪人,伴着天空之城的背景音,让人陷入了无限沉思!!

资源截图

代码片段和文件信息




#include  // Header File For Windows
#include  // PlaySound()
#include 
#include 
#include 
#include “gl.h“ // Header File For The OpenGL32 Library
#include “glu.h“
#include “OGL.h“    // Header File For The GLu32 Library
#include “glaux.h“  // Header File For The Glaux Library

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

GLfloat yrot; // Y 旋转

GLfloat LightAmbient[]= { 0.5f 0.5f 0.5f 1.0f }; //环境光参数 ( 新增 )
GLfloat LightDiffuse[]= { 1.0f 1.0f 1.0f 1.0f }; // 漫射光参数 ( 新增 )
GLfloat LightPosition[]= { 0.0f 0.0f 2.0f 1.0f }; // 光源位置 ( 新增 )

#define TEXTURECOUNT 4
#define SNOWCOUNT 2000
LPTSTR bmpfile[TEXTURECOUNT]={_T(“Data/2.bmp“)_T(“Data/3.bmp“)_T(“Data/4.bmp“)_T(“Data/5.bmp“)};
GLuint texture[TEXTURECOUNT];

struct TSnow
{
float xyz;
float xrotyrotzrot;
float Dspeed;
float Rspeed;
int TextureIndex;
};

TSnow Snow[SNOWCOUNT];

LRESULT CALLBACK WndProc(HWND UINT WPARAM LPARAM); // Declaration For WndProc

AUX_RGBImageRec *LoadBMP(LPTSTR Filename) // Loads A Bitmap Image
{
FILE *File=NULL; // File Handle

if (!Filename) // Make Sure A Filename Was Given
{
return NULL; // If Not Return NULL
}

File=_tfopen(Filename_T(“r“)); // Check To See If The File Exists

if (File) // Does The File Exist?
{
fclose(File); // Close The Handle
return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer
}

return NULL; // If Load Failed Return NULL
}

int LoadGLTextures() // Load Bitmaps And Convert To Textures
{
int Status;
AUX_RGBImageRec *TextureImage[1]; // Create Storage Space For The Texture
glGenTextures(TEXTURECOUNT &texture[0]); // Create The Texture
for(int i=0;i {
Status=FALSE; // Status Indicator
memset(TextureImage0sizeof(void *)*1);            // Set The Pointer To NULL
// Load The Bitmap Check For Errors If Bitmap‘s Not Found Quit
if (TextureImage[0]=LoadBMP(bmpfile[i]))
{
Status=TRUE; // Set The Status To TRUE
// 创建线性滤波纹理
glBindTexture(GL_TEXTURE_2D texture[i]);
glTexParameteri(GL_TEXTURE_2DGL_TEXTURE_MAG_FILTERGL_LINEAR);
glTexParameteri(GL_TEXTURE_2DGL_TEXTURE_MIN_FILTERGL_LINEAR);
glTexImage2D(GL_TEXTURE_2D 0 3 TextureImage[0]->sizeX TextureImage[0]->sizeY 0 GL_RGB GL_UNSIGNED_BYTE TextureImage[0]->data);
}

if (TextureImage[0]) // If Texture Exists
{
if (TextureImage[0]->data) // If Texture Image Exists
{

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      69083  2011-06-16 23:13  opengl课程设计张淼\GL.H

     文件      12065  2011-06-16 23:13  opengl课程设计张淼\GLAUX.H

     文件    1312394  2011-06-16 23:14  opengl课程设计张淼\GLAUX.LIB

     文件     234006  2011-06-16 23:13  opengl课程设计张淼\glext.h

     文件      18282  2011-06-16 23:13  opengl课程设计张淼\GLU.H

     文件     130048  2009-07-14 09:15  opengl课程设计张淼\glu32.dll

     文件      12648  2011-06-16 23:14  opengl课程设计张淼\GLU32.LIB

     文件      27670  2011-06-16 23:13  opengl课程设计张淼\glut.h

     文件     237568  2001-11-08 02:27  opengl课程设计张淼\glut32.dll

     文件      71040  2011-06-10 12:39  opengl课程设计张淼\glut32.lib

     文件        641  2011-06-16 23:40  opengl课程设计张淼\OGL.h

     文件       4052  2011-06-16 23:17  opengl课程设计张淼\OpenGl.vcxproj

     文件       1228  2011-06-16 23:17  opengl课程设计张淼\OpenGl.vcxproj.filters

     文件        143  2011-06-16 23:08  opengl课程设计张淼\OpenGl.vcxproj.user

     文件      77112  2011-06-16 23:14  opengl课程设计张淼\OPENGL32.LIB

     文件       4187  2011-06-17 00:01  opengl课程设计张淼\Snow.dsp

     文件        514  2011-06-16 23:49  opengl课程设计张淼\Snow.dsw

     文件     312320  2011-07-01 17:13  opengl课程设计张淼\Snow.ncb

     文件        736  2011-07-01 17:13  opengl课程设计张淼\Snow.plg

     文件        543  2011-06-16 22:24  opengl课程设计张淼\OpenGLWork.dsw

     文件      33792  2011-06-17 19:23  opengl课程设计张淼\OpenGLWork.ncb

     文件      37888  2011-06-17 19:23  opengl课程设计张淼\OpenGLWork.opt

     文件      25417  2011-06-24 15:08  opengl课程设计张淼\myGL.cpp

     文件      12342  1999-12-21 22:25  opengl课程设计张淼\Data\2.bmp

     文件      12342  1999-12-21 22:26  opengl课程设计张淼\Data\3.bmp

     文件      12342  1999-12-21 22:26  opengl课程设计张淼\Data\4.bmp

     文件     196662  1999-12-21 20:20  opengl课程设计张淼\Data\5.bmp

     文件     115119  1997-06-03 05:03  opengl课程设计张淼\Data\OPEN4.WAV

     文件    1922732  2011-06-17 20:07  opengl课程设计张淼\Data\music.wav

     文件     241703  2011-07-01 17:13  opengl课程设计张淼\Debug\Snow.exe

............此处省略13个文件信息

评论

共有 条评论