Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

general.h File Reference

#include "shared.h"
#include "polygon.h"
#include "texture.h"
#include "camera.h"
#include "light.h"

Go to the source code of this file.

Functions

void SetGLLighting (LIGHT *)
void SetGLCamera (CAMERA *)
void SetGLWorld (POLYGON *)
void SetGLProperties ()
void SetGLProjection (int Width, int Height)
void SetGLView (int Width, int Height)
void SetGLMaterial ()
void SetGLLighting ()
void SetGLTexture (TEXTURE *)
void DrawMyText ()
void DrawSkybox (CAMERA *camera, TEXTURE *texture)
void DrawTerrain (TEXTURE *texture)
void DrawGrid ()
void DrawCube (POLYGON *, TEXTURE *)
void DrawSphere ()
void DrawLightSphere (LIGHT *)
void DrawCone ()
float GetTimePassed (float &lasttime, int average, float *lastmultiplier)


Function Documentation

void DrawCone  
 

Definition at line 543 of file general.cpp.

Referenced by DrawGLScene().

00544 {
00545     float mat_ambient[] = { 0.1, 0.5, 1.0, 1.0 };
00546     float mat_diffuse[] = { 0.1, 0.5, 1.0, 1.0 };
00547     glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
00548     glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
00549 
00550     glDisable(GL_TEXTURE_2D);
00551     glDisable(GL_CULL_FACE);
00552     glPushMatrix();
00553     glTranslatef(3.0f,-2.0f,-8.0f);
00554     glRotatef(-90,1,0,0);
00555     GLUquadricObj * cylinder = gluNewQuadric();
00556     gluQuadricOrientation(cylinder, GLU_OUTSIDE);
00557     gluCylinder(cylinder,1.0,0.0,2.0,20,20);
00558     glPopMatrix();
00559     glEnable(GL_CULL_FACE);
00560     glEnable(GL_TEXTURE_2D);
00561 }

void DrawCube POLYGON  ,
TEXTURE  
 

Definition at line 425 of file general.cpp.

References polygon.

Referenced by DrawGLScene().

00426 {
00427     float mat_ambient[] = { 0.8, 0.8, 0.8, 1.0 };
00428     float mat_diffuse[] = { 0.8, 0.8, 0.8, 1.0 };
00429     glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
00430     glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
00431 
00432     glBindTexture(GL_TEXTURE_2D, texture[0].TexID);
00433 
00434     glPushMatrix();
00435     glBegin(GL_TRIANGLES);
00436         // Front Face
00437             glNormal3fv(&polygon[0].Vertex[0].nx);
00438         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[0].Vertex[0].x);
00439         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&polygon[0].Vertex[1].x);
00440         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[0].Vertex[2].x);
00441 
00442         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[1].Vertex[0].x);
00443         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[1].Vertex[1].x);
00444         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&polygon[1].Vertex[2].x);
00445         // Back Face
00446             glNormal3fv(&polygon[2].Vertex[0].nx);
00447         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[2].Vertex[0].x);
00448         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&polygon[2].Vertex[1].x);
00449         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[2].Vertex[2].x);
00450 
00451         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[3].Vertex[0].x);
00452         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[3].Vertex[1].x);
00453         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&polygon[3].Vertex[2].x);
00454         // Top Face
00455             glNormal3fv(&polygon[4].Vertex[0].nx);
00456         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[4].Vertex[0].x);
00457         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&polygon[4].Vertex[1].x);
00458         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[4].Vertex[2].x);
00459 
00460         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[5].Vertex[0].x);
00461         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[5].Vertex[1].x);
00462         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&polygon[5].Vertex[2].x);
00463         // Bottom Face
00464             glNormal3fv(&polygon[6].Vertex[0].nx);
00465         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[6].Vertex[0].x);
00466         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&polygon[6].Vertex[1].x);
00467         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[6].Vertex[2].x);
00468 
00469         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[7].Vertex[0].x);
00470         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[7].Vertex[1].x);
00471         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&polygon[7].Vertex[2].x);
00472         // Right face
00473             glNormal3fv(&polygon[8].Vertex[0].nx);
00474         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[8].Vertex[0].x);
00475         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&polygon[8].Vertex[1].x);
00476         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[8].Vertex[2].x);
00477 
00478         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[9].Vertex[0].x);
00479         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[9].Vertex[1].x);
00480         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&polygon[9].Vertex[2].x);
00481         // Left Face
00482             glNormal3fv(&polygon[10].Vertex[0].nx);
00483         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[10].Vertex[0].x);
00484         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&polygon[10].Vertex[1].x);
00485         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[10].Vertex[2].x);
00486 
00487         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&polygon[11].Vertex[0].x);
00488         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&polygon[11].Vertex[1].x);
00489         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&polygon[11].Vertex[2].x);
00490     glEnd();
00491     glPopMatrix();
00492 }

