コード例 #1
0
void missile::tgaExplode(){
	int frame = this->explodeFrame / 10 +1;
	if (frame < 1 || frame >17){
		cout<<"invalid frame number";
		std::exit(1);
	}
	TGA tgaExplode;
	string frameNumber, fileName;
	std::stringstream ss;
	ss<<frame;
	if (frame < 10){
		frameNumber.append("0");
	}
	frameNumber.append(ss.str());
	fileName.append("data2/explode ");
	fileName.append(frameNumber);
	fileName.append(".tga");
	const char * c = fileName.c_str();
	tgaExplode.Load(c);
	glEnable(GL_BLEND); 
	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);	
	glPushMatrix();
	glScalef(100,100,100);
	tgaExplode.Draw();
	glPopMatrix();
	glDisable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA,GL_ONE);	//To fix the bug with font
	explodeFrame++;
}
コード例 #2
0
GLvoid InitCockPit(){
	tgaCockPit.Load("data2/cockpit.tga");
}