Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3358 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jan 6, 2005, 9:21:13 PM (20 years ago)
Author:
patrick
Message:

orxonox/branches/parenting: imageloader works. but not yet fully implemented

Location:
orxonox/branches/parenting/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/glmenu_imagescreen.cc

    r3357 r3358  
    1818
    1919#include "glmenu_imagescreen.h"
    20 
     20#include "importer/texture.h"
    2121
    2222using namespace std;
     
    4646*/
    4747void GLMenuImageScreen::init ()
    48 {}
     48{
     49  int w = 680;
     50  int h = 480;
     51
     52  glViewport(0,0,w,h);
     53 
     54  glMatrixMode(GL_PROJECTION);
     55  glLoadIdentity();
     56  gluPerspective(45.0f,(GLfloat)w/(GLfloat)h, .5f ,150.0f);
     57  glMatrixMode(GL_MODELVIEW);
     58
     59  this->backTex = new Texture();
     60  this->backTex->loadImage("orx_tex.bmp");
     61
     62  /* ------------painten */
     63
     64  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     65  glLoadIdentity();
     66  gluLookAt(0, 0, 6,     0, 0, 0,     0, 1, 0);
     67
     68  // Bind the texture stored at the zero index of g_Texture[]
     69  //glBindTexture(GL_TEXTURE_2D, g_Texture[0]);
     70}
    4971
    5072
     
    6991*/
    7092void GLMenuImageScreen::draw ()
    71 {}
     93{
     94  // Display a quad texture to the screen
     95  glBegin(GL_QUADS);
     96 
     97  // Display the top left vertice
     98  glTexCoord2f(0.0f, 1.0f);
     99  glVertex3f(-2.5, 2.5, 0);
     100 
     101  // Display the bottom left vertice
     102  glTexCoord2f(0.0f, 0.0f);
     103  glVertex3f(-2.5, -2.5, 0);
     104 
     105  // Display the bottom right vertice
     106  glTexCoord2f(1.0f, 0.0f);
     107  glVertex3f(2.5, -2.5, 0);
     108 
     109  // Display the top right vertice
     110  glTexCoord2f(1.0f, 1.0f);
     111  glVertex3f(2.5, 2.5, 0);
     112
     113  glEnd();
     114 
     115  SDL_GL_SwapBuffers();                   
     116
     117  delete this->backTex;
     118  SDL_Delay(1000);
     119}
    72120
    73121 
  • orxonox/branches/parenting/src/glmenu_imagescreen.h

    r3357 r3358  
    1010#include "stdincl.h"
    1111
     12class Texture;
    1213
    1314class GLMenuImageScreen : public BaseObject {
     
    3132  float height, width;
    3233  float offsetX, offsetY;
    33 
     34  Texture* backTex;
     35 
    3436};
    3537
  • orxonox/branches/parenting/src/world.cc

    r3356 r3358  
    2727#include "null_parent.h"
    2828#include "helper_parent.h"
    29 #include "importer/texture.h"
     29#include "glmenu_imagescreen.h"
    3030
    3131using namespace std;
     
    6868  this->nullParent->destroy ();
    6969
    70   //delete this->testCurve;
     70  //delete this->trackManager;
    7171
    7272  /*
     
    107107  //gluNurbsProperty (theNurb, GLU_NURBS_MODE, GLU_NURBS_TESSELLATOR);
    108108  //gluNurbsProperty (theNurb, GLU_NURBS_VERTEX, vertexCallback );
     109
    109110}
    110111
     
    145146  printf ("World::displayLoadScreen - start\n");
    146147 
    147   int w = 680;
    148   int h = 480;
    149 
    150   glViewport(0,0,w,h);
    151  
    152   glMatrixMode(GL_PROJECTION);
    153   glLoadIdentity();
    154   gluPerspective(45.0f,(GLfloat)w/(GLfloat)h, .5f ,150.0f);
    155   glMatrixMode(GL_MODELVIEW);
    156 
    157   Texture* loadScreenTexture = new Texture();
    158   loadScreenTexture->loadImage("orx_tex.bmp");
    159 
    160   /* ------------painten */
    161 
    162   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    163   glLoadIdentity();
    164   gluLookAt(0, 0, 6,     0, 0, 0,     0, 1, 0);
    165 
    166   // Bind the texture stored at the zero index of g_Texture[]
    167   //glBindTexture(GL_TEXTURE_2D, g_Texture[0]);
    168  
    169   // Display a quad texture to the screen
    170   glBegin(GL_QUADS);
    171  
    172   // glTexCoord2f() takes the X and Y offset (or U and V) into the bitmap.
    173   // Then, the next point sent to be rendered attaches that part of the bitmap
    174   // to itself.  The (U, V) coordinates range from (0, 0) being the top left corner
    175   // of the bitmap, to (1, 1) being the bottom left corner of the bitmap.
    176   // You can go above 1 but it just is wrapped around back to zero and repeats the texture.
    177   // Try setting the 1's to 2's and see what it does, then try setting them to 0.5's.
    178   // The higher the number, the more instances of the texture will appear on the square,
    179   // Where the lower the number, it stretches the incomplete texture over the surface of the square.
    180   // For every vertice we need a U V coordinate, as shown below.  You might have to play
    181   // around with the values to make it texture correctly, otherwise it will be flipped, upside down,
    182   // or skewed.  It also depends on where you are looking at it.  We are looking down the -Z axis.
    183  
    184   // Display the top left vertice
    185   glTexCoord2f(0.0f, 1.0f);
    186   glVertex3f(-2.5, 2.5, 0);
    187  
    188   // Display the bottom left vertice
    189   glTexCoord2f(0.0f, 0.0f);
    190   glVertex3f(-2.5, -2.5, 0);
    191  
    192   // Display the bottom right vertice
    193   glTexCoord2f(1.0f, 0.0f);
    194   glVertex3f(2.5, -2.5, 0);
    195  
    196   // Display the top right vertice
    197   glTexCoord2f(1.0f, 1.0f);
    198   glVertex3f(2.5, 2.5, 0);
    199 
    200   glEnd();
    201  
    202   SDL_GL_SwapBuffers();                   
    203 
    204   delete loadScreenTexture;
    205   SDL_Delay (1000);
     148  GLMenuImageScreen* glmis = new GLMenuImageScreen();
     149  glmis->init();
     150  glmis->draw();
     151 
    206152  printf ("World::displayLoadScreen - end\n");
    207153}
Note: See TracChangeset for help on using the changeset viewer.