Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6325 in orxonox.OLD for branches/avi_play


Ignore:
Timestamp:
Dec 28, 2005, 12:20:38 AM (19 years ago)
Author:
hdavid
Message:

branches\avi_play: the frames are created faster with glTexSubImage2D, implemented custom speed setting

Location:
branches/avi_play/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/avi_play/src/lib/graphics/importer/media_container.cc

    r6324 r6325  
    174174                                            );
    175175
    176         // NOTE: use glTexSubImage2D, it's faster!! //
    177         /* Create an OpenGL texture from the surface */
    178         glGenTextures(1, &texture);
    179         glBindTexture(GL_TEXTURE_2D, texture);
    180         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    181         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    182         // build the Texture
    183         glTexImage2D(GL_TEXTURE_2D,
    184                     0,
    185                     GL_RGB,
    186                     surface->w, surface->h,
    187                     0,
    188                     GL_RGB,
    189                     GL_UNSIGNED_BYTE,
    190                     surface->pixels);
     176        if(frame_num == 1)
     177        {
     178          /* Create an OpenGL texture from the surface */
     179          glGenTextures(1, &texture);
     180          glBindTexture(GL_TEXTURE_2D, texture);
     181          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     182          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     183          // create the texture
     184          glTexImage2D(GL_TEXTURE_2D,
     185                      0,
     186                      GL_RGB,
     187                      surface->w, surface->h,
     188                      0,
     189                      GL_RGB,
     190                      GL_UNSIGNED_BYTE,
     191                      surface->pixels);
     192        }
     193        else
     194          // update the texture
     195          glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surface->w, surface->h, GL_RGB, GL_UNSIGNED_BYTE, surface->pixels);
    191196        // build the MipMaps
    192197        gluBuild2DMipmaps(GL_TEXTURE_2D,
  • branches/avi_play/src/lib/graphics/importer/movie_player.cc

    r6324 r6325  
    5858  status = STOP;
    5959  timer = 0;
     60  speed = 1;
    6061
    6162  material = new Material;
     
    124125    current_frame = media_container->getFrameNumber();
    125126    timer += dt;
    126     actuel_frame = timer * fps;
     127    actuel_frame = timer * fps * speed;
    127128
    128129    if(actuel_frame != current_frame)
     
    151152void MoviePlayer::setSpeed(float speed)
    152153{
    153   this->speed = speed;
     154  if(speed > 0)
     155    this->speed = speed;
    154156}
    155157
  • branches/avi_play/src/subprojects/importer/movie_player_test.cc

    r6324 r6325  
    4949          movie_player->stop();
    5050          break;
     51        case SDLK_9:
     52          movie_player->setSpeed(movie_player->getSpeed() - 0.5);
     53          PRINTF(0)("speed: %f\n", movie_player->getSpeed());
     54          break;
     55        case SDLK_0:
     56          movie_player->setSpeed(movie_player->getSpeed() + 0.5);
     57          PRINTF(0)("speed: %f\n", movie_player->getSpeed());
     58          break;
    5159      }
    5260  }
Note: See TracChangeset for help on using the changeset viewer.