Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6373 in orxonox.OLD


Ignore:
Timestamp:
Dec 31, 2005, 3:26:57 PM (18 years ago)
Author:
hdavid
Message:

branches\avi_play: different texture creation

Location:
branches/avi_play/src/lib/graphics/importer
Files:
4 edited

Legend:

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

    r6353 r6373  
    5858  if (glIsTexture(texture))
    5959    glDeleteTextures(1, &texture);
    60   SDL_FreeSurface(surface);
     60  //SDL_FreeSurface(surface);
    6161
    6262  // Free the RGB image
     
    186186                 ((AVPicture*)RGB_frame)->data[0]+i *
    187187                 ((AVPicture*)RGB_frame)->linesize[0],
    188                   codec_context->width*sizeof(uint8_t)*3);
    189 
    190         //avcodec_flush_buffers(codec_context);
    191 
     188                  codec_context->width*sizeof(uint8_t)*3);
     189/*
    192190        surface = SDL_CreateRGBSurfaceFrom(data, codec_context->width,
    193191                                           codec_context->height,24,
     
    228226                        GL_UNSIGNED_BYTE,
    229227                        surface->pixels);
    230         glBindTexture(GL_TEXTURE_2D, 0);     
     228        glBindTexture(GL_TEXTURE_2D, 0);  */   
     229
     230        // Create an OpenGL texture
     231        glGenTextures(1, &texture);
     232        glBindTexture(GL_TEXTURE_2D, texture);
     233        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     234        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     235        // create the texture
     236        glTexImage2D(GL_TEXTURE_2D,
     237                    0,
     238                    GL_RGB,
     239                    codec_context->width, codec_context->height,
     240                    0,
     241                    GL_RGB,
     242                    GL_UNSIGNED_BYTE,
     243                    data);
     244        // build the MipMaps
     245        gluBuild2DMipmaps(GL_TEXTURE_2D,
     246                        GL_RGB,
     247                        codec_context->width,
     248                        codec_context->height,
     249                        GL_RGB,
     250                        GL_UNSIGNED_BYTE,
     251                        data);
     252        glBindTexture(GL_TEXTURE_2D, 0);
    231253       
     254        //avcodec_flush_buffers(codec_context);
     255
    232256        return texture;
    233257      }
  • branches/avi_play/src/lib/graphics/importer/media_container.h

    r6339 r6373  
    3434  AVFrame* RGB_frame;
    3535
    36   SDL_Surface* surface;
     36  //SDL_Surface* surface;
    3737  GLuint texture;
    3838  uint8_t* data;
  • branches/avi_play/src/lib/graphics/importer/movie_player.cc

    r6353 r6373  
    4949  if (glIsTexture(texture))
    5050    glDeleteTextures(1, &texture);
    51   SDL_FreeSurface(surface);
     51  //SDL_FreeSurface(surface);
    5252
    5353  // Free the RGB image
     
    5757  // Free the frame
    5858  av_free(frame);
     59
     60avcodec_default_free_buffers(codec_context);
    5961
    6062  // Close the codec
     
    197199                 codec_context->width*sizeof(uint8_t)*3);
    198200
    199 //avcodec_flush_buffers(codec_context);
    200 
    201         surface = SDL_CreateRGBSurfaceFrom(data, codec_context->width,
     201       /* surface = SDL_CreateRGBSurfaceFrom(data, codec_context->width,
    202202                                           codec_context->height,24,
    203203                                           codec_context->width*sizeof(uint8_t)*3,
     
    229229                        GL_UNSIGNED_BYTE,
    230230                        surface->pixels);
     231        glBindTexture(GL_TEXTURE_2D, 0);*/
     232
     233
     234        glBindTexture(GL_TEXTURE_2D, texture);
     235        // update the texture
     236        glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
     237                          codec_context->width, codec_context->height,
     238                          GL_RGB, GL_UNSIGNED_BYTE,
     239                          data);
     240        // build the MipMaps
     241        gluBuild2DMipmaps(GL_TEXTURE_2D,
     242                        GL_RGB,
     243                        codec_context->width,
     244                        codec_context->height,
     245                        GL_RGB,
     246                        GL_UNSIGNED_BYTE,
     247                        data);
    231248        glBindTexture(GL_TEXTURE_2D, 0);
     249
     250        //avcodec_flush_buffers(codec_context);
     251
    232252      }
    233253      else
  • branches/avi_play/src/lib/graphics/importer/movie_player.h

    r6353 r6373  
    4848  AVFrame* RGB_frame;
    4949
    50   SDL_Surface* surface;
     50  //SDL_Surface* surface;
    5151  GLuint texture;
    5252  uint8_t* data;
     
    8989  void getNextFrame();
    9090  void skipFrame(int frames);
    91   void gotoFrame(int frame);
     91  void gotoFrame(int frames);
    9292
    9393};
Note: See TracChangeset for help on using the changeset viewer.