Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3526 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Mar 13, 2005, 8:00:25 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: better ModelView-matrix transformations

Location:
orxonox/trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/orxonox.cc

    r3449 r3526  
    173173  // SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); 
    174174
    175   // OpenGL stuff
    176   glClearColor (0.0, 0.0, 0.0, 0.0);
    177   glEnable (GL_DEPTH_TEST);
    178    
    179175  return 0;
    180176}
  • orxonox/trunk/src/story_entities/world.cc

    r3522 r3526  
    4141World::World (char* name)
    4242{
    43   this->setClassName ("World");
    44   this->worldName = name;
    45   this->debugWorldNr = -1;
    46   this->entities = new tList<WorldEntity>();
     43  this->init(name, -1);
    4744}
    4845
     
    5350World::World (int worldID)
    5451{
    55   this->debugWorldNr = worldID;
    56   this->worldName = NULL;
    57   this->entities = new tList<WorldEntity>();
     52  this->init(NULL, worldID);
    5853}
    5954
     
    9489  /* this->localPlayer hasn't to be deleted explicitly, it is
    9590     contained in entities*/
     91}
     92
     93/**
     94   \brief initializes a new World
     95*/
     96void World::init(char* name, int worldID)
     97{
     98  this->setClassName ("World");
     99
     100  this->worldName = name;
     101  this->debugWorldNr = worldID;
     102  this->entities = new tList<WorldEntity>();
     103
     104  // Enable default GL stuff
     105  glEnable(GL_DEPTH_TEST);
     106
    96107}
    97108
     
    289300  objectList = glGenLists(1);
    290301  glNewList (objectList, GL_COMPILE);
    291   glLoadIdentity();
     302
    292303  glColor3f(1.0,0,0);
    293   glBegin(GL_QUADS);
    294304
    295305  int sizeX = 100;
     
    338348      }
    339349
     350  glBegin(GL_QUADS);
    340351  int snowheight=3;
    341352  for ( int i = 0; i<sizeX; i+=1)
     
    410421      }
    411422  glEnd();
    412   /* 
    413   glBegin(GL_LINES);
    414   for( float x = -128.0; x < 128.0; x += 25.0)
    415     {
    416       for( float y = -128.0; y < 128.0; y += 25.0)
    417         {
    418           glColor3f(1,0,0);
    419           glVertex3f(x,y,-128.0);
    420           glVertex3f(x,y,0.0);
    421           glColor3f(0.5,0,0);
    422           glVertex3f(x,y,0.0);
    423           glVertex3f(x,y,128.0);
    424         }
    425     }
    426   for( float y = -128.0; y < 128.0; y += 25.0)
    427     {
    428       for( float z = -128.0; z < 128.0; z += 25.0)
    429         {
    430           glColor3f(0,1,0);
    431           glVertex3f(-128.0,y,z);
    432           glVertex3f(0.0,y,z);
    433           glColor3f(0,0.5,0);
    434           glVertex3f(0.0,y,z);
    435           glVertex3f(128.0,y,z);
    436         }
    437     }
    438   for( float x = -128.0; x < 128.0; x += 25.0)
    439     {
    440       for( float z = -128.0; z < 128.0; z += 25.0)
    441         {
    442           glColor3f(0,0,1);
    443           glVertex3f(x,-128.0,z);
    444           glVertex3f(x,0.0,z);
    445           glColor3f(0,0,0.5);
    446           glVertex3f(x,0.0,z);
    447           glVertex3f(x,128.0,z);
    448         }
    449      
    450     }
    451   */ 
    452   /*
    453   glBegin(GL_LINE_STRIP);
    454   glColor3f(1.0, 5.0, 1.0);
    455   for( int i = 0; i <= 30; i++)
    456     {
    457       glEvalCoord1f ((GLfloat) i/30.0);
    458     }
    459   glEnd();
    460   */
    461423
    462424  trackManager->drawGraph(.01);
    463425  trackManager->debug(2);
    464   /* 
    465   glBegin(GL_LINES);
    466   float i;
    467   for(i = 0.0; i<1; i+=.01)
    468     {
    469       printf("%f, %f, %f\n",tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
    470       glVertex3f(tmpCurve->calcPos(i).x, tmpCurve->calcPos(i).y, tmpCurve->calcPos(i).z);
    471     }
    472   glEnd();
    473   */
    474426  glEndList();
     427
     428
    475429  // LIGHT initialisation
    476430  light = Light::getInstance();
     
    635589  /* draw entities */
    636590  WorldEntity* entity;
     591  glLoadIdentity();
     592
    637593  entity = this->entities->enumerate();
    638594  while( entity != NULL )
  • orxonox/trunk/src/story_entities/world.h

    r3521 r3526  
    5757
    5858 private:
     59  void init(char* name, int worldID);
     60
    5961  Uint32 lastFrame;             //!< last time of frame
    6062  bool bQuitOrxonox;            //!< quit this application
  • orxonox/trunk/src/world_entities/environment.cc

    r3484 r3526  
    5050{
    5151  glMatrixMode(GL_MODELVIEW);
    52   glLoadIdentity();
     52  glPushMatrix();
    5353  float matrix[4][4];
    5454 
     
    5959 
    6060  this->model->draw();
     61
     62  glPopMatrix();
    6163}
    6264
  • orxonox/trunk/src/world_entities/player.cc

    r3484 r3526  
    2929Player::Player(bool isFree) : WorldEntity(isFree)
    3030{
    31 
    3231  this->model = new OBJModel("../data/models/reaplow.obj");
    33   /*
    34   objectList = glGenLists(1);
    35   glNewList (objectList, GL_COMPILE);
    36 
    37   glBegin(GL_TRIANGLES);
    38   glColor3f(1,1,1);
    39   glVertex3f(0,0,0.5);
    40   glVertex3f(-0.5,0,-1);
    41   glVertex3f(0.5,0,-1);
    42 
    43   glVertex3f(0,0,0.5);
    44   glVertex3f(0,0.5,-1);
    45   glVertex3f(0,-0.5,-1);
    46   glEnd();
    47    
    48   glBegin(GL_QUADS);
    49   glColor3f(0,0,1);
    50   glVertex3f(0.5,0.5,-1);
    51   glVertex3f(0.5,-0.5,-1);
    52   glVertex3f(-0.5,-0.5,-1);
    53   glVertex3f(-0.5,0.5,-1);
    54   glEnd();
    55  
    56   glEndList ();
    57   */
    5832}
    5933
     
    137111{
    138112  glMatrixMode(GL_MODELVIEW);
    139   glLoadIdentity();
     113  glPushMatrix();
    140114  float matrix[4][4];
    141115 
     
    148122  glMultMatrixf((float*)matrix);
    149123 
    150   glMatrixMode(GL_MODELVIEW);
    151124  this->model->draw();
    152   // glCallList(objectList);
     125  glPopMatrix();
    153126}
    154127
  • orxonox/trunk/src/world_entities/primitive.cc

    r3524 r3526  
    5555{
    5656  glMatrixMode(GL_MODELVIEW);
    57   glLoadIdentity();
     57  glPushMatrix();
    5858  float matrix[4][4];
    5959 
     
    6464 
    6565  this->model->draw();
     66  glPopMatrix();
    6667}
    6768
  • orxonox/trunk/src/world_entities/skysphere.cc

    r3507 r3526  
    9999{
    100100  glEnable(GL_TEXTURE_2D);
    101   skyMaterial->select();
    102101  glPushMatrix();
     102  glMatrixMode(GL_MODELVIEW);
    103103  glTranslatef(this->absCoordinate.x,
    104104               this->absCoordinate.y,
     
    109109  //glRotatef(-250.0f, 0.0, 1.0f, 0.0f);
    110110 
     111  skyMaterial->select();
    111112  gluSphere(sphereObj, sphereRadius, 20, 20);
    112113  glPopMatrix();
Note: See TracChangeset for help on using the changeset viewer.