Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5754 in orxonox.OLD


Ignore:
Timestamp:
Nov 24, 2005, 11:53:58 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: Texture even better :)

Location:
trunk/src/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/texture.cc

    r5753 r5754  
    3838  this->texture = 0;
    3939  this->image = NULL;
     40
    4041  if (imageName != NULL)
    4142    this->loadImage(imageName);
     
    6465  if (GraphicsEngine::texturesEnabled)
    6566    {
     67      if (this->image != NULL)
     68        {
     69          SDL_FreeSurface(this->image);
     70          this->image = NULL;
     71        }
     72      if (this->texture != 0)
     73        {
     74          glDeleteTextures(1, &this->texture);
     75          this->texture = 0;
     76        }
    6677      if (imageName != NULL)
    6778        {
     
    7384          if(tmpSurf != NULL)
    7485          {
    75             PRINTF(3)("loading Image %s\n", imageName);
     86            PRINTF(4)("loading Image %s\n", imageName);
    7687            this->image = this->prepareSurface(tmpSurf);
    7788            this->texture = loadTexToGL(this->image);
     
    8899      else
    89100        {
     101          PRINTF(2)("Image-Name not specified\n");
    90102          return false;
    91103        }
    92104    }
    93     return false;
    94 }
    95 
     105  return false;
     106}
     107
     108bool Texture::reload()
     109{
     110  if (this->texture != 0)
     111    {
     112      glDeleteTextures(1,&this->texture);
     113      this->texture = 0;
     114    }
     115
     116  if (this->image != NULL)
     117    this->texture = this->loadTexToGL(this->image);
     118 
     119}
     120
     121/**
     122 * converts surface to a new SDL_Surface, that is loadable by openGL
     123 * @param surface the Surface to convert
     124 * @returns a !!new!! Surface, that is loadable by openGL.
     125 */
    96126SDL_Surface* Texture::prepareSurface(SDL_Surface* surface)
    97127{
     
    118148#endif
    119149                               );
    120   if ( image == NULL ) {
    121     return 0;
    122   }
     150  if ( image == NULL )
     151    return NULL;
    123152 
    124153  /* Save the alpha blending attributes */
  • trunk/src/lib/util/executor/executor_specials.h

    r5691 r5754  
    99#include "executor.h"
    1010
     11#include "compiler.h"
    1112#include "tinyxml.h"
    1213// FORWARD DECLARATION
Note: See TracChangeset for help on using the changeset viewer.