void DrawGrid  
 

Definition at line 402 of file general.cpp.

00403 {
00404     glDisable(GL_TEXTURE_2D);
00405     glDisable(GL_LIGHTING);
00406     glPushMatrix();
00407     glTranslatef(0,-2.0,0);
00408     float Line = -10;
00409     int Grid;
00410     glBegin(GL_LINES);
00411     for(Grid = 0; Grid <= 20; Grid += 1)
00412     {
00413         glColor3f(0.0f,1.0f,0.0f);
00414         glVertex3f(Line + Grid, 0, -10);
00415         glVertex3f(Line + Grid, 0, 10);
00416         glVertex3f(-10, 0, Line + Grid);
00417         glVertex3f(10, 0, Line + Grid);
00418     }
00419     glEnd();
00420     glPopMatrix();
00421     glEnable(GL_TEXTURE_2D);
00422     glEnable(GL_LIGHTING);
00423 }

void DrawLightSphere LIGHT  
 

void DrawMyText  
 

Definition at line 245 of file general.cpp.

References fps, glFontBegin(), glFontEnd(), and glFontTextOut().

Referenced by DrawGLScene().

00246 {
00247     glBlendFunc(GL_ONE,  GL_ONE_MINUS_SRC_ALPHA) ;
00248     glDisable(GL_LIGHTING);
00249     glColor3f(0.0, 1.0, 0.0);
00250     glEnable(GL_BLEND);
00251     glDisable(GL_DEPTH_TEST);
00252     glPushMatrix();
00253     glLoadIdentity();
00254     glFontBegin(&myFont);
00255     char text[256];
00256 
00257     glFontTextOut("Tutorial #18  (Skybox & Lensflare)", -52, 40, -100);
00258 
00259     sprintf(text, "FPS = %d", fps);
00260     glFontTextOut(text, -52, 38, -100);
00261 
00262     sprintf(text, "%s", "Press R to change the lensflare");
00263     glFontTextOut(text, -52, 34, -100);
00264 
00265     glFontEnd();
00266     glPopMatrix();
00267     glEnable(GL_DEPTH_TEST);
00268     glDisable(GL_BLEND);
00269     glEnable(GL_LIGHTING);
00270 }

void DrawSkybox CAMERA   camera,
TEXTURE   texture
 

Definition at line 272 of file general.cpp.

References currentCamera, GetNormal(), VECTOR::x, VECTOR::y, and VECTOR::z.

Referenced by DrawGLScene().

