Changeset 4834 in orxonox.OLD for orxonox/trunk/src/lib/graphics
- Timestamp:
- Jul 11, 2005, 5:47:23 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/graphics
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/graphics_engine.cc
r4833 r4834 325 325 glDisable(GL_CULL_FACE); 326 326 glDisable(GL_LIGHTING); // will be set back when leaving 2D-mode 327 glEnable(GL_TEXTURE_2D);328 329 /* This allows alpha blending of 2D textures with the scene */330 glEnable(GL_BLEND);331 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);332 327 333 328 glViewport(0, 0, screen->w, screen->h); … … 351 346 void GraphicsEngine::leave2DMode() 352 347 { 348 glMatrixMode(GL_PROJECTION); 349 glPopMatrix(); 350 353 351 glMatrixMode(GL_MODELVIEW); 354 glPopMatrix();355 356 glMatrixMode(GL_PROJECTION);357 352 glPopMatrix(); 358 353 … … 444 439 this->geTextCFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 15, TEXT_DYNAMIC, 0, 255, 0); 445 440 this->geTextCFPS->setAlignment(TEXT_ALIGN_LEFT); 446 this->geTextCFPS->setPosition(5, 5 00);441 this->geTextCFPS->setPosition(5, 5); 447 442 this->geTextMaxFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 15, TEXT_DYNAMIC, 0, 255, 0); 448 443 this->geTextMaxFPS->setAlignment(TEXT_ALIGN_LEFT); 449 this->geTextMaxFPS->setPosition(5, 530);444 this->geTextMaxFPS->setPosition(5, 35); 450 445 this->geTextMinFPS = TextEngine::getInstance()->createText("fonts/arial_black.ttf", 35, TEXT_DYNAMIC, 0, 255, 0); 451 446 this->geTextMinFPS->setAlignment(TEXT_ALIGN_LEFT); 452 this->geTextMinFPS->setPosition(5, 560);447 this->geTextMinFPS->setPosition(5, 65); 453 448 #endif /* NO_TEXT */ 454 449 } -
orxonox/trunk/src/lib/graphics/graphics_engine.h
r4833 r4834 68 68 69 69 /** \brief swaps the GL_BUFFERS */ 70 static void swapBuffers() { SDL_GL_SwapBuffers(); };70 inline static void swapBuffers() { SDL_GL_SwapBuffers(); }; 71 71 72 72 void process(const Event &event); -
orxonox/trunk/src/lib/graphics/importer/material.cc
r4746 r4834 57 57 { 58 58 PRINTF(4)("delete Material %s.\n", this->getName()); 59 59 60 if (this->diffuseTexture) 60 61 ResourceManager::getInstance()->unload(this->diffuseTexture); 62 if (this->ambientTexture) 63 ResourceManager::getInstance()->unload(this->ambientTexture); 64 if (this->specularTexture) 65 ResourceManager::getInstance()->unload(this->specularTexture); 61 66 } 62 67 … … 267 272 ResourceManager::getInstance()->unload(this->diffuseTexture); 268 273 269 //! \todo check if RESOURCE MANAGER is availiable 270 //! \todo Textures from .mtl-file need special care. 271 this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE); 274 //! @todo check if RESOURCE MANAGER is availiable 275 //! @todo Textures from .mtl-file need special care. 276 if (dMap!= NULL) 277 this->diffuseTexture = (Texture*)ResourceManager::getInstance()->load(dMap, IMAGE); 278 else 279 this->diffuseTexture = NULL; 272 280 } 273 281 -
orxonox/trunk/src/lib/graphics/importer/model.cc
r4822 r4834 159 159 160 160 this->materialList = new tList<Material>; 161 this->materialsExtern = false; 161 162 162 163 if (this->type == MODEL_VERTEX_ARRAY) … … 186 187 187 188 // deleting the MaterialList 188 PRINTF(5)("Deleting Materials.\n"); 189 tIterator<Material>* tmpIt = this->materialList->getIterator(); 190 Material* material = tmpIt->nextElement(); 191 192 //! \todo do we really have to delete this material?? 193 while(material) 189 if (!this->materialsExtern) 190 { 191 PRINTF(5)("Deleting Materials.\n"); 192 193 tIterator<Material>* tmpIt = this->materialList->getIterator(); 194 Material* material = tmpIt->nextElement(); 195 //! @todo do we really have to delete this material?? 196 while(material) 194 197 { 195 198 delete material; 196 199 material = tmpIt->nextElement(); 197 200 } 198 delete tmpIt; 201 delete tmpIt; 202 } 199 203 delete materialList; 200 204 delete this->pModelInfo; … … 356 360 /** 357 361 \brief finalizes an Model. 358 This funcion is needed, to delete all the Lists, and arrays that are no more needed because they are already imported into openGL. This will be applied at the end of the importing Process. 362 * This funcion is needed, to delete all the Lists, and arrays that are no more 363 * needed because they are already imported into openGL. 364 * This will be applied at the end of the importing Process. 359 365 */ 360 366 bool Model::cleanup() … … 372 378 \param material the Material to add 373 379 \returns the added material 374 375 !! beware the Material will be deleted when the Model gets deleted 380 * 381 * this also tells this Model, that all the Materials are handled externally 382 * with this option set the Materials will not be deleted with the Model. 383 * !! -> NO MATERIALS GET DELETED WITH ONE CALL TO THIS FUNCTION !! 376 384 */ 377 385 Material* Model::addMaterial(Material* material) 378 386 { 379 387 this->materialList->add(material); 388 this->materialsExtern = true; 380 389 return material; 381 390 } -
orxonox/trunk/src/lib/graphics/importer/model.h
r4830 r4834 190 190 191 191 tList<Material>* materialList; //!< A list for all the Materials in this Model 192 bool materialsExtern; //!< If the materials given to this Object are extern. 192 193 }; 193 194 -
orxonox/trunk/src/lib/graphics/text_engine.cc
r4830 r4834 919 919 // entering 3D-mode 920 920 GraphicsEngine::enter2DMode(); 921 glEnable(GL_TEXTURE_2D); 922 glEnable(GL_BLEND); 923 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 924 921 925 // drawing all the texts 922 926 tIterator<Text>* textIterator = textList->getIterator();
Note: See TracChangeset
for help on using the changeset viewer.