本文整理汇总了C++中Target::Draw_Target方法的典型用法代码示例。如果您正苦于以下问题:C++ Target::Draw_Target方法的具体用法?C++ Target::Draw_Target怎么用?C++ Target::Draw_Target使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Target
的用法示例。
在下文中一共展示了Target::Draw_Target方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//light control
if(light0 == OFF) glEnable(GL_LIGHT0);
else glDisable(GL_LIGHT0);
if(light1 == ON) glEnable(GL_LIGHT1);
else glDisable(GL_LIGHT1);
if(spotlight == ON) {
glEnable(GL_LIGHT2);glEnable(GL_LIGHT3);glEnable(GL_LIGHT4);glEnable(GL_LIGHT5);glEnable(GL_LIGHT6);
glEnable(GL_LIGHT7);}
else {
glDisable(GL_LIGHT2);glDisable(GL_LIGHT3);glDisable(GL_LIGHT4);glDisable(GL_LIGHT5);glDisable(GL_LIGHT6);
glDisable(GL_LIGHT7);
}
if (fog == ON) glEnable(GL_FOG);
else glDisable(GL_FOG);
GLfloat fogColor[] = {0.3f, 0.3f, 0.3f, 1}; //Sets the color for the fog
glFogfv(GL_FOG_COLOR, fogColor); //Modes for the fog are linear, exp and exp2
glFogi(GL_FOG_MODE, GL_LINEAR); // Linear interpolation between start and end values
glFogi(GL_FOG_MODE, GL_EXP); // y = 1 - e-0.05x ; x is distance from camera
glFogi(GL_FOG_MODE, GL_EXP2); // y = 1 - e-(0.05x)^2 ; x is distance from camera
glFogf(GL_FOG_DENSITY, 0.013f);
//camera control
if (camera == true)
{
gluLookAt (eyex, eyey, eyez, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glRotatef(cameraX, 1, 0, 0);
glRotatef(cameraY, 0, 1, 0);
}
else {
//gluLookAt (-cos(cannon1.turn*PI/180)+12, cannon1.CannonPoz.y+3, sin(cannon1.turn*PI/180), cannon1.CannonPoz.x, cannon1.CannonPoz.y, cannon1.CannonPoz.z, 0.0, 1.0, 0.0);
gluLookAt(cannon1.CannonPoz.x+12, 3, cannon1.CannonPoz.z, cannon1.CannonPoz.x, cannon1.CannonPoz.y, cannon1.CannonPoz.z, 0, 1, 0);
}
//display cannon
if (spotlightChange==false) {
glLightf(GL_LIGHT0, GL_SPOT_CUTOFF,50.0); // set cutoff angle
glLightf(GL_LIGHT0, GL_SPOT_EXPONENT,4.0); // set focusing strength
}
else {
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, spotlightdirN);
glLightf(GL_LIGHT0, GL_SPOT_CUTOFF,40.0); // set cutoff angle
glLightf(GL_LIGHT0, GL_SPOT_EXPONENT,15.0); // set focusing strength
}
for (int i = 0; i < allBullets.size(); ++i)
{
allBullets.at(i).Draw_Bullet();
target.collision(allBullets.at(i).BulletPoz);
}
cannon1.Draw_Cannon();
target.Draw_Target();
target.Response();
if( target.gamestatus==WIN )
{
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
angle=60;
glViewport(0, 0, width, height);
gluLookAt (0, 5, 6.5, 0.0, 5.0, 1.0, 0.0, 1.0, 0.0);
glPushMatrix();
glRotatef(90, 1, 0, 0);
map.win();
glPopMatrix();
}
glDisable(GL_COLOR_MATERIAL);
map.ground();
map.sky();
map.wall();
glutSwapBuffers();
}