Changeset 6094 in orxonox.OLD for branches/avi_play
- Timestamp:
- Dec 14, 2005, 1:18:19 AM (19 years ago)
- Location:
- branches/avi_play/src
- Files:
-
- 6 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(); -
branches/avi_play/src/subprojects/importer/importer.cc
r6068 r6094 60 60 void Framework::moduleTick(float dt) 61 61 { 62 while(movie->getNextFrame() != NULL); 62 while(movie->getNextFrame() != NULL) 63 movie->saveCurrentFrame(); 63 64 } 64 65 -
branches/avi_play/src/subprojects/importer/multitex.cc
r6068 r6094 29 29 30 30 #include "resource_manager.h" 31 #include "media_container.h" 31 32 32 33 Model* obj; … … 34 35 Texture* test; 35 36 Material* testMat; 37 MediaContainer* movie; 36 38 37 39 float counter = 0; … … 40 42 void Framework::moduleInit(int argc, char** argv) 41 43 { 44 movie = new MediaContainer("/home/david/Desktop/Face2.avi"); 45 46 // print information about the media file 47 movie->printMediaInformation(); 48 42 49 ResourceManager::getInstance()->addImageDir("./"); 43 50 … … 50 57 printf("%s\n", argv[i]); 51 58 } 59 60 // add one frame from the movie 61 seq->addFrame(movie->getNextFrame()); 62 52 63 test = new Texture(argv[1]); 53 64 testMat->setDiffuseMap(argv[1]);
Note: See TracChangeset
for help on using the changeset viewer.