00273 {
00274     VECTOR facenormal;
00275     VECTOR SkyboxVertex[8];
00276 
00277     // make the skybox relative to the camera position
00278     SkyboxVertex[0].x = camera[currentCamera].Position.x - 50.0;
00279     SkyboxVertex[0].y = camera[currentCamera].Position.y - 10.0;
00280     SkyboxVertex[0].z = camera[currentCamera].Position.z + 50.0;
00281 
00282     SkyboxVertex[1].x = camera[currentCamera].Position.x - 50.0;
00283     SkyboxVertex[1].y = camera[currentCamera].Position.y - 10.0;
00284     SkyboxVertex[1].z = camera[currentCamera].Position.z - 50.0;
00285 
00286     SkyboxVertex[2].x = camera[currentCamera].Position.x + 50.0;
00287     SkyboxVertex[2].y = camera[currentCamera].Position.y - 10.0;
00288     SkyboxVertex[2].z = camera[currentCamera].Position.z - 50.0;
00289 
00290     SkyboxVertex[3].x = camera[currentCamera].Position.x + 50.0;
00291     SkyboxVertex[3].y = camera[currentCamera].Position.y - 10.0;
00292     SkyboxVertex[3].z = camera[currentCamera].Position.z + 50.0;
00293 
00294     SkyboxVertex[4].x = camera[currentCamera].Position.x - 50.0;
00295     SkyboxVertex[4].y = camera[currentCamera].Position.y + 20.0;
00296     SkyboxVertex[4].z = camera[currentCamera].Position.z + 50.0;
00297 
00298     SkyboxVertex[5].x = camera[currentCamera].Position.x - 50.0;
00299     SkyboxVertex[5].y = camera[currentCamera].Position.y + 20.0;
00300     SkyboxVertex[5].z = camera[currentCamera].Position.z - 50.0;
00301 
00302     SkyboxVertex[6].x = camera[currentCamera].Position.x + 50.0;
00303     SkyboxVertex[6].y = camera[currentCamera].Position.y + 20.0;
00304     SkyboxVertex[6].z = camera[currentCamera].Position.z - 50.0;
00305 
00306     SkyboxVertex[7].x = camera[currentCamera].Position.x + 50.0;
00307     SkyboxVertex[7].y = camera[currentCamera].Position.y + 20.0;
00308     SkyboxVertex[7].z = camera[currentCamera].Position.z + 50.0;
00309 
00310     glDisable(GL_CULL_FACE);
00311     glDisable(GL_LIGHTING);
00312     glPushMatrix();
00313     glColor3f(1.0f, 1.0f, 1.0f);
00314 
00315     // Left Face
00316     glBindTexture(GL_TEXTURE_2D, texture[1].TexID);
00317     glBegin(GL_QUADS);
00318         facenormal = GetNormal(SkyboxVertex[6], SkyboxVertex[0], SkyboxVertex[3]);
00319         glNormal3fv(&facenormal.x);
00320         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&SkyboxVertex[0].x);
00321         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&SkyboxVertex[1].x);
00322         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&SkyboxVertex[5].x);
00323         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&SkyboxVertex[4].x);
00324     glEnd();
00325 
00326     // Back Face
00327     glBindTexture(GL_TEXTURE_2D, texture[2].TexID);
00328     glBegin(GL_QUADS);
00329         facenormal = GetNormal(SkyboxVertex[4], SkyboxVertex[5], SkyboxVertex[7]);
00330         glNormal3fv(&facenormal.x);
00331         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&SkyboxVertex[1].x);
00332         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&SkyboxVertex[2].x);
00333         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&SkyboxVertex[6].x);
00334         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&SkyboxVertex[5].x);
00335     glEnd();
00336 
00337     // Right Face
00338     glBindTexture(GL_TEXTURE_2D, texture[3].TexID);
00339     glBegin(GL_QUADS);
00340         facenormal = GetNormal(SkyboxVertex[1], SkyboxVertex[7], SkyboxVertex[5]);
00341         glNormal3fv(&facenormal.x);
00342         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&SkyboxVertex[2].x);
00343         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&SkyboxVertex[3].x);
00344         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&SkyboxVertex[7].x);
00345         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&SkyboxVertex[6].x);
00346     glEnd();
00347 
00348     // Front Face
00349     glBindTexture(GL_TEXTURE_2D, texture[4].TexID);
00350     glBegin(GL_QUADS);
00351         glColor3f(1.0f,1.0f,1.0f);
00352         facenormal = GetNormal(SkyboxVertex[0], SkyboxVertex[1], SkyboxVertex[2]);
00353         glNormal3fv(&facenormal.x);
00354         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&SkyboxVertex[3].x);
00355         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&SkyboxVertex[0].x);
00356         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&SkyboxVertex[4].x);
00357         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&SkyboxVertex[7].x);
00358     glEnd();
00359 
00360     // Top Face
00361     glBindTexture(GL_TEXTURE_2D, texture[5].TexID);
00362     glBegin(GL_QUADS);
00363         facenormal = GetNormal(SkyboxVertex[3], SkyboxVertex[2], SkyboxVertex[5]);
00364         glNormal3fv(&facenormal.x);
00365         glTexCoord2f(0.0f, 0.0f); glVertex3fv(&SkyboxVertex[7].x);
00366         glTexCoord2f(1.0f, 0.0f); glVertex3fv(&SkyboxVertex[4].x);
00367         glTexCoord2f(1.0f, 1.0f); glVertex3fv(&SkyboxVertex[5].x);
00368         glTexCoord2f(0.0f, 1.0f); glVertex3fv(&SkyboxVertex[6].x);
00369     glEnd();
00370 
00371     glPopMatrix();
00372     glEnable(GL_CULL_FACE);
00373     glEnable(GL_LIGHTING);
00374 }

