#include // A cross-platform open-source C/C++ extension loading library #include #include // Handle the window-managing operations #include #include #include //To play sound #include #include #include using namespace std; /* Approximation of PI */ #define PI 3.1415926535898 /* Macro for sin & cos in degrees */ #define Cos(th) cos(PI/180*(th)) #define Sin(th) sin(PI/180*(th)) /* Globals varibles*/ double dim = 4.0; /* Dimension of projection box */ const GLchar* windowName = "MINECRAFT"; int windowWidth = 500; int windowHeight = 500; /* Various global state */ int th = -25; /*theta is y-angle */ int ph = 15; /*phi is x-angle */ int fov = 50; /* Field of view angle */ int asp = 1; /* aspect ratio */ /*Aim of camera lens */ float ecX = -0.4f; float ecZ = -0.2f; float ecY = 0.0f; /* Cube vertices */ GLfloat vertA[3] = { 0.5, 0.5, 0.5 }; GLfloat vertB[3] = { -0.5, 0.5, 0.5 }; GLfloat vertC[3] = { -0.5,-0.5, 0.5 }; GLfloat vertD[3] = { 0.5,-0.5, 0.5 }; GLfloat vertE[3] = { 0.5, 0.5,-0.5 }; GLfloat vertF[3] = { -0.5, 0.5,-0.5 }; GLfloat vertG[3] = { -0.5,-0.5,-0.5 }; GLfloat vertH[3] = { 0.5,-0.5,-0.5 }; //Cube textures GLuint myTexture1, myTexture2, myTexture3, myTexture4, myTexture5, myTexture6, myTexture7; char image1Path[] = "Stone1.bmp"; char image2Path[] = "StoneWithDoor1.bmp"; char image3Path[] = "brownground1.bmp"; char image4Path[] = "greenbrownground1.bmp"; char image5Path[] = "greenground1.bmp"; char image6Path[] = "wood1.bmp"; char image7Path[] = "leaf1.bmp"; GLuint LoadTexture(const char* filename, int width, int height) { GLuint texture; unsigned char* data; FILE* file; //The following code will read in our RAW file file = fopen(filename, "rb"); if (file == NULL) { cout << "Unable to open the image file" << endl << "Program will exit :(" << endl; exit(0); return 0; } data = (unsigned char*)malloc(width * height * 3); fread(data, width * height * 3, 1, file); fclose(file); // reorder the image colors to RGB not BGR for (int i = 0; i < width * height; ++i) { int index = i * 3; unsigned char B, R; B = data[index]; R = data[index + 2]; data[index] = R; data[index + 2] = B; } glGenTextures(1, &texture); //generate the texture with the loaded data glBindTexture(GL_TEXTURE_2D, texture); //bind the texture to it's array glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); //set texture environment parameters glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data); ///////////////////////////////////////// free(data); //free the texture array if (glGetError() != GL_NO_ERROR) printf("GLError in genTexture()\n"); return texture; //return whether it was successfull } /*Text*/ void text() { glClearColor(0, 0, 0, 1); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(-10, 10, -10, 10); cout << "\nWelcome to the Minecraft world (:" "\n" "\nEnjoy the viewing by pressing the arrow keys and have an adventure" "\n" "\n Our goal is to make a world that resembles the famous game Minecraft" "\n using OpenGL, enjoy the views by pressing the arrow keys and have an adventure!" "\n" "\nEverything is made of cubes," "\nground," "\nWood," "\nLeafs," "\nStone," "\nand Clouds." "\n" "\nmaking art with simple crafts" "\n---------------------------------------------" "\nmade by 5 creative students :" "\nHala Alshokri" "\nAfrah Bawhab" "\nMafaz Basalamah" "\nLena Babkair" "\nElaf abdualrhman" "\n" "\nsupervisor" "\nD.Huda"; } /* * project() */ void project(double fov, double asp, double dim) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(fov, asp, dim/4, dim * dim); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } /* * house() */ void house() { /* Cube */ /* front */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture2); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertA); glTexCoord2f(0, 1); glVertex3fv(vertB); glTexCoord2f(0, 0); glVertex3fv(vertC); glTexCoord2f(1, 0); glVertex3fv(vertD); glEnd(); glDisable(GL_TEXTURE_2D); /* back */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture1); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertF); glTexCoord2f(0, 1); glVertex3fv(vertE); glTexCoord2f(0, 0); glVertex3fv(vertH); glTexCoord2f(1, 0); glVertex3fv(vertG); glEnd(); glDisable(GL_TEXTURE_2D); /* right */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture1); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertE); glTexCoord2f(0, 1); glVertex3fv(vertA); glTexCoord2f(0, 0); glVertex3fv(vertD); glTexCoord2f(1, 0); glVertex3fv(vertH); glEnd(); glDisable(GL_TEXTURE_2D); /* left */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture1); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertB); glTexCoord2f(0, 1); glVertex3fv(vertF); glTexCoord2f(0, 0); glVertex3fv(vertG); glTexCoord2f(1, 0); glVertex3fv(vertC); glEnd(); glDisable(GL_TEXTURE_2D); /* top */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture1); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(vertE); glTexCoord2f(1, 0); glVertex3fv(vertF); glTexCoord2f(1, 1); glVertex3fv(vertB); glTexCoord2f(0, 1); glVertex3fv(vertA); glEnd(); glDisable(GL_TEXTURE_2D); /* bottom */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture5); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(vertD); glTexCoord2f(1, 0); glVertex3fv(vertC); glTexCoord2f(1, 1); glVertex3fv(vertG); glTexCoord2f(0, 1); glVertex3fv(vertH); glEnd(); glDisable(GL_TEXTURE_2D); } /* * groundCube() */ void ground_Cube() { /* Cube */ /* front */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture4); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertA); glTexCoord2f(0, 1); glVertex3fv(vertB); glTexCoord2f(0, 0); glVertex3fv(vertC); glTexCoord2f(1, 0); glVertex3fv(vertD); glEnd(); glDisable(GL_TEXTURE_2D); /* back */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture4); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertF); glTexCoord2f(0, 1); glVertex3fv(vertE); glTexCoord2f(0, 0); glVertex3fv(vertH); glTexCoord2f(1, 0); glVertex3fv(vertG); glEnd(); glDisable(GL_TEXTURE_2D); /* right */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture4); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertE); glTexCoord2f(0, 1); glVertex3fv(vertA); glTexCoord2f(0, 0); glVertex3fv(vertD); glTexCoord2f(1, 0); glVertex3fv(vertH); glEnd(); glDisable(GL_TEXTURE_2D); /* left */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture4); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertB); glTexCoord2f(0, 1); glVertex3fv(vertF); glTexCoord2f(0, 0); glVertex3fv(vertG); glTexCoord2f(1, 0); glVertex3fv(vertC); glEnd(); glDisable(GL_TEXTURE_2D); /* top */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture5); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(vertE); glTexCoord2f(1, 0); glVertex3fv(vertF); glTexCoord2f(1, 1); glVertex3fv(vertB); glTexCoord2f(0, 1); glVertex3fv(vertA); glEnd(); glDisable(GL_TEXTURE_2D); /* bottom */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture3); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(vertD); glTexCoord2f(1, 0); glVertex3fv(vertC); glTexCoord2f(1, 1); glVertex3fv(vertG); glTexCoord2f(0, 1); glVertex3fv(vertH); glEnd(); glDisable(GL_TEXTURE_2D); } /* * stone_Cube() */ void stone_Cube() { /* Cube */ /* front */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture1); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertA); glTexCoord2f(0, 1); glVertex3fv(vertB); glTexCoord2f(0, 0); glVertex3fv(vertC); glTexCoord2f(1, 0); glVertex3fv(vertD); glEnd(); glDisable(GL_TEXTURE_2D); /* back */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture1); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertF); glTexCoord2f(0, 1); glVertex3fv(vertE); glTexCoord2f(0, 0); glVertex3fv(vertH); glTexCoord2f(1, 0); glVertex3fv(vertG); glEnd(); glDisable(GL_TEXTURE_2D); /* right */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture1); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertE); glTexCoord2f(0, 1); glVertex3fv(vertA); glTexCoord2f(0, 0); glVertex3fv(vertD); glTexCoord2f(1, 0); glVertex3fv(vertH); glEnd(); glDisable(GL_TEXTURE_2D); /* left */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture1); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertB); glTexCoord2f(0, 1); glVertex3fv(vertF); glTexCoord2f(0, 0); glVertex3fv(vertG); glTexCoord2f(1, 0); glVertex3fv(vertC); glEnd(); glDisable(GL_TEXTURE_2D); /* top */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture1); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(vertE); glTexCoord2f(1, 0); glVertex3fv(vertF); glTexCoord2f(1, 1); glVertex3fv(vertB); glTexCoord2f(0, 1); glVertex3fv(vertA); glEnd(); glDisable(GL_TEXTURE_2D); /* bottom */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture1); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(vertD); glTexCoord2f(1, 0); glVertex3fv(vertC); glTexCoord2f(1, 1); glVertex3fv(vertG); glTexCoord2f(0, 1); glVertex3fv(vertH); glEnd(); glDisable(GL_TEXTURE_2D); } /* * ground() */ void ground() { glPushMatrix(); glTranslatef(-16.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-14.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-12.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-10.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-8.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-6.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-4.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-2.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(0.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(2.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(4.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(6.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(8.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(10.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(12.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(14.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(16.0, -1.0f, 10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //----------------end of expeeimwnt 1 glPushMatrix(); glTranslatef(0.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //change in x translate glPushMatrix(); glTranslatef(-2.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-4.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-6.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-8.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-10.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-12.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-14.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-16.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(2.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(4.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(6.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(8.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(10.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(12.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(14.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(16.0f, -1.0f, 8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //---------------------------------- glPushMatrix(); glTranslatef(0.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //change in x translate glPushMatrix(); glTranslatef(-2.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-4.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-6.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-8.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-10.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-12.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-14.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-16.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(2.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(4.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(6.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(8.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(10.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(12.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(14.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(16.0f, -1.0f, 6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //---------------------------- glPushMatrix(); glTranslatef(0.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //change in x translate glPushMatrix(); glTranslatef(-2.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-4.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-6.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-8.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-10.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-12.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-14.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-16.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(2.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(4.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(6.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(8.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(10.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(12.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(14.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(16.0f, -1.0f, 4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); /*ground*/ //first glPushMatrix(); glTranslatef(0.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //change in x translate glPushMatrix(); glTranslatef(-2.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-4.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-6.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-8.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-10.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-12.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-14.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-16.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(2.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(4.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(6.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(8.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(10.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(12.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(14.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(16.0f, -1.0f, 0.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //z=2 change in x translate glPushMatrix(); glTranslatef(0.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(2.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(4.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(6.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(8.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(10.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(12.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(14.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(16.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-2.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-4.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-6.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-8.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-10.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-12.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-14.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-16.0f, -1.0f, 2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //z=-2 change in x translate glPushMatrix(); glTranslatef(0.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(2.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(4.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(6.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(8.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(10.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(12.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(14.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(16.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-2.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-4.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-6.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-8.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-10.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-12.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-14.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-16.0f, -1.0f, -2.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //z=-4 change in x translate glPushMatrix(); glTranslatef(0.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(2.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(4.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(6.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(8.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(10.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(12.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(14.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(16.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-2.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-4.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-6.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-8.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-10.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-12.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-14.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); // glPushMatrix(); glTranslatef(-16.0f, -1.0f, -4.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //------------------------------------------------------------cave ground glPushMatrix(); glTranslatef(-6.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-8.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-10.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-12.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-14.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-16.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(0.0f, -1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(2.0f, -1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(6.0f, -1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(8.0f, -1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(10.0f, -1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(12.0f, -1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(14.0f, -1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(16.0f, -1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //----------------------------------------------------------use this for cave glPushMatrix(); glTranslatef(-4.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-4.0f, 0.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-2.0f, 0.0f, -6.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(2.0f, 0.0f, -6.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(-1.5f, 1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(-1.5f, 1.0f, -8.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(1.5f, 1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(1.5f, 1.0f, -8.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(1.0f, 2.0f, -6.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(-1.0f, 2.0f, -6.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(1.0f, 2.0f, -8.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(-1.0f, 2.0f, -8.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(-2.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(0.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(2.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(-2.0f, 0.0f, -8.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(2.0f, 0.0f, -8.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(-2.0f, -1.0f, -8.0f); glScalef(2.0, 1.0, 2.0); stone_Cube(); //cave glPopMatrix(); glPushMatrix(); glTranslatef(-3.5f, 1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-3.0f, 2.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-2.5f, 3.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-1.5f, 3.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(0.5f, 3.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(1.5f, 3.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(2.5f, 3.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(3.0f, 2.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(3.5f, 1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(4.0f, 0.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(4.0f, -1.0f, -6.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //-----------------------------------1 glPushMatrix(); glTranslatef(-4.0f, -1.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-4.0f, 0.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-3.5f, 1.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-3.0f, 2.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-2.5f, 3.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-1.5f, 3.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(0.5f, 3.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(1.5f, 3.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(2.5f, 3.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(3.0f, 2.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(3.5f, 1.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(4.0f, 0.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(4.0f, -1.0f, -8.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); //-----------------------2 glPushMatrix(); glTranslatef(-4.0f, -1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-4.0f, 0.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-3.5f, 1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-3.0f, 2.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-2.5f, 3.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-1.5f, 3.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(0.5f, 3.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(1.5f, 3.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(2.5f, 3.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(3.0f, 2.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(3.5f, 1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(4.0f, 0.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(4.0f, -1.0f, -10.0f); glScalef(2.0, 1.0, 2.0); ground_Cube(); glPopMatrix(); } /* * woodCube() */ void wood_Cube() { /* Cube */ /* front */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture6); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertA); glTexCoord2f(0, 1); glVertex3fv(vertB); glTexCoord2f(0, 0); glVertex3fv(vertC); glTexCoord2f(1, 0); glVertex3fv(vertD); glEnd(); glDisable(GL_TEXTURE_2D); /* back */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture6); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertF); glTexCoord2f(0, 1); glVertex3fv(vertE); glTexCoord2f(0, 0); glVertex3fv(vertH); glTexCoord2f(1, 0); glVertex3fv(vertG); glEnd(); glDisable(GL_TEXTURE_2D); /* right */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture6); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertE); glTexCoord2f(0, 1); glVertex3fv(vertA); glTexCoord2f(0, 0); glVertex3fv(vertD); glTexCoord2f(1, 0); glVertex3fv(vertH); glEnd(); glDisable(GL_TEXTURE_2D); /* left */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture6); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertB); glTexCoord2f(0, 1); glVertex3fv(vertF); glTexCoord2f(0, 0); glVertex3fv(vertG); glTexCoord2f(1, 0); glVertex3fv(vertC); glEnd(); glDisable(GL_TEXTURE_2D); /* top */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture6); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(vertE); glTexCoord2f(1, 0); glVertex3fv(vertF); glTexCoord2f(1, 1); glVertex3fv(vertB); glTexCoord2f(0, 1); glVertex3fv(vertA); glEnd(); glDisable(GL_TEXTURE_2D); /* bottom */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture6); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(vertD); glTexCoord2f(1, 0); glVertex3fv(vertC); glTexCoord2f(1, 1); glVertex3fv(vertG); glTexCoord2f(0, 1); glVertex3fv(vertH); glEnd(); glDisable(GL_TEXTURE_2D); } /* * leafCube() */ void leaf_Cube() { /* Cube */ /* front */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture7); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertA); glTexCoord2f(0, 1); glVertex3fv(vertB); glTexCoord2f(0, 0); glVertex3fv(vertC); glTexCoord2f(1, 0); glVertex3fv(vertD); glEnd(); glDisable(GL_TEXTURE_2D); /* back */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture7); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertF); glTexCoord2f(0, 1); glVertex3fv(vertE); glTexCoord2f(0, 0); glVertex3fv(vertH); glTexCoord2f(1, 0); glVertex3fv(vertG); glEnd(); glDisable(GL_TEXTURE_2D); /* right */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture7); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertE); glTexCoord2f(0, 1); glVertex3fv(vertA); glTexCoord2f(0, 0); glVertex3fv(vertD); glTexCoord2f(1, 0); glVertex3fv(vertH); glEnd(); glDisable(GL_TEXTURE_2D); /* left */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture7); glBegin(GL_QUADS); glTexCoord2f(1, 1); glVertex3fv(vertB); glTexCoord2f(0, 1); glVertex3fv(vertF); glTexCoord2f(0, 0); glVertex3fv(vertG); glTexCoord2f(1, 0); glVertex3fv(vertC); glEnd(); glDisable(GL_TEXTURE_2D); /* top */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture7); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(vertE); glTexCoord2f(1, 0); glVertex3fv(vertF); glTexCoord2f(1, 1); glVertex3fv(vertB); glTexCoord2f(0, 1); glVertex3fv(vertA); glEnd(); glDisable(GL_TEXTURE_2D); /* bottom */ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, myTexture7); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3fv(vertD); glTexCoord2f(1, 0); glVertex3fv(vertC); glTexCoord2f(1, 1); glVertex3fv(vertG); glTexCoord2f(0, 1); glVertex3fv(vertH); glEnd(); glDisable(GL_TEXTURE_2D); } /* * tree() */ void tree() { //wood glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(2.0f, -0.5f, 0.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(2.0f, 0.5f, 0.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(2.0f, 1.5f, 0.0f); wood_Cube(); glPopMatrix(); //leaf glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(0.6f, 1.5f, 0.0f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(0.5f, 2.0f, 0.3f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(0.7f, 2.0f, -0.3f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(0.5f, 2.5f, -0.3f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(0.7f, 2.5f, 0.3f); leaf_Cube(); glPopMatrix(); //-----------------------------------------------------new exp--------------------------------------------------------------- //wood1 glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(4.0f, -0.5f, 1.5f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(4.0f, 0.5f, 1.5f); wood_Cube(); glPopMatrix(); //leaf1 glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(1.6f, 1.0f, 0.3f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(1.5f, 1.5f, 0.6f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(1.7f, 1.5f, -0.6f); leaf_Cube(); glPopMatrix(); //==================================== //wood2 glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-6.0f, -0.5f, -4.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-6.0f, 0.5f, -4.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-6.0f, 1.5f, -4.0f); wood_Cube(); glPopMatrix(); //leaf2 glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-2.0f, 1.5f, -1.0f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-2.1f, 2.0f, -0.7f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-1.8f, 2.0f, -1.7f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-2.3f, 2.5f, -1.7f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-1.8f, 2.5f, -0.7f); leaf_Cube(); glPopMatrix(); //==================================== //wood3 glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(6.5f, -0.5f, 5.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(6.5f, 0.5f, 5.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(6.5f, 1.5f, 5.0f); wood_Cube(); glPopMatrix(); //leaf3 glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(2.1f, 2.0f, 1.9f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(1.8f, 2.5f, 2.0f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(2.3f, 2.5f, 2.0f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(1.6f, 3.0f, 2.2f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(2.5f, 3.0f, 2.2f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(1.6f, 3.0f, 2.0f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(2.5f, 3.0f, 2.0f); leaf_Cube(); glPopMatrix(); //==================================== //wood4 glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(0.5f, -0.5f, -6.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(0.5f, 0.5f, -6.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(0.5f, 1.5f, -6.0f); wood_Cube(); glPopMatrix(); //leaf4 glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(0.1f, 2.0f, -2.0f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(0.0f, 2.5f, -2.3f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(0.0f, 2.5f, -1.5f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-0.2f, 3.0f, -2.3f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-0.2f, 3.0f, -1.0f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(0.2f, 3.0f, -2.3f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(0.2f, 3.0f, -1.0f); leaf_Cube(); glPopMatrix(); //==================================== //wood5a glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-20.0f, -0.5f, -8.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-20.0f, 0.5f, -8.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-20.0f, 1.5f, -8.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-20.0f, 2.5f, -8.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-20.0f, 3.5f, -8.0f); wood_Cube(); glPopMatrix(); //wood5b glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-20.0f, -0.5f, -7.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-20.0f, 0.5f, -7.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-20.0f, 1.5f, -7.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-20.0f, 2.5f, -7.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-20.0f, 3.5f, -7.0f); wood_Cube(); glPopMatrix(); //wood5c glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-21.0f, -0.5f, -7.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-21.0f, 0.5f, -7.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-21.0f, 1.5f, -7.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-21.0f, 2.5f, -7.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-21.0f, 3.5f, -7.0f); wood_Cube(); glPopMatrix(); //leaf5 glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-7.0f, 3.0f, -2.5f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-6.5f, 3.0f, -2.5f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-7.2f, 3.5f, -2.2f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-6.2f, 3.5f, -2.2f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-6.2f, 3.5f, -2.4f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-7.5f, 4.0f, -2.0f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-6.0f, 4.0f, -2.0f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-7.0f, 4.0f, -2.0f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-6.0f, 4.0f, -2.6f); leaf_Cube(); glPopMatrix(); //==================================== //wood6 glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-8.0f, -0.5f, 2.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-8.0f, 0.5f, 2.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-8.0f, 1.5f, 2.0f); wood_Cube(); glPopMatrix(); //leaf6 glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-2.7f, 1.5f, 0.4f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-2.6f, 2.0f, 0.5f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-2.8f, 2.0f, 0.5f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-2.5f, 2.5f, 0.6f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-2.9f, 2.5f, 0.6f); leaf_Cube(); glPopMatrix(); //==================================== //wood7 glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-12.0f, -0.5f, 9.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-12.0f, 0.5f, 9.0f); wood_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(0.5, 0.5, 0.5); glTranslatef(-12.0f, 1.5f, 9.0f); wood_Cube(); glPopMatrix(); //leaf7 glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-4.2f, 1.5f, 2.7f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-4.5f, 2.0f, 2.8f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-3.9f, 2.0f, 2.8f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-4.7f, 2.5f, 2.9f); leaf_Cube(); glPopMatrix(); // glPushMatrix(); glScalef(1.5, 0.7, 1.5); glTranslatef(-3.7f, 2.5f, 2.9f); leaf_Cube(); glPopMatrix(); } /* * cloudCube() */ void cloud_Cube() { /* Cube */ glBegin(GL_QUADS); /* front */ glColor4f(1.0, 1.0, 1.0, 0.8); glVertex3fv(vertA); glVertex3fv(vertB); glVertex3fv(vertC); glVertex3fv(vertD); /* back */ glColor4f(1.0, 1.0, 1.0, 0.8); glVertex3fv(vertF); glVertex3fv(vertE); glVertex3fv(vertH); glVertex3fv(vertG); /* right */ glColor4f(1.0, 1.0, 1.0, 0.8); glVertex3fv(vertE); glVertex3fv(vertA); glVertex3fv(vertD); glVertex3fv(vertH); /* left */ glColor4f(1.0, 1.0, 1.0, 0.8); glVertex3fv(vertB); glVertex3fv(vertF); glVertex3fv(vertG); glVertex3fv(vertC); /* top */ glColor4f(1.0, 1.0, 1.0, 0.8); glVertex3fv(vertE); glVertex3fv(vertF); glVertex3fv(vertB); glVertex3fv(vertA); /* bottom */ glColor4f(1.0, 1.0, 1.0, 0.8); glVertex3fv(vertD); glVertex3fv(vertC); glVertex3fv(vertG); glVertex3fv(vertH); glEnd(); } /* * cloud() */ void cloud() { glPushMatrix(); glTranslatef(-1.0f, 3.0f, 2.0f); glScalef(2.5, 0.4, 2.0); cloud_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-2.5f, 3.25f, 2.5f); glScalef(1.7, 0.5, 2.0); cloud_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(0.5f, 3.2f, 1.0f); glScalef(2.0, 0.4, 1.0); cloud_Cube(); glPopMatrix(); //cloud 1 glPushMatrix(); glTranslatef(-4.0f, 3.0f, -1.5f); glScalef(2.5, 0.4, 2.0); cloud_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(2.00f, 3.25f, -2.0f); glScalef(1.7, 0.5, 2.0); cloud_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-3.05f, 3.2f, -2.5f); glScalef(2.0, 0.4, 1.0); cloud_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(2.0f, 3.0f, 2.50f); glScalef(2.5, 0.4, 2.0); cloud_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-2.4f, 3.25f, 0.5f); glScalef(1.7, 0.5, 2.0); cloud_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(3.0f, 5.0f, 2.50f); glScalef(2.5, 0.4, 2.0); cloud_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-5.0f, 4.0f, 2.0f); glScalef(2.5, 0.4, 2.0); cloud_Cube(); glPopMatrix(); glPushMatrix(); glTranslatef(-10.0f, 8.0f, 1.0f); glScalef(2.0, 0.4, 1.0); cloud_Cube(); glPopMatrix(); } /* * display() */ void display() { /* Initializes display */ glClearColor(0.4f, 0.6f, 1.0f, 0.5f); /* Clear the image */ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); /* Enable Z-buffering in OpenGL */ glEnable(GL_DEPTH_TEST); /* Reset previous transforms */ glLoadIdentity(); double x = sin(PI * (th) / 180) * 7; double y = sin(PI * (ph) / 180) * 7; double z = cos(PI * (th) / 180) * 7; gluLookAt(x, y, z, ecX, ecY, ecZ, 0, 1, 0); /* Draw */ house(); ground(); tree(); cloud(); glFlush(); glutSwapBuffers(); } /* * reshape() * ------ * GLUT calls this routine when the window is resized */ void reshape(int width, int height) { asp = (height > 0) ? (double)width / height : 1; glViewport(0, 0, width, height); project(fov, asp, dim); } /* * windowKey() * ------ * GLUT calls this routine when a non-special key is pressed */ void windowKey(unsigned char key, int x, int y) { /* Exit on ESC */ if (key == 27) exit(0); /* Change dimensions */ else if (key == 'D') { dim += 0.1; } else if (key == 'd' && dim > 1) { dim -= 0.1; } reshape(windowWidth, windowHeight); glutPostRedisplay(); } /* * windowSpecial() * ------ * GLUT calls this routine when an arrow key is pressed */ void windowSpecial(int key, int x, int y) { int modifiers = glutGetModifiers(); /* If holding shift, then rotate/elevate */ if (modifiers == GLUT_ACTIVE_SHIFT) { /* Right/Left - rotate */ if (key == GLUT_KEY_RIGHT) { ++th; } else if (key == GLUT_KEY_LEFT) { --th; } /* Up/Down - elevation */ else if (key == GLUT_KEY_UP) { ++ph; } else if (key == GLUT_KEY_DOWN) { --ph; } } /* Otherwise, just shift the camera */ else { /* Shift */ if (key == GLUT_KEY_RIGHT) { ecX += 0.1f; } else if (key == GLUT_KEY_LEFT) { ecX -= 0.1f; } else if (key == GLUT_KEY_DOWN) { ecZ += 0.1f; } else if (key == GLUT_KEY_UP) { ecZ -= 0.1f; } } /* Keep angles to +/-360 degrees */ th %= 360; ph %= 360; reshape(windowWidth, windowHeight); glutPostRedisplay(); } /* *init */ void init() { // Texture myTexture1 = LoadTexture(image1Path, 600, 600); myTexture2 = LoadTexture(image2Path, 600, 600); myTexture3 = LoadTexture(image3Path, 360, 360); myTexture4 = LoadTexture(image4Path, 512, 512); myTexture5 = LoadTexture(image5Path, 420, 420); myTexture6 = LoadTexture(image6Path, 1600, 1600); myTexture7 = LoadTexture(image7Path, 420, 420); project(fov, asp, dim); } /* * main() */ int main(int argc, char* argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(windowWidth, windowHeight); glutCreateWindow(windowName); text(); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(windowKey); glutSpecialFunc(windowSpecial); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); PlaySound(TEXT("Minecraft.wav"), NULL, SND_ASYNC | SND_FILENAME | SND_LOOP); glutMainLoop(); return 0; }