Changeset 6160 in orxonox.OLD for branches/avi_play/src/lib
- Timestamp:
- Dec 19, 2005, 12:43:51 AM (19 years ago)
- Location:
- branches/avi_play/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/avi_play/src/lib/graphics/importer/media_container.cc
r6149 r6160 42 42 fps = 0; 43 43 44 /* SDL interprets each pixel as a 32-bit number, so our masks must depend 45 on the endianness (byte order) of the machine */ 46 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 47 rmask = 0xff000000; 48 gmask = 0x00ff0000; 49 bmask = 0x0000ff00; 50 #else 51 rmask = 0x000000ff; 52 gmask = 0x0000ff00; 53 bmask = 0x00ff0000; 54 #endif 55 44 56 if (filename != NULL) 45 57 this->loadMedia(filename); … … 68 80 } 69 81 70 GLuintMediaContainer::getFrame(int frame_number)71 { 72 73 } 74 75 SDL_Surface 82 SDL_Surface* MediaContainer::getFrame(int frame_number) 83 { 84 85 } 86 87 SDL_Surface* MediaContainer::getNextFrame() 76 88 { 77 89 /* get next frame */ … … 107 119 memcpy(&data[i*codec_context->width*3], picture->data[0]+i * picture->linesize[0],codec_context->width*sizeof(uint8_t)*3); 108 120 109 Uint32 rmask, gmask, bmask, amask; 110 111 /* SDL interprets each pixel as a 32-bit number, so our masks must depend 112 on the endianness (byte order) of the machine */ 113 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 114 rmask = 0xff000000; 115 gmask = 0x00ff0000; 116 bmask = 0x0000ff00; 117 amask = 0x000000ff; 118 #else 119 rmask = 0x000000ff; 120 gmask = 0x0000ff00; 121 bmask = 0x00ff0000; 122 amask = 0xff000000; 123 #endif 124 surface = SDL_CreateRGBSurfaceFrom(data, codec_context->width, codec_context->height, 125 32, codec_context->width*sizeof(uint8_t)*3, rmask, gmask, bmask, 0); 126 127 return surface; 128 /*glGenTextures(1, &texture); 129 glBindTexture(GL_TEXTURE_2D, texture); 130 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 131 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 132 // if it is the first frame create texture 133 //if(current_frame == 1) 134 //{ 135 // build the texture 136 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, codec_context->width, codec_context->height, 0, GL_RGB, GL_UNSIGNED_BYTE, picture->data); 137 //} 138 // if its not the first use glTexSubImage2D <-- faster then creating always a new texture 139 //else 140 // glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, codec_context->width, codec_context->height, GL_RGB, GL_UNSIGNED_BYTE, data); 141 142 143 glBindTexture(GL_TEXTURE_2D, 0);*/ 144 ////////////////////////////////////////////// 145 ///////////////////////////////////////////// 146 147 // save frame 148 //this->saveCurrentFrame(); 149 150 //return texture; 121 surface = SDL_CreateRGBSurfaceFrom(data, codec_context->width, codec_context->height, 122 24, codec_context->width*sizeof(uint8_t)*3, rmask, gmask, bmask, 0); 123 124 return surface; 151 125 } 152 126 } -
branches/avi_play/src/lib/graphics/importer/media_container.h
r6149 r6160 32 32 33 33 double fps; 34 GLuint texture;34 Uint32 rmask, gmask, bmask; 35 35 SDL_Surface *surface; 36 36 uint8_t* data; … … 53 53 ~MediaContainer(); 54 54 55 GLuintgetFrame(int frame_number);56 SDL_Surface 55 SDL_Surface* getFrame(int frame_number); 56 SDL_Surface* getNextFrame(); 57 57 void loadMedia(const char* filename); 58 58
Note: See TracChangeset
for help on using the changeset viewer.