void DrawSphere  
 

Definition at line 526 of file general.cpp.

Referenced by DrawGLScene().

00527 {
00528     float mat_ambient[] = { 0.8, 0.5, 0.1, 1.0 };
00529     float mat_diffuse[] = { 0.8, 0.5, 0.1, 1.0 };
00530     glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
00531     glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
00532 
00533     glDisable(GL_TEXTURE_2D);
00534     glPushMatrix();
00535     glTranslatef(-3.0f,-1.0f,-8.0f);
00536     GLUquadricObj * sphere = gluNewQuadric();
00537     gluQuadricOrientation(sphere, GLU_OUTSIDE);
00538     gluSphere(sphere,1.0,50,50);
00539     glPopMatrix();
00540     glEnable(GL_TEXTURE_2D);
00541 }

void DrawTerrain TEXTURE   texture
 

Definition at line 376 of file general.cpp.

Referenced by DrawGLScene().

00377 {
00378     float mat_ambient[] = { 0.8, 0.8, 0.8, 1.0 };
00379     float mat_diffuse[] = { 0.8, 0.8, 0.8, 1.0 };
00380     glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
00381     glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
00382 
00383     glBindTexture(GL_TEXTURE_2D, texture[7].TexID);
00384 
00385     glDisable(GL_CULL_FACE);
00386     glPushMatrix();
00387     glBegin(GL_QUADS);
00388         glNormal3f(0.0, 1.0, 0.0);
00389         glTexCoord2f( 0.0f, 0.0f );
00390         glVertex3f(-10.0, -2.0, 10.0);
00391         glTexCoord2f( 1.0f, 0.0f );
00392         glVertex3f(10.0, -2.0, 10.0);
00393         glTexCoord2f( 1.0f, 1.0f );
00394         glVertex3f(10.0, -2.0, -10.0);
00395         glTexCoord2f( 0.0f, 1.0f );
00396         glVertex3f(-10, -2.0, -10.0);
00397     glEnd();
00398     glPopMatrix();
00399     glEnable(GL_CULL_FACE);
00400 }

float GetTimePassed float &    lasttime,
int    average,
float *    lastmultiplier
 

Definition at line 563 of file general.cpp.

References average, fps, lastmultiplier, lasttime, and multiplier.

Referenced by WinMain().

