资源简介
openGL 制作随着音乐变化特效的复杂动画,音乐的可视化。
代码片段和文件信息
/*
* 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 Standard Input/Output
#include // Header File For The OpenGL32 Library
#include // Header File For The GLu32 Library
#include // Header File For The Glaux Library
#include “fmod.h“ // FMOD header
#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
GLfloat xrot; // X Rotation
GLfloat yrot; // Y Rotation
GLfloat zrot; // Z Rotation
GLfloat ypos;
GLuint texture[3]; // Storage For Three Textures
GLUquadricObj *quadratic;
GLfloat radius;
GLfloat lookupdown;
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 };
clock_t oldSystemTime; //for refreshing the quads
clock_t modeTime; //for refreshing the mode
struct BGQuad
{
GLfloat x;
GLfloat y;
GLfloat intensity;
int color;
int cooldown;
};
BGQuad Quads[5][5];
/*what the screen is doing
0: quads rotate left
1: quads rotate right
2: quads rotate up
3: quads rotate down
*/
int mode=0;
void CreateQuads()
{
GLfloat ypos = 1.6f;
for(int i=0;i<5;i++)
{
GLfloat xpos = -2.2f;
for(int j=0;j<5;j++)
{
Quads[i][j].x = xpos;
Quads[i][j].y = ypos;
Quads[i][j].intensity = 0.0f;
Quads[i][j].cooldown = 0;
Quads[i][j].color = (i%2==0)?(j%2==0)+1:(j%2!=0)+1; //make the checkboard of colors
xpos += 1.1f;
}
ypos -= 1.1f;
}
}
LRESULT CALLBACK WndProc(HWND UINT WPARAM LPARAM); // Declaration For WndProc
AUX_RGBImageRec *LoadBMP(char *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=fopen(Filename“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=FALSE; // Status Indicator
AUX_RGBImageRec *TextureImage[1]; // Create Storage Space For The Texture
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-06-19 22:58 Gyasi Grey\
目录 0 2017-06-19 22:58 Gyasi Grey\Demo\
文件 3126 2003-01-24 00:27 Gyasi Grey\Demo\Blue.bmp
文件 130560 2003-01-05 03:34 Gyasi Grey\Demo\Fmod.dll
文件 53248 2003-01-27 16:23 Gyasi Grey\Demo\Mini.exe
文件 3126 2003-01-25 09:56 Gyasi Grey\Demo\Red.bmp
文件 49206 2003-01-25 09:34 Gyasi Grey\Demo\Skin.bmp
文件 79472 2003-01-27 16:32 Gyasi Grey\Demo\Song.s3m
目录 0 2017-06-19 22:58 src\
目录 0 2017-06-19 22:58 src\Gyasi Grey\
目录 0 2017-06-19 22:58 src\Gyasi Grey\Source\
文件 3126 2003-01-24 00:27 src\Gyasi Grey\Source\Blue.bmp
文件 130560 2003-01-05 03:34 src\Gyasi Grey\Source\Fmod.dll
文件 64753 2002-12-20 16:31 src\Gyasi Grey\Source\Fmod.h
文件 162626 2002-12-20 19:10 src\Gyasi Grey\Source\FmodVC.lib
文件 25209 2003-01-25 19:40 src\Gyasi Grey\Source\Main.cpp
文件 3878 2003-01-27 16:24 src\Gyasi Grey\Source\NeHeMini.dsp
文件 539 2003-01-23 13:37 src\Gyasi Grey\Source\NeHeMini.dsw
文件 3126 2003-01-25 09:56 src\Gyasi Grey\Source\Red.bmp
文件 49206 2003-01-25 09:34 src\Gyasi Grey\Source\Skin.bmp
文件 79472 2003-01-27 16:32 src\Gyasi Grey\Source\Song.s3m
评论
共有 条评论