- Timestamp:
- Jan 6, 2005, 9:21:13 PM (20 years ago)
- Location:
- orxonox/branches/parenting/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/glmenu_imagescreen.cc
r3357 r3358 18 18 19 19 #include "glmenu_imagescreen.h" 20 20 #include "importer/texture.h" 21 21 22 22 using namespace std; … … 46 46 */ 47 47 void 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 } 49 71 50 72 … … 69 91 */ 70 92 void 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 } 72 120 73 121 -
orxonox/branches/parenting/src/glmenu_imagescreen.h
r3357 r3358 10 10 #include "stdincl.h" 11 11 12 class Texture; 12 13 13 14 class GLMenuImageScreen : public BaseObject { … … 31 32 float height, width; 32 33 float offsetX, offsetY; 33 34 Texture* backTex; 35 34 36 }; 35 37 -
orxonox/branches/parenting/src/world.cc
r3356 r3358 27 27 #include "null_parent.h" 28 28 #include "helper_parent.h" 29 #include " importer/texture.h"29 #include "glmenu_imagescreen.h" 30 30 31 31 using namespace std; … … 68 68 this->nullParent->destroy (); 69 69 70 //delete this->t estCurve;70 //delete this->trackManager; 71 71 72 72 /* … … 107 107 //gluNurbsProperty (theNurb, GLU_NURBS_MODE, GLU_NURBS_TESSELLATOR); 108 108 //gluNurbsProperty (theNurb, GLU_NURBS_VERTEX, vertexCallback ); 109 109 110 } 110 111 … … 145 146 printf ("World::displayLoadScreen - start\n"); 146 147 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 206 152 printf ("World::displayLoadScreen - end\n"); 207 153 }
Note: See TracChangeset
for help on using the changeset viewer.