00564 {
00565     float timeoffset;
00566     float currenttime;
00567 /*
00568 If the program has just started, set last tickcount to the current tickcount.
00569 This prevents the program from thinking that several hours have passed since the last frame.
00570 */
00571     if (lasttime == 0)
00572         lasttime = (float)GetTickCount();
00573         // Get the current time
00574     currenttime = (float)GetTickCount();
00575         // Calculate the offset
00576     timeoffset = currenttime - lasttime;
00577     // If timeoffset less than 1/120 of a second (in milliseconds) then set to minimum offset
00578     if (timeoffset < 8.333333)
00579     {
00580         timeoffset = 8.333333;
00581         currenttime = lasttime + timeoffset;
00582     }
00583     // Put the current time in the lasttime variable
00584         lasttime = currenttime;
00585     // return the time offset in seconds per frame
00586         multiplier = timeoffset / 1000;
00587     for (int loop = 0; loop < average - 1; loop++)
00588     {
00589         lastmultiplier[loop] = lastmultiplier[loop + 1];
00590     }
00591     lastmultiplier[average - 1] = multiplier;
00592     for (int loop = 0; loop < average - 1; loop++)
00593         multiplier += lastmultiplier[loop];
00594     multiplier /= (float)average; 
00595         if (multiplier)
00596         fps = (int)(1.0 / multiplier);
00597     return multiplier;
00598 }

void SetGLCamera CAMERA  
 

Definition at line 30 of file general.cpp.

References numCameras, and CAMERA::Reset().

Referenced by InitGL().

00031 {
00032     int temp;
00033     for(temp = 0; temp <= numCameras; temp++)
00034         camera[temp].Reset();
00035 }

void SetGLLighting  
 

Definition at line 19 of file general.cpp.

References LIGHT::LightNumber, numLights, and LIGHT::Reset().

Referenced by InitGL().

00020 {
00021     int temp;
00022     for (temp = 0; temp <= numLights; temp++)
00023     {
00024         light[temp].LightNumber = temp;
00025         light[temp].Reset();
00026     }
00027     glEnable(GL_LIGHTING);
00028 }

void SetGLLighting LIGHT  
 

void SetGLMaterial  
 

Definition at line 203 of file general.cpp.

Referenced by InitGL().

00204 {
00205     float mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 };
00206     float mat_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
00207     float mat_specular[] = { 0.9, 0.9, 0.9, 1.0 };
00208     float mat_emission[] = { 0.0, 0.0, 0.0, 1.0 };
00209     float mat_shininess[] = { 80.0 };
00210 
00211     glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
00212     glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
00213     glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
00214     glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission);
00215     glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
00216 }

void SetGLProjection int    Width,
int    Height
 

Definition at line 186 of file general.cpp.

Referenced by SetGLView().

00187 {
00188     if (Height==0)
00189         Height=1;
00190     glViewport(0, 0, Width, Height);
00191     glMatrixMode(GL_PROJECTION);
00192     glLoadIdentity();
00193     gluPerspective(45.0,(float)Width/(float)Height,0.5,200.0);
00194 }

void SetGLProperties  
 

Definition at line 174 of file general.cpp.

Referenced by InitGL().

00175 {
00176     glCullFace(GL_BACK);
00177     glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
00178     glClearDepth(1.0);
00179     glDepthFunc(GL_LESS);
00180     glEnable(GL_DEPTH_TEST);
00181     glShadeModel(GL_SMOOTH);
00182     glEnable(GL_NORMALIZE);
00183     glEnable(GL_CULL_FACE);
00184 }

void SetGLTexture TEXTURE  
 

Definition at line 218 of file general.cpp.

References TEXTURE::LoadTGA().

Referenced by InitGL().

00219 {
00220     sprintf(texture[0].TexName, "%s", "tile.tga");
00221     texture[0].LoadTGA();
00222 
00223     sprintf(texture[1].TexName, "%s", "north.tga");
00224     texture[1].LoadTGA();
00225 
00226     sprintf(texture[2].TexName, "%s", "east.tga");
00227     texture[2].LoadTGA();
00228 
00229     sprintf(texture[3].TexName, "%s", "south.tga");
00230     texture[3].LoadTGA();
00231 
00232     sprintf(texture[4].TexName, "%s", "west.tga");
00233     texture[4].LoadTGA();
00234 
00235     sprintf(texture[5].TexName, "%s", "sky.tga");
00236     texture[5].LoadTGA();
00237 
00238     sprintf(texture[6].TexName, "%s", "glare.tga");
00239     texture[6].LoadTGA();
00240 
00241     sprintf(texture[7].TexName, "%s", "terrain.tga");
00242     texture[7].LoadTGA();
00243 }

