Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

File:
1 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,
Note: See TracChangeset for help on using the changeset viewer.