Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8037 in orxonox.OLD for trunk/src/lib/graphics/importer


Ignore:
Timestamp:
May 31, 2006, 4:52:34 PM (18 years ago)
Author:
bensch
Message:

trunk: merged the water back
merged with command
svn merge -r7798:HEAD https://svn.orxonox.net/orxonox/branches/water .

conflicts are all resolved

Location:
trunk/src/lib/graphics/importer
Files:
2 edited

Legend:

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

    r7922 r8037  
    108108      return true;
    109109
     110/// !!  HACK !!! FIX THIS IN MODEL ///
     111  else if (likely(Material::selectedMaterial != NULL))
     112  {
     113  Material::unselect();
     114//     for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i)
     115//     {
     116//         glActiveTexture(Material::glTextureArbs[i]);
     117//         glBindTexture(GL_TEXTURE_2D, 0);
     118//         glDisable(GL_TEXTURE_2D);
     119//     }
     120  }
     121
    110122  if (likely(Material::selectedMaterial != NULL))
    111123  {
     
    146158    glShadeModel(GL_SMOOTH);
    147159
    148 
    149160  for(unsigned int i = 0; i < this->textures.size(); ++i)
    150161  {
     
    160171}
    161172
     173void Material::unselect()
     174{
     175  Material::selectedMaterial = NULL;
     176    for(unsigned int i = 0; i < 8; ++i)
     177    {
     178        glActiveTexture(Material::glTextureArbs[i]);
     179        glBindTexture(GL_TEXTURE_2D, 0);
     180        glDisable(GL_TEXTURE_2D);
     181    }
     182}
     183
    162184/**
    163185 *  Sets the Material Illumination Model.
     
    366388}
    367389
     390/**
     391 * @brief renders viewport buffer (?? or another buffer ;-)) to a texture
     392 * @param textureNumber select the texture unit that will be overwritten
     393*/
     394void Material::renderToTexture(unsigned int textureNumber, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
     395{
     396  assert(textureNumber < Material::getMaxTextureUnits());
     397  assert(textureNumber < this->textures.size());
     398
     399  glActiveTexture(0);
     400   glEnable(GL_TEXTURE_2D);
     401   glBindTexture(GL_TEXTURE_2D, this->textures[textureNumber].getTexture());
     402  glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
     403
     404}
    368405
    369406/**
    370407 * @brief Sets the Materials Ambient Map
    371  * @param aMap the Name of the Image to Use
    372    @todo implement this
     408 * @todo implement this
    373409*/
    374410void Material::setAmbientMap(const std::string& aMap, GLenum target)
  • trunk/src/lib/graphics/importer/material.h

    r7919 r8037  
    3030
    3131    bool select () const;
     32    bool activateTextureUnit(unsigned int textureNumber);
     33    static void unselect();
    3234
    3335    void setIllum (int illum);
     
    5557    void setDiffuseMap(const std::string& dMap, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
    5658    void setSDLDiffuseMap(SDL_Surface *surface, GLenum target = GL_TEXTURE_2D, unsigned int textureNumber = 0);
     59    void renderToTexture(unsigned int textureNumber, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
    5760
    5861    void setAmbientMap(const std::string& aMap, GLenum target = GL_TEXTURE_2D);
Note: See TracChangeset for help on using the changeset viewer.