void SetGLView int    Width,
int    Height
 

Definition at line 196 of file general.cpp.

References SetGLProjection().

Referenced by InitGL(), and ReSizeGLScene().

00197 {
00198     SetGLProjection(Width, Height);
00199     glMatrixMode(GL_MODELVIEW);
00200     glLoadIdentity();
00201 }

void SetGLWorld POLYGON  
 

Definition at line 37 of file general.cpp.

References polygon, POLYGON::SetNormal(), POLYGON::Vertex, VERTEX::x, VERTEX::y, and VERTEX::z.

Referenced by InitGL().

00038 {
00039 //Front
00040     polygon[0].Vertex[0].x = -1.0;
00041     polygon[0].Vertex[0].y = -1.0;
00042     polygon[0].Vertex[0].z = -4.0;
00043     polygon[0].Vertex[1].x = 1.0;
00044     polygon[0].Vertex[1].y = -1.0;
00045     polygon[0].Vertex[1].z = -4.0;
00046     polygon[0].Vertex[2].x = 1.0;
00047     polygon[0].Vertex[2].y = 1.0;
00048     polygon[0].Vertex[2].z = -4.0;
00049 
00050     polygon[1].Vertex[0].x = -1.0;
00051     polygon[1].Vertex[0].y = -1.0;
00052     polygon[1].Vertex[0].z = -4.0;
00053     polygon[1].Vertex[1].x = 1.0;
00054     polygon[1].Vertex[1].y = 1.0;
00055     polygon[1].Vertex[1].z = -4.0;
00056     polygon[1].Vertex[2].x = -1.0;
00057     polygon[1].Vertex[2].y = 1.0;
00058     polygon[1].Vertex[2].z = -4.0;
00059 //Back
00060     polygon[2].Vertex[0].x = 1.0;
00061     polygon[2].Vertex[0].y = -1.0;
00062     polygon[2].Vertex[0].z = -6.0;
00063     polygon[2].Vertex[1].x = -1.0;
00064     polygon[2].Vertex[1].y = -1.0;
00065     polygon[2].Vertex[1].z = -6.0;
00066     polygon[2].Vertex[2].x = -1.0;
00067     polygon[2].Vertex[2].y = 1.0;
00068     polygon[2].Vertex[2].z = -6.0;
00069 
00070     polygon[3].Vertex[0].x = 1.0;
00071     polygon[3].Vertex[0].y = -1.0;
00072     polygon[3].Vertex[0].z = -6.0;
00073     polygon[3].Vertex[1].x = -1.0;
00074     polygon[3].Vertex[1].y = 1.0;
00075     polygon[3].Vertex[1].z = -6.0;
00076     polygon[3].Vertex[2].x = 1.0;
00077     polygon[3].Vertex[2].y = 1.0;
00078     polygon[3].Vertex[2].z = -6.0;
00079 //Left
00080     polygon[4].Vertex[0].x = -1.0;
00081     polygon[4].Vertex[0].y = -1.0;
00082     polygon[4].Vertex[0].z = -6.0;
00083     polygon[4].Vertex[1].x = -1.0;
00084     polygon[4].Vertex[1].y = -1.0;
00085     polygon[4].Vertex[1].z = -4.0;
00086     polygon[4].Vertex[2].x = -1.0;
00087     polygon[4].Vertex[2].y = 1.0;
00088     polygon[4].Vertex[2].z = -4.0;
00089 
00090     polygon[5].Vertex[0].x = -1.0;
00091     polygon[5].Vertex[0].y = -1.0;
00092     polygon[5].Vertex[0].z = -6.0;
00093     polygon[5].Vertex[1].x = -1.0;
00094     polygon[5].Vertex[1].y = 1.0;
00095     polygon[5].Vertex[1].z = -4.0;
00096     polygon[5].Vertex[2].x = -1.0;
00097     polygon[5].Vertex[2].y = 1.0;
00098     polygon[5].Vertex[2].z = -6.0;
00099 //Right
00100     polygon[6].Vertex[0].x = 1.0;
00101     polygon[6].Vertex[0].y = -1.0;
00102     polygon[6].Vertex[0].z = -4.0;
00103     polygon[6].Vertex[1].x = 1.0;
00104     polygon[6].Vertex[1].y = -1.0;
00105     polygon[6].Vertex[1].z = -6.0;
00106     polygon[6].Vertex[2].x = 1.0;
00107     polygon[6].Vertex[2].y = 1.0;
00108     polygon[6].Vertex[2].z = -6.0;
00109 
00110     polygon[7].Vertex[0].x = 1.0;
00111     polygon[7].Vertex[0].y = -1.0;
00112     polygon[7].Vertex[0].z = -4.0;
00113     polygon[7].Vertex[1].x = 1.0;
00114     polygon[7].Vertex[1].y = 1.0;
00115     polygon[7].Vertex[1].z = -6.0;
00116     polygon[7].Vertex[2].x = 1.0;
00117     polygon[7].Vertex[2].y = 1.0;
00118     polygon[7].Vertex[2].z = -4.0;
00119 //Top
00120     polygon[8].Vertex[0].x = 1.0;
00121     polygon[8].Vertex[0].y = 1.0;
00122     polygon[8].Vertex[0].z = -4.0;
00123     polygon[8].Vertex[1].x = 1.0;
00124     polygon[8].Vertex[1].y = 1.0;
00125     polygon[8].Vertex[1].z = -6.0;
00126     polygon[8].Vertex[2].x = -1.0;
00127     polygon[8].Vertex[2].y = 1.0;
00128     polygon[8].Vertex[2].z = -6.0;
00129 
00130     polygon[9].Vertex[0].x = 1.0;
00131     polygon[9].Vertex[0].y = 1.0;
00132     polygon[9].Vertex[0].z = -4.0;
00133     polygon[9].Vertex[1].x = -1.0;
00134     polygon[9].Vertex[1].y = 1.0;
00135     polygon[9].Vertex[1].z = -6.0;
00136     polygon[9].Vertex[2].x = -1.0;
00137     polygon[9].Vertex[2].y = 1.0;
00138     polygon[9].Vertex[2].z = -4.0;
00139 //Bottom
00140     polygon[10].Vertex[0].x = -1.0;
00141     polygon[10].Vertex[0].y = -1.0;
00142     polygon[10].Vertex[0].z = -4.0;
00143     polygon[10].Vertex[1].x = -1.0;
00144     polygon[10].Vertex[1].y = -1.0;
00145     polygon[10].Vertex[1].z = -6.0;
00146     polygon[10].Vertex[2].x = 1.0;
00147     polygon[10].Vertex[2].y = -1.0;
00148     polygon[10].Vertex[2].z = -6.0;
00149 
00150     polygon[11].Vertex[0].x = -1.0;
00151     polygon[11].Vertex[0].y = -1.0;
00152     polygon[11].Vertex[0].z = -4.0;
00153     polygon[11].Vertex[1].x = 1.0;
00154     polygon[11].Vertex[1].y = -1.0;
00155     polygon[11].Vertex[1].z = -6.0;
00156     polygon[11].Vertex[2].x = 1.0;
00157     polygon[11].Vertex[2].y = -1.0;
00158     polygon[11].Vertex[2].z = -4.0;
00159 
00160     polygon[0].SetNormal();
00161     polygon[1].SetNormal();
00162     polygon[2].SetNormal();
00163     polygon[3].SetNormal();
00164     polygon[4].SetNormal();
00165     polygon[5].SetNormal();
00166     polygon[6].SetNormal();
00167     polygon[7].SetNormal();
00168     polygon[8].SetNormal();
00169     polygon[9].SetNormal();
00170     polygon[10].SetNormal();
00171     polygon[11].SetNormal();
00172 }


Generated on Fri Dec 23 05:21:21 2005 for Skybox by doxygen1.2.15