Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 29, 2005, 6:12:24 PM (18 years ago)
Author:
hdavid
Message:

branches\avi_play: fixed a bug, still memory leak somewhere in MediaContainer

File:
1 edited

Legend:

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

    r6325 r6333  
    190190                      GL_UNSIGNED_BYTE,
    191191                      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);
    196         // build the MipMaps
    197         gluBuild2DMipmaps(GL_TEXTURE_2D,
     192          // build the MipMaps
     193          gluBuild2DMipmaps(GL_TEXTURE_2D,
    198194                          GL_RGB,
    199195                          surface->w,
     
    202198                          GL_UNSIGNED_BYTE,
    203199                          surface->pixels);
    204         glBindTexture(GL_TEXTURE_2D, 0);
     200          glBindTexture(GL_TEXTURE_2D, 0);
     201        }
     202        else
     203        {
     204          /* Create an OpenGL texture from the surface */
     205          glGenTextures(1, &texture);
     206          glBindTexture(GL_TEXTURE_2D, texture);
     207          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     208          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     209          // update the texture
     210          glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surface->w, surface->h, GL_RGB, GL_UNSIGNED_BYTE, surface->pixels);
     211
     212          // build the MipMaps
     213          gluBuild2DMipmaps(GL_TEXTURE_2D,
     214                          GL_RGB,
     215                          surface->w,
     216                          surface->h,
     217                          GL_RGB,
     218                          GL_UNSIGNED_BYTE,
     219                          surface->pixels);
     220          glBindTexture(GL_TEXTURE_2D, 0);
     221        }
    205222
    206223        return texture;
Note: See TracChangeset for help on using the changeset viewer.