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

資源簡介

使用了opengl+粒子系統模擬的一個簡單的降雪過程,其中雪片隨機使用了7種不同的紋理,使雪花體現出差異性,并且使用了顯示列表,對降雪過程進行優化,運行后左上角顯示了幀速率和當前幀。

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?
#include?“Texture.h“

#define?PARTICLE_NUMBER?2000
GLuint?texture[8];

int?frame=0time=0base=0totalframe=0;
char?fps[30]={‘\0‘};?
char?f[30]={‘\0‘};
float?FPS=0.0f;?

typedef?struct
{
GLfloat?xyz;
GLfloat?r;
GLfloat?life;
GLfloat?vyvx;
GLfloat?ayax;
}particle;
particle?particles[PARTICLE_NUMBER];

void?initparticles()
{
for?(int?i=0;i {
particles[i].life=rand()%200;
particles[i].r=rand()%3+1;
particles[i].x=rand()%250;
particles[i].y=rand()%30+150;
particles[i].z=rand()%200-100;
particles[i].vy=float(rand()%10-4)/40;
particles[i].vx=float(rand()%10-4)/80;
particles[i].ay=-4.9/40000;
particles[i].ax=-1.0/10000;
}
}

void?init(void)
{
glClearColor(0.00.00.00.0);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glColor4f(1.01.01.00.5f);
glBlendFunc(GL_SRC_ALPHAGL_ONE);
initparticles();
BuildTexture(“snow1.jpg“texture[0]);
BuildTexture(“num1.jpg“texture[1]);
BuildTexture(“num3.jpg“texture[2]);
BuildTexture(“num2.jpg“texture[3]);
BuildTexture(“num4.jpg“texture[4]);
BuildTexture(“num5.jpg“texture[5]);
BuildTexture(“num6.jpg“texture[6]);
BuildTexture(“num7.jpg“texture[7]);

glNewList(8GL_COMPILE);
glBegin(GL_QUADS);
glTexCoord2f(00);glVertex3f(-1-10.0);
glTexCoord2f(10);glVertex3f(1-10.0);
glTexCoord2f(11);glVertex3f(110.0);
glTexCoord2f(01);glVertex3f(-110.0);
glEnd();
glEndList();

for?(int?i=1;i<8;i++)
{
glNewList(iGL_COMPILE);
glEnable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBindTexture(GL_TEXTURE_2Dtexture[i]);
glCallList(8);
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glEndList();
}
}

void?display(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
//? glEnable(GL_TEXTURE_2D);
//? glBindTexture(GL_TEXTURE_2Dtexture[0]);
//? glBegin(GL_QUADS);
//? glTexCoord2f(00);glVertex3f(-240.0-220.0-150.0);
//? glTexCoord2f(10);glVertex3f(240.0-220.0-150.0);
//? glTexCoord2f(11);glVertex3f(240.0220.0-150.0);
//? glTexCoord2f(01);glVertex3f(-240.0220.0-150.0);
//? glEnd();
//? glDisable(GL_TEXTURE_2D);

for?(int?i=0;i {
if(particles[i].life>0)
{
int?j=rand()%7+1;
glPushMatrix();
glTranslatef(particles[i].xparticles[i].yparticles[i].z);
glScalef(particles[i].rparticles[i].r1.0);
glCallList(j);
glPopMatrix();
particles[i].life-=float(rand()%100)/1000.0f+0.0003f;
particles[i].vy+=particles[i].ay;
particles[i].vx+=particles[i].ax;
particles[i].y+=particles[i].vy;
particles[i].x+=particles[i].vx;
}
if(particles[i].life<=0)
{
particles[i].life=rand()%200;
particles[i].r=rand()%3+1;
particles[i].x=rand()%250;
particles[i].y=rand()%30+150;
particles[i].z=rand()%200-1

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-02-17?08:34??snow1?-?副本\
?????目錄???????????0??2014-02-17?08:34??snow1?-?副本\1\
?????文件????????4413??2014-02-16?15:51??snow1?-?副本\1\1.cpp
?????文件????????4115??2013-12-23?11:13??snow1?-?副本\1\1.vcxproj
?????文件????????1167??2013-12-23?11:13??snow1?-?副本\1\1.vcxproj.filters
?????文件?????????143??2013-12-23?11:04??snow1?-?副本\1\1.vcxproj.user
?????目錄???????????0??2014-02-17?08:34??snow1?-?副本\1\Debug\
?????文件?????????406??2013-12-23?11:05??snow1?-?副本\1\Debug\1.exe.embed.manifest
?????文件?????????472??2014-01-13?10:59??snow1?-?副本\1\Debug\1.exe.embed.manifest.res
?????文件?????????381??2014-02-16?15:51??snow1?-?副本\1\Debug\1.exe.intermediate.manifest
?????文件?????????107??2014-02-16?15:51??snow1?-?副本\1\Debug\1.lastbuildstate
?????文件????????3046??2014-02-16?15:51??snow1?-?副本\1\Debug\1.log
?????文件???????40345??2014-02-16?15:51??snow1?-?副本\1\Debug\1.obj
?????文件?????????192??2013-12-23?11:05??snow1?-?副本\1\Debug\1_manifest.rc
?????文件???????87954??2014-02-16?15:51??snow1?-?副本\1\Debug\CL.read.1.tlog
?????文件????????4490??2014-02-16?15:51??snow1?-?副本\1\Debug\CL.write.1.tlog
?????文件???????40473??2014-01-13?10:59??snow1?-?副本\1\Debug\Texture.obj
?????文件????????4410??2014-02-16?15:51??snow1?-?副本\1\Debug\cl.command.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link-cvtres.read.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link-cvtres.write.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.12336-cvtres.read.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.12336-cvtres.write.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.12336.read.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.12336.write.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.12576-cvtres.read.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.12576-cvtres.write.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.12576.read.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.12576.write.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.3704-cvtres.read.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.3704-cvtres.write.1.tlog
?????文件???????????2??2014-02-16?15:51??snow1?-?副本\1\Debug\link.3704.read.1.tlog
............此處省略74個文件信息

評論

共有 條評論