Changeset 4159 in orxonox.OLD for orxonox/branches
- Timestamp:
- May 11, 2005, 12:35:32 AM (20 years ago)
- Location:
- orxonox/branches/md2_loader/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/md2_loader/src/lib/graphics/importer/abstract_model.h
r4158 r4159 182 182 }; 183 183 184 class Helper185 {186 187 public:188 189 static void createTexture(unsigned int textureArray[], char* strFileName, int textureID)190 {191 SDL_Surface *image = NULL;192 193 if(!strFileName)194 return;195 196 image = IMG_Load(strFileName);197 if( !image)198 PRINTF(0)("IMG_Load: %s\n", IMG_GetError());199 200 glGenTextures(1, &textureArray[textureID]);201 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);202 glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);203 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);204 glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);205 gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->w, image->h, GL_RGB, GL_UNSIGNED_BYTE, image->pixels);206 207 SDL_FreeSurface(image);208 }209 210 };211 184 212 185 #endif /* _ABSTRACT_MODEL_H */ -
orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc
r4158 r4159 56 56 { 57 57 if( pModel->objectList.size() <= 0) return; 58 59 glEnable(GL_TEXTURE_2D);60 //glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());61 58 62 59 t3DObject *pObject = &pModel->objectList[0]; … … 80 77 } 81 78 glEnd(); 82 83 glDisable(GL_TEXTURE_2D);84 79 } 85 80 -
orxonox/branches/md2_loader/src/world_entities/test_entity.cc
r4158 r4159 27 27 28 28 TestEntity::TestEntity () : WorldEntity() 29 { 30 this->textureArray = new unsigned int[100]; 31 memset(this->textureArray, 0, 100*sizeof(unsigned int)); 32 29 { 33 30 MD2Loader* md2loader = new MD2Loader(); 34 31 this->model = new t3DModel; … … 36 33 37 34 md2loader->importMD2(this->model, "../data/models/tris.md2", "../data/models/tris.pcx"); 38 39 for(int i = 0; i < this->model->numOfMaterials; i++)40 {41 if( strlen(this->model->materialList[i].strFile) > 0)42 {43 Helper::createTexture(textureArray, this->model->materialList[i].strFile, i);44 }45 this->model->materialList[i].texureId = i;46 }47 35 48 36 this->material = new Material("Sky"); -
orxonox/branches/md2_loader/src/world_entities/test_entity.h
r4158 r4159 28 28 t3DModel* model; 29 29 MD2Model* md2Model; 30 31 unsigned int* textureArray;32 30 Material* material; 33 31
Note: See TracChangeset
for help on using the changeset viewer.