procedure DrawAnim;
begin
glLoadIdentity();
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glBlendFunc(GL_ONE, GL_ONE);
gluLookAt(0.0, 0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
// Animation start
if (PlayState = 3) or (PlayState = 0) then
begin
if not OpenPAnim then
begin
if OpenSAnim then
CloseAVI;
if FileExists(SAnim) then
begin
ActiveFrame := -1;
AVIStart := GetTickCount();
OpenAVI(PWideChar(SAnim), DanceTex, 7);
OpenSAnim := False;
OpenPAnim := True;
end;
end;
if DanceTex[7].Texture > 0 then
begin
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushMatrix();
glTranslatef(0.0, -0.7, -7.5);
GetAVIFrame;
glBindTexture(GL_TEXTURE_2D, DanceTex[7].Texture);
glBegin(GL_QUADS);
glTexCoord2f(0, 1); glVertex3f(-2.34, 2.8, -0);
glTexCoord2f(1, 1); glVertex3f(2.34, 2.8, -0);
glTexCoord2f(1, 0); glVertex3f(2.34, -2.8, -0);
glTexCoord2f(0, 0); glVertex3f(-2.34, -2.8, -0);
glEnd;
glPopMatrix();
glPushAttrib(GL_ALL_ATTRIB_BITS);
end;
end else
begin
if not OpenSAnim then
begin
if OpenPAnim then
CloseAVI;
if FileExists(PAnim) then
begin
ActiveFrame := -1;
AVIStart := GetTickCount();
OpenAVI(PWideChar(PAnim), DanceTex, 6);
OpenPAnim := False;
OpenSAnim := True;
end;
end;
if DanceTex[6].Texture > 0 then
begin
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushMatrix();
glTranslatef(0.0, -0.7, -7.5);
GetAVIFrame;
glBindTexture(GL_TEXTURE_2D, DanceTex[6].Texture);
glBegin(GL_QUADS);
glTexCoord2f(0, 1); glVertex3f(-2.34, 2.8, -0);
glTexCoord2f(1, 1); glVertex3f(2.34, 2.8, -0);
glTexCoord2f(1, 0); glVertex3f(2.34, -2.8, -0);
glTexCoord2f(0, 0); glVertex3f(-2.34, -2.8, -0);
glEnd;
glPopMatrix();
glPushAttrib(GL_ALL_ATTRIB_BITS);
end;
end;
glDisable(GL_BLEND);
// AVI Animation
// auf den Attributstack abgelegte Zustandsvariablen wieder herstellen
//glPopAttrib;
end;