Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3405 in orxonox.OLD for orxonox/branches/dave/src/world.cc


Ignore:
Timestamp:
Feb 13, 2005, 9:10:20 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/dave: Fixed issue with texture-class

  1. Not using Texture but Material class
  2. TextureCoordinates are set even along the whole surface, this just streches the little Map to the whole scene
  3. enabled textures, using glEnable(GL_TEXTURE_2D)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/dave/src/world.cc

    r3404 r3405  
    2828#include "helper_parent.h"
    2929#include "glmenu_imagescreen.h"
     30#include "importer/material.h"
    3031
    3132using namespace std;
     
    372373   
    373374 
     375  // Initializing the Ground, and loading a Texture into it.
     376  Material* boden = new Material("Ground");
     377  boden->setDiffuseMap("../data/pictures/ground.tga");
     378  // Setting the illumination mode otherwise it is flat-shaded.
     379  boden->setIllum(3);
     380
    374381  objectList = glGenLists(1);
    375382  glNewList (objectList, GL_COMPILE);
     
    377384  //glColor3f(1.0,0,0);
    378385 
    379   //BodenTextur reinladen
    380   Texture* boden=new Texture();
    381   boden->loadImage("../data/pictures/ground.tga");
    382  
     386  // Enabling Textures
     387  glEnable(GL_TEXTURE_2D);
     388 
     389  // Selecting the new Ground Material.
     390  boden->select();
    383391 
    384392 
     
    453461        }
    454462        glNormal3f(normal_vectors[i][j].x, normal_vectors[i][j].y, normal_vectors[i][j].z);
    455         glTexCoord2f(0.0f,0.0f);
     463        glTexCoord2f((float)i/(float)sizeX,(float)j/(float)sizeZ);
    456464        glVertex3f(v1.x, v1.y, v1.z);
     465
     466
    457467        if(height[i+1][j]<snowheight){
    458468          a[0]=0;
     
    466476          a[2]=1.0;
    467477          glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    468          
    469478        }
    470479        glNormal3f(normal_vectors[i+1][j].x, normal_vectors[i+1][j].y, normal_vectors[i+1][j].z);
    471         glTexCoord2f(1.0f,0.0f);
     480        glTexCoord2f((float)(i+1.0)/(float)sizeX,(float)j/(float)sizeZ);
    472481        glVertex3f(v2.x, v2.y, v2.z);
     482
    473483        if(height[i+1][j+1]<snowheight){
    474484          a[0]=0;
     
    482492          a[2]=1.0;
    483493          glMaterialfv(GL_FRONT,GL_DIFFUSE,a);
    484          
    485          
    486494        }
    487495        glNormal3f(normal_vectors[i+1][j+1].x, normal_vectors[i+1][j+1].y, normal_vectors[i+1][j+1].z);
    488         glTexCoord2f(1.0f,1.0f);
     496        glTexCoord2f((float)(i+1.0)/(float)sizeX,(float)(j+1.0)/(float)sizeZ);
    489497        glVertex3f(v3.x, v3.y, v3.z);
     498
    490499        if(height[i][j+1]<snowheight){
    491500          a[0]=0;
     
    501510        }
    502511        glNormal3f(normal_vectors[i][j+1].x, normal_vectors[i][j+1].y, normal_vectors[i][j+1].z);
    503         glTexCoord2f(0.0f,1.0f);
     512        glTexCoord2f((float)(i)/(float)sizeX,(float)(j+1.0)/(float)sizeZ);
    504513        glVertex3f(v4.x, v4.y, v4.z);
    505514       
    506515      }
    507516  glEnd();
     517 
     518  // Disable Textures Again, for Performance reasons.
     519  glDisable(GL_TEXTURE_2D);
     520
    508521  /* 
    509522  glBegin(GL_LINES);
Note: See TracChangeset for help on using the changeset viewer.