|
源代码不显示texture,修改后可以显示了:
[em20]
void anmobj::setman(int i,float y)//显示人
{ if(model[0]==NULL) return;
srand(timeGetTime());
counter++;
if(counter>1)
{ counter=0;//动作延时
frame++;
if(man.dz==1)//跑动中
{man.qd[0]-=.3f;
if(man.qd[0]-man.zd[0]<0) //到目标点
{man.dz=dongzuo[rand()%7];//选取一个姿势
frame=anim[0][man.dz].start;//取动作首
}
}
if(frame>anim[0][man.dz].end) //到动作尾
{ if(man.dz!=1) man.dz=dongzuo[rand()%7];
frame=anim[0][man.dz].start;//取动作首
}
}
///////////////////////////////////////////////////////////////////
glPushAttrib(GL_CURRENT_BIT);//保存现有颜色属实性
glPushMatrix();//glPopMatrix();
glTranslatef(man.qd[0],y, -man.qd[1]);//位置
glRotatef(-180,0,1,0);
glScaled(.06f,.06f,.06f);
glFrontFace (GL_CW);
if(model[0]!=NULL)
{ //texture[0]->ChangeSettings(GL_LINEAR,GL_LINEAR_MIPMAP_LINEAR,
// GL_CLAMP,GL_CLAMP,0);//GL_MODULATE);
texture[0]->MakeCurrent();
}
glEnable(GL_TEXTURE_2D);
md2_drawModel (model[0],(int)frame,0,0);
if(model[1]!=NULL /*&& man.dz<size[1]-1*/)
{ //texture[1]->ChangeSettings(GL_LINEAR,GL_LINEAR_MIPMAP_LINEAR,
// GL_CLAMP,GL_CLAMP,0);//GL_MODULATE);
texture[1]->MakeCurrent();
}
md2_drawModel (model[1],(int)frame,0,0);
// if(pp==1) Explosion(pos.x,pos.y,pos.z,1,.5f);//开枪
glFrontFace (GL_CCW);////////////////
glDisable(GL_TEXTURE_2D);
glPopMatrix();
glPopAttrib();//恢复前一属性
} [em2] |
|