Changeset 6094 in orxonox.OLD for branches/avi_play/src/lib/graphics
- Timestamp:
- Dec 14, 2005, 1:18:19 AM (19 years ago)
- 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
r6068 r6094 92 92 PRINTF(1)("current_frame: %i\n", current_frame); 93 93 94 94 // Convert the image from its native format to RGB 95 95 img_convert((AVPicture*)RGB_frame, PIX_FMT_RGB24, (AVPicture*)frame, codec_context->pix_fmt, 96 96 codec_context->width, codec_context->height); 97 98 picture = (AVPicture*)RGB_frame; 97 99 100 ////////////////////////////////////////////// 101 ////////// FIX THIS ////////////////////////// 102 glGenTextures(1, &texture); 103 glBindTexture(GL_TEXTURE_2D, texture); 104 // if it is the first frame create texture 105 if(current_frame == 1) 106 { 107 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 108 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 109 // build the texture 110 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, codec_context->width, codec_context->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, picture->data[0]); 111 } 112 // if its not the first use glTexSubImage2D <-- faster then creating always a new texture 113 else 114 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, codec_context->width, codec_context->height, GL_RGBA, GL_UNSIGNED_BYTE, picture->data[0]); 115 116 117 glBindTexture(GL_TEXTURE_2D, 0); 118 ////////////////////////////////////////////// 119 ///////////////////////////////////////////// 120 98 121 // save frame 99 this->saveCurrentFrame(); 100 101 102 /* RGB_picture -> texture */ 103 122 //this->saveCurrentFrame(); 104 123 105 124 return texture; … … 118 137 char filename[32]; 119 138 int y; 120 121 picture = (AVPicture*)RGB_frame;122 139 123 140 // Open file … … 183 200 // Allocate video frame 184 201 frame = avcodec_alloc_frame(); 185 202 RGB_frame = avcodec_alloc_frame(); 186 203 187 204 // Determine required buffer size and allocate buffer … … 202 219 { 203 220 return codec_context->width; 221 } 222 223 int MediaContainer::getCurrentFrame() 224 { 225 return this->current_frame; 204 226 } 205 227 -
branches/avi_play/src/lib/graphics/importer/media_container.h
r6068 r6094 56 56 int getHeight(); 57 57 int getWidth(); 58 int getCurrentFrame(); 58 59 int getFrameRate(); 59 60 void getStream(/* stream */); -
branches/avi_play/src/lib/graphics/importer/texture_sequence.cc
r5924 r6094 152 152 } 153 153 154 154 /** 155 * @brief adds a new Frame at the end of the Sequence. 156 * @param texture the texture to add at the end of the Sequence. 157 */ 158 bool TextureSequence::addFrame(GLuint texture) 159 { 160 if (texture == NULL) 161 return false; 162 this->textures.push_back(texture); 163 164 return true; 165 } 155 166 156 167 /** -
branches/avi_play/src/lib/graphics/importer/texture_sequence.h
r5924 r6094 29 29 bool addFrame(const char* image); 30 30 bool addFrame(SDL_Surface* surface); 31 bool addFrame(GLuint texture); 31 32 32 33 virtual bool rebuild();
Note: See TracChangeset
for help on using the changeset viewer.