void init_textures(void) { //load the images file into a ppm structure. bballImage = ppm6GetImage("./bball.ppm"); courtImage = ppm6GetImage("./court.ppm"); // //create opengl texture elements glGenTextures(1, &bballTextureId); int w = bballImage->width; int h = bballImage->height; // glBindTexture(GL_TEXTURE_2D, bballTextureId); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, bballImage->data); // //create opengl texture elements glGenTextures(1, &courtTextureId); w = courtImage->width; h = courtImage->height; // glBindTexture(GL_TEXTURE_2D, courtTextureId); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, courtImage->data); }
void loadTexture() { //load platform texture image from ppm structure platform = ppm6GetImage("./images/brick.ppm"); glGenTextures(1, &platformTexture); glBindTexture(GL_TEXTURE_2D, platformTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, platform->width, platform->height, 0, GL_RGB, GL_UNSIGNED_BYTE, platform->data); }
void load_background(void) { bgImage = ppm6GetImage((char*)"./images/AA_background.ppm"); glGenTextures(1, &bgTexture); glBindTexture(GL_TEXTURE_2D, bgTexture); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, bgImage->width, bgImage->height, 0, GL_RGB, GL_UNSIGNED_BYTE, bgImage->data); }
Ppmimage* get_image(std::string filename) { std::string filename2 = filename; filename2 = filename + ".ppm"; std::string command = "convert " + filename + ".png " + filename2; system( (command).c_str() ); Ppmimage *tempimage = ppm6GetImage( (filename2).c_str() ); command ="rm " + filename2; system( (command).c_str() ); return tempimage; }
void init_character_boxes(void) { int w,h; glViewport(0, 0, xres, yres); //Initialize matrices glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //This sets 2D mode (no perspective) glOrtho(0, xres, 0, yres, -1, 1); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); glDisable(GL_FOG); glDisable(GL_CULL_FACE); glClearColor(1.0, 1.0, 1.0, 1.0); //Do this to allow fonts glEnable(GL_TEXTURE_2D); initialize_fonts(); /*********** Initialize Textures *************************/ /*GUILE CHARACTER BOX TEXTURE*/ char b[] = "./images/selectGuile.ppm"; guileImage = ppm6GetImage(guileImage, b); glGenTextures(1, &guileTexture); glBindTexture(GL_TEXTURE_2D, guileTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); w = guileImage->width; h = guileImage->height; unsigned char *guileData = buildAlphaData(guileImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, guileData); delete [] guileData; /********** Initialize Box Position (s) **********/ charBox1.pos[0] = 200; charBox1.pos[1] = 300; charBox1.width = 200; charBox1.height = 300; }
void init_opengl(void) { //OpenGL initialization glViewport(0, 0, xres, yres); //Initialize matrices glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //This sets 2D mode (no perspective) glOrtho(0, xres, 0, yres, -1, 1); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); glDisable(GL_FOG); glDisable(GL_CULL_FACE); //Clear the screen glClearColor(1.0, 1.0, 1.0, 1.0); //glClear(GL_COLOR_BUFFER_BIT); //Do this to allow fonts glEnable(GL_TEXTURE_2D); initialize_fonts(); // //load the images file into a ppm structure. // kangarooImage = ppm6GetImage("./images/ricky.ppm"); levelImage = ppm6GetImage("./images/LevelBlack.ppm"); mountainsImage = ppm6GetImage("./images/BackBlack.ppm"); startImage = ppm6GetImage("./images/start.ppm"); whiteImage = ppm6GetImage("./images/white.ppm"); gameoverImage = ppm6GetImage("./images/wasted.ppm"); //------------------------------------------------------- rhinoImage = ppm6GetImage("./images/rhino.ppm"); animalImage = ppm6GetImage("./images/altrhino.ppm"); /*ufoImage = ppm6GetImage("./images/ufo.ppm");*/ // //create opengl texture elements glGenTextures(1, &RhinoTexture); glGenTextures(1, &AnimalTexture); glGenTextures(1, &KangarooTexture); glGenTextures(1, &LevelTexture); glGenTextures(1, &MountainTexture); glGenTextures(1, &StartTexture); glGenTextures(1, &WhiteTexture); glGenTextures(1, &GameOverTexture); //----------------------------------------------------------------- //------------------------------------------------------------------------- // // Kangaroo // int w = kangarooImage->width; int h = kangarooImage->height; glBindTexture(GL_TEXTURE_2D, KangarooTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // //must build a new set of data... unsigned char *Transparent = buildAlphaData(kangarooImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, Transparent); free(Transparent); //------------------------------------------------------------------------- // // Kangaroo - Punch // init_punch_texture(w,h); //------------------------------------------------------------------------- // // Kangaroo - Hop // init_hop_texture(w,h); //------------------------------------------------------------------------- // // Rhino // int w1 = rhinoImage->width; int h1 = rhinoImage->height; glBindTexture(GL_TEXTURE_2D, RhinoTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // //must build a new set of data... Transparent = buildAlphaData(rhinoImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w1, h1, 0, GL_RGBA, GL_UNSIGNED_BYTE, Transparent); free(Transparent); //------------------------------------------------------------------------- // // Animal // int w2 = animalImage->width; int h2 = animalImage->height; glBindTexture(GL_TEXTURE_2D, AnimalTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // //must build a new set of data... Transparent = buildAlphaData(animalImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w2, h2, 0, GL_RGBA, GL_UNSIGNED_BYTE, Transparent); free(Transparent); //------------------------------------------------------------------------- // // UFO Spaceship // ufoOpenGL(); /*int w3 = ufoImage->width; int h3 = ufoImage->height; glBindTexture(GL_TEXTURE_2D, UFOTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // //must build a new set of data... Transparent = buildAlphaData(ufoImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w3, h3, 0, GL_RGBA, GL_UNSIGNED_BYTE, Transparent); free(Transparent);*/ //------------------------------------------------------------------------- // // Background - Platforms // glBindTexture(GL_TEXTURE_2D, LevelTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // //must build a new set of data... Transparent = buildAlphaData(levelImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, levelImage->width, levelImage->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Transparent); free(Transparent); //------------------------------------------------------------------------- // // Background - Mountains // glBindTexture(GL_TEXTURE_2D, MountainTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // //must build a new set of data... Transparent = buildAlphaData(mountainsImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, mountainsImage->width, mountainsImage->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Transparent); free(Transparent); //------------------------------------------------------------------------- // // Start Page // glBindTexture(GL_TEXTURE_2D, StartTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, startImage->width, startImage->height, 0, GL_RGB, GL_UNSIGNED_BYTE, startImage->data); //------------------------------------------------------------------------- // // Death flash // glBindTexture(GL_TEXTURE_2D, WhiteTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, whiteImage->width, whiteImage->height, 0, GL_RGB, GL_UNSIGNED_BYTE, whiteImage->data); //------------------------------------------------------------------------- // // Gameover // glBindTexture(GL_TEXTURE_2D, GameOverTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, gameoverImage->width, gameoverImage->height, 0, GL_RGB, GL_UNSIGNED_BYTE, gameoverImage->data); //------------------------------------------------------------------------- }
void init_opengl(Game *game) { //OpenGL initialization glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); //Initialize matrices glMatrixMode(GL_PROJECTION); glLoadIdentity(); //Set 2D mode (no perspective) glOrtho(0, WINDOW_WIDTH, (game->altitude - WINDOW_HEIGHT), game->altitude, -1, 1); //glOrtho(0, WINDOW_WIDTH, 0, WINDOW_HEIGHT, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //glDisable(GL_LIGHTING); //glDisable(GL_DEPTH_TEST); //glDisable(GL_FOG); //glDisable(GL_CULL_FACE); //Save the default modelview matrix glPushMatrix(); //Set the screen background color //glClearColor(0.1, 0.5, 1.0, 1.0); glClearColor(0.f, 0.f, 0.f, 1.f); glEnable(GL_TEXTURE_2D); initialize_fonts(); // //load the images file into a ppm structure // skyImage = ppm6GetImage("./images/Sunset.ppm"); characterImage = ppm6GetImage("./images/character2.ppm"); //create opengl texture elements glGenTextures(1, &skyTexture); glGenTextures(1, &characterTexture); glGenTextures(1, &silhouetteTexture); // //sky glBindTexture(GL_TEXTURE_2D, skyTexture); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, skyImage->width, skyImage->height, 0, GL_RGB, GL_UNSIGNED_BYTE, skyImage->data); // /* //character glBindTexture(GL_TEXTURE_2D, characterTexture); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, characterImage->width, characterImage->height, 0, GL_RGB, GL_UNSIGNED_BYTE, characterImage->data); // //character silhouette glBindTexture(GL_TEXTURE_2D, silhouetteTexture); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); unsigned char *silhouetteData = buildAlphaData(characterImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, characterImage->width, characterImage->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData); delete [] silhouetteData; */ }
void init_opengl(void) { //OpenGL initialization glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); //Initialize matrices glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //Set 2D mode (no perspective) glOrtho(0, WINDOW_WIDTH, 0, WINDOW_HEIGHT, -1, 1); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); glDisable(GL_FOG); glDisable(GL_CULL_FACE); //Set the screen background color glClearColor(0.0, 0.0, 0.0, 1.0); //Initialize Fonts glEnable(GL_TEXTURE_2D); initialize_fonts(); //system convert system("convert ./images/city.png ./images/city.ppm"); system("convert ./images/street.jpg ./images/street.ppm"); system("convert ./images/stars.png ./images/stars.ppm"); system("convert ./images/civilian.jpg ./images/civilian.ppm"); system("convert ./images/gameover.png ./images/gameover.ppm"); system("convert ./images/mainmenu.png ./images/mainmenu.ppm"); system("convert ./images/dcity.png ./images/dcity.ppm"); system("convert ./images/emissile.png ./images/emissile.ppm"); system("convert ./images/dmissile.png ./images/dmissile.ppm"); system("convert ./images/ufo.png ./images/ufo.ppm"); system("convert ./images/c_city.png ./images/c_city.ppm"); system("convert ./images/c_emissile.png ./images/c_emissile.ppm"); system("convert ./images/c_dmissile.png ./images/c_dmissile.ppm"); system("convert ./images/c_floor.png ./images/c_floor.ppm"); system("convert ./images/howtoplay.png ./images/howtoplay.ppm"); //system("convert ./images/c_bomber.png ./images/c_bomber.ppm"); //system("convert ./images/c_satellite.png ./images/c_satellite.ppm"); //system("convert ./images/c_silo.png ./images/c_silo.ppm"); //system("convert ./images/c_sbomb.png ./images/c_sbomb.ppm"); //load images into a ppm structure cityImage = ppm6GetImage("./images/city.ppm"); starsImage = ppm6GetImage("./images/stars.ppm"); streetImage = ppm6GetImage("./images/street.ppm"); civilianImage = ppm6GetImage("./images/civilian.ppm"); gameoverImage =ppm6GetImage("./images/gameover.ppm"); mainmenuImage = ppm6GetImage("./images/mainmenu.ppm"); dcityImage = ppm6GetImage("./images/dcity.ppm"); emissileImage = ppm6GetImage("./images/emissile.ppm"); dmissileImage = ppm6GetImage("./images/dmissile.ppm"); ufoImage = ppm6GetImage("./images/ufo.ppm"); howtoImage = ppm6GetImage("./images/howtoplay.ppm"); //classic images c_cityImage = ppm6GetImage("./images/c_city.ppm"); c_emissileImage = ppm6GetImage("./images/c_emissile.ppm"); c_dmissileImage = ppm6GetImage("./images/c_dmissile.ppm"); c_floorImage = ppm6GetImage("./images/c_floor.ppm"); //create opengl texture elements //stars starsTexture = makeTexture(starsTexture, starsImage); //street streetTexture = makeTexture(streetTexture, streetImage); //city cityTexture = makeTransparentTexture(cityTexture, cityImage); //civilian civilianTexture = makeTransparentTexture(civilianTexture, civilianImage); //dcity dcityTexture = makeTransparentTexture(cityTexture, dcityImage); //emissile emissileTexture = makeTransparentTexture(cityTexture, emissileImage); //dmissile dmissileTexture = makeTransparentTexture(cityTexture, dmissileImage); //ufo ufoTexture = makeTransparentTexture(cityTexture, ufoImage); //Others gameoverTexture = makeTransparentTexture(gameoverTexture, gameoverImage); mainmenuTexture = makeTexture(mainmenuTexture, mainmenuImage); howtoplayTexture = makeTexture(howtoplayTexture, howtoImage); //Classic c_floorTexture = makeTexture(c_floorTexture, c_floorImage); c_cityTexture = makeTransparentTexture(c_cityTexture, c_cityImage); c_emissileTexture = makeTransparentTexture(c_emissileTexture, c_emissileImage); c_dmissileTexture = makeTransparentTexture(c_dmissileTexture, c_dmissileImage); //remove ppm's remove("./images/city.ppm"); remove("./images/stars.ppm"); remove("./images/street.ppm"); remove("./images/civilian.ppm"); remove("./images/gameover.ppm"); remove("./images/mainmenu.ppm"); remove("./images/dcity.ppm"); remove("./images/emissile.ppm"); remove("./images/dmissile.ppm"); remove("./images/ufo.ppm"); remove("./images/howtoplay.ppm"); //remove classic stuff remove("./images/c_city.ppm"); remove("./images/c_emissile.ppm"); remove("./images/c_dmissile.ppm"); remove("./images/c_floor.ppm"); }
void loadTextures() { // load image from ppm structure skeletonBase = ppm6GetImage("./images/platformer_sprites_pixelized_0.ppm"); background = ppm6GetImage("./images/neb.ppm"); spike = ppm6GetImage("./images/superspikes.ppm"); missile = ppm6GetImage("./images/missile.ppm"); guts = ppm6GetImage("./images/guts.ppm"); menu = ppm6GetImage("./images/main.ppm"); howTo = ppm6GetImage("./images/howTo2.ppm"); // generate opengl texture element glGenTextures(1, &skeletonTexture); glGenTextures(1, &backgroundTexture); glGenTextures(1, &spikeTexture); glGenTextures(1, &missileTexture); glGenTextures(1, &gutsTexture); glGenTextures(1, &menuTexture); glGenTextures(1, &howToTexture); glGenTextures(1, &silhouetteTexture); glGenTextures(1, &silhouetteTextureSpikes); glGenTextures(1, &silhouetteTextureMissile); glGenTextures(1, &silhouetteTextureGuts); //////////////////// Missile ////////////////////// glBindTexture(GL_TEXTURE_2D, missileTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, missile->width, missile->height, 0, GL_RGB, GL_UNSIGNED_BYTE, missile->data); ////////////////////// guts //////////////////////////// glBindTexture(GL_TEXTURE_2D, gutsTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, guts->width, guts->height, 0, GL_RGB, GL_UNSIGNED_BYTE, guts->data); /////////////////// spikes //////////////// glBindTexture(GL_TEXTURE_2D, spikeTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, spike->width, spike->height, 0, GL_RGB, GL_UNSIGNED_BYTE, spike->data); /////////////////// Skeleton sprite texture //////////////////////// glBindTexture(GL_TEXTURE_2D, skeletonTexture); // bilinear filtering glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); // write to video memory glTexImage2D(GL_TEXTURE_2D, 0, 3, skeletonBase->width, skeletonBase->height, 0, GL_RGB, GL_UNSIGNED_BYTE, skeletonBase->data); //////////////////// silhouette for character/////////////////////// glBindTexture(GL_TEXTURE_2D, silhouetteTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); unsigned char *silhouetteData = buildAlphaData(skeletonBase); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, skeletonBase->width, skeletonBase->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData); delete [] silhouetteData; //////////////////// silhouette for spikes/////////////////////// glBindTexture(GL_TEXTURE_2D, silhouetteTextureSpikes); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); silhouetteData = buildAlphaData(spike); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, spike->width, spike->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData); delete [] silhouetteData; //////////////////// silhouette for missile/////////////////////// glBindTexture(GL_TEXTURE_2D, silhouetteTextureMissile); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); silhouetteData = buildAlphaData(missile); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, missile->width, missile->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData); delete [] silhouetteData; //////////////////// silhouette for missile/////////////////////// glBindTexture(GL_TEXTURE_2D, silhouetteTextureGuts); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); silhouetteData = buildAlphaData(guts); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, guts->width, guts->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData); delete [] silhouetteData; ////////////// GAME BACKGROUND //////////////////////////// glBindTexture(GL_TEXTURE_2D, backgroundTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, background->width, background->height, 0, GL_RGB, GL_UNSIGNED_BYTE, background->data); //////////////MENU BACKGROUND ///////////////////////////// glBindTexture(GL_TEXTURE_2D, menuTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, menu->width, menu->height, 0, GL_RGB, GL_UNSIGNED_BYTE, menu->data); //////////////HOW_TO BACKGROUND ///////////////////////////// glBindTexture(GL_TEXTURE_2D, howToTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, howTo->width, howTo->height, 0, GL_RGB, GL_UNSIGNED_BYTE, howTo->data); }
void getShipTexture(void) { shipImage = ppm6GetImage((char*)"./images/ship.ppm"); glGenTextures(1, &shipTexture); glBindTexture(GL_TEXTURE_2D, shipTexture); gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, shipImage->width, shipImage->height, GL_RGB, GL_UNSIGNED_BYTE, shipImage->data); }
void init_opengl(void) { //OpenGL initialization glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT); //Initialize matrices glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //Set 2D mode (no perspective) glOrtho(0, WINDOW_WIDTH, 0, WINDOW_HEIGHT, -1, 1); //added for background glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); glDisable(GL_FOG); glDisable(GL_CULL_FACE); //clear the screen glClearColor(1.0, 1.0, 1.0, 1.0); backgroundImage = ppm6GetImage("./images/background.ppm"); backgroundTransImage = ppm6GetImage("./images/backgroundTrans.ppm"); gameoverbgImage = ppm6GetImage("./images/gameoverbg.ppm"); //------------------------------------------------------------------- //bullet glGenTextures(1, &bulletTexture); bulletImage = ppm6GetImage("./images/bullet.ppm"); int w3 = bulletImage->width; int h3 = bulletImage->height; glBindTexture(GL_TEXTURE_2D, bulletTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w3, h3, 0, GL_RGB, GL_UNSIGNED_BYTE, bulletImage->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //White duck score sprite glGenTextures(1, &duckscoreTexture); duckscoreImage = ppm6GetImage("./images/duck_score_1.ppm"); int w4 = duckscoreImage->width; int h4 = duckscoreImage->height; glBindTexture(GL_TEXTURE_2D, duckscoreTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w4, h4, 0, GL_RGB, GL_UNSIGNED_BYTE, duckscoreImage->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //Red duck score sprite glGenTextures(1, &duckscoreTexture2); duckscoreImage2 = ppm6GetImage("./images/duck_score_2.ppm"); int w5 = duckscoreImage2->width; int h5 = duckscoreImage2->height; glBindTexture(GL_TEXTURE_2D, duckscoreTexture2); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w5, h5, 0, GL_RGB, GL_UNSIGNED_BYTE, duckscoreImage2->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //duck sprite glGenTextures(1, &duckTexture); glGenTextures(1, &duckSil); duckImage = ppm6GetImage("./images/ducks1.ppm"); int w = duckImage->width; int h = duckImage->height; glBindTexture(GL_TEXTURE_2D, duckTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, duckImage->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //duck sprite 2 glGenTextures(1, &duckTexture2); glGenTextures(1, &duckSil2); duckImage2 = ppm6GetImage("./images/duck2.ppm"); int w2 = duckImage2->width; int h2 = duckImage2->height; glBindTexture(GL_TEXTURE_2D, duckTexture2); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w2, h2, 0, GL_RGB, GL_UNSIGNED_BYTE, duckImage2->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //duck sprite 3 glGenTextures(1, &duckTexture3); glGenTextures(1, &duckSil3); duckImage3 = ppm6GetImage("./images/shotduck1.ppm"); int w6 = duckImage3->width; int h6 = duckImage3->height; glBindTexture(GL_TEXTURE_2D, duckTexture3); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w6, h6, 0, GL_RGB, GL_UNSIGNED_BYTE, duckImage3->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //duck sprite 4 glGenTextures(1, &duckTexture4); glGenTextures(1, &duckSil4); duckImage4 = ppm6GetImage("./images/shotduck2.ppm"); int w7 = duckImage4->width; int h7 = duckImage4->height; glBindTexture(GL_TEXTURE_2D, duckTexture4); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w7, h7, 0, GL_RGB, GL_UNSIGNED_BYTE, duckImage4->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //duck sprite 5 glGenTextures(1, &duckTexture5); glGenTextures(1, &duckSil5); duckImage5 = ppm6GetImage("./images/ducks2.ppm"); int w8 = duckImage5->width; int h8 = duckImage5->height; glBindTexture(GL_TEXTURE_2D, duckTexture5); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w8, h8, 0, GL_RGB, GL_UNSIGNED_BYTE, duckImage5->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //duck silhouette glBindTexture(GL_TEXTURE_2D, duckSil); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); ////must build a new set of data... unsigned char *silhouetteData = buildAlphaData(duckImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData); delete [] silhouetteData; //------------------------------------------------------------------- //------------------------------------------------------------------- //duck silhouette 2 glBindTexture(GL_TEXTURE_2D, duckSil2); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); ////must build a new set of data... unsigned char *silhouetteData2 = buildAlphaData(duckImage2); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w2, h2, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData2); delete [] silhouetteData2; //------------------------------------------------------------------- //------------------------------------------------------------------- //duck silhouette 3 glBindTexture(GL_TEXTURE_2D, duckSil3); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); ////must build a new set of data... unsigned char *silhouetteData3 = buildAlphaData(duckImage3); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w6, h6, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData3); delete [] silhouetteData3; //------------------------------------------------------------------- //------------------------------------------------------------------- //duck silhouette 4 glBindTexture(GL_TEXTURE_2D, duckSil4); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); ////must build a new set of data... unsigned char *silhouetteData4 = buildAlphaData(duckImage4); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w7, h7, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData4); delete [] silhouetteData4; //------------------------------------------------------------------- //------------------------------------------------------------------- //duck silhouette 5 glBindTexture(GL_TEXTURE_2D, duckSil5); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); ////must build a new set of data... unsigned char *silhouetteData5 = buildAlphaData(duckImage5); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w8, h8, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData5); delete [] silhouetteData5; //------------------------------------------------------------------- //------------------------------------------------------------------- //Dog sprite 1 glGenTextures(1, &dogTexture1); glGenTextures(1, &dogSil1); dogImage1 = ppm6GetImage("./images/dogs1.ppm"); int w10 = dogImage1->width; int h10 = dogImage1->height; glBindTexture(GL_TEXTURE_2D, dogTexture1); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w10, h10, 0, GL_RGB, GL_UNSIGNED_BYTE, dogImage1->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //Dog sprite 2 glGenTextures(1, &dogTexture2); glGenTextures(1, &dogSil2); dogImage2 = ppm6GetImage("./images/dogs21.ppm"); int w11 = dogImage2->width; int h11 = dogImage2->height; glBindTexture(GL_TEXTURE_2D, dogTexture2); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w11, h11, 0, GL_RGB, GL_UNSIGNED_BYTE, dogImage2->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //Dog sprite 3 glGenTextures(1, &dogTexture3); glGenTextures(1, &dogSil3); dogImage3 = ppm6GetImage("./images/dogs3.ppm"); int w12 = dogImage3->width; int h12 = dogImage3->height; glBindTexture(GL_TEXTURE_2D, dogTexture3); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w12, h12, 0, GL_RGB, GL_UNSIGNED_BYTE, dogImage3->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //Dog sprite 4 glGenTextures(1, &dogTexture4); glGenTextures(1, &dogSil4); dogImage4 = ppm6GetImage("./images/dog1.ppm"); int w17 = dogImage4->width; int h17 = dogImage4->height; glBindTexture(GL_TEXTURE_2D, dogTexture4); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w17, h17, 0, GL_RGB, GL_UNSIGNED_BYTE, dogImage4->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //Dog silhouette 4 glBindTexture(GL_TEXTURE_2D, dogSil4); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); ////must build a new set of data... unsigned char *silhouetteData17 = buildAlphaData(dogImage4); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w17, h17, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData17); delete [] silhouetteData17; //------------------------------------------------------------------- //------------------------------------------------------------------- //Dog silhouette 1 glBindTexture(GL_TEXTURE_2D, dogSil1); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); ////must build a new set of data... unsigned char *silhouetteData6 = buildAlphaData(dogImage1); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w10, h10, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData6); delete [] silhouetteData6; //------------------------------------------------------------------- //------------------------------------------------------------------- //Dog silhouette 2 glBindTexture(GL_TEXTURE_2D, dogSil2); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); ////must build a new set of data... unsigned char *silhouetteData7 = buildAlphaData(dogImage2); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w11, h11, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData7); delete [] silhouetteData7; //------------------------------------------------------------------- //------------------------------------------------------------------- //Dog silhouette 3 glBindTexture(GL_TEXTURE_2D, dogSil3); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); ////must build a new set of data... unsigned char *silhouetteData8 = buildAlphaData(dogImage3); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w12, h12, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData8); delete [] silhouetteData8; //------------------------------------------------------------------- //------------------------------------------------------------------- //background textures //create opengl texture elements glGenTextures(1, &backgroundTexture); glBindTexture(GL_TEXTURE_2D, backgroundTexture); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, backgroundImage->width, backgroundImage->height, 0, GL_RGB, GL_UNSIGNED_BYTE, backgroundImage->data); //------------------------------------------------------------------- //------------------------------------------------------------------- //No genTextures for trans image? //forest transparent part glBindTexture(GL_TEXTURE_2D, backgroundTransTexture); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); //must build a new set of data... int w15 = backgroundTransImage->width; int h15 = backgroundTransImage->height; unsigned char *ftData = buildAlphaData(backgroundTransImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w15, h15, 0, GL_RGBA, GL_UNSIGNED_BYTE, ftData); delete [] ftData; //------------------------------------------------------------------- //------------------------------------------------------------------- //gameover glGenTextures(1, &gameoverbgTexture); glBindTexture(GL_TEXTURE_2D, gameoverbgTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, gameoverbgImage->width, gameoverbgImage->height, 0, GL_RGB, GL_UNSIGNED_BYTE, gameoverbgImage->data); //------------------------------------------------------------------- glEnable(GL_TEXTURE_2D); initialize_fonts(); }
void init_opengl(void) { //OpenGL initialization glViewport(0, 0, xres, yres); //Initialize matrices glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //This sets 2D mode (no perspective) glOrtho(0, xres, 0, yres, -1, 1); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); glDisable(GL_FOG); glDisable(GL_CULL_FACE); //Clear the screen glClearColor(1.0, 1.0, 1.0, 1.0); //glClear(GL_COLOR_BUFFER_BIT); //Do this to allow fonts glEnable(GL_TEXTURE_2D); initialize_fonts(); // //load the images file into a ppm structure. // bigfootImage = ppm6GetImage("./images/bigfoot.ppm"); forestImage = ppm6GetImage("./images/forest.ppm"); forestTransImage = ppm6GetImage("./images/forestTrans.ppm"); umbrellaImage = ppm6GetImage("./images/umbrella.ppm"); // //create opengl texture elements glGenTextures(1, &bigfootTexture); glGenTextures(1, &silhouetteTexture); glGenTextures(1, &forestTexture); glGenTextures(1, &umbrellaTexture); //------------------------------------------------------------------------- //bigfoot // int w = bigfootImage->width; int h = bigfootImage->height; // glBindTexture(GL_TEXTURE_2D, bigfootTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, bigfootImage->data); //------------------------------------------------------------------------- // //silhouette //this is similar to a sprite graphic // glBindTexture(GL_TEXTURE_2D, silhouetteTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // //must build a new set of data... unsigned char *silhouetteData = buildAlphaData(bigfootImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData); free(silhouetteData); //glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, // GL_RGB, GL_UNSIGNED_BYTE, bigfootImage->data); //------------------------------------------------------------------------- // //umbrella // glBindTexture(GL_TEXTURE_2D, umbrellaTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // //must build a new set of data... silhouetteData = buildAlphaData(umbrellaImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, silhouetteData); free(silhouetteData); //glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, // GL_RGB, GL_UNSIGNED_BYTE, bigfootImage->data); //------------------------------------------------------------------------- // //forest glBindTexture(GL_TEXTURE_2D, forestTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, 3, forestImage->width, forestImage->height, 0, GL_RGB, GL_UNSIGNED_BYTE, forestImage->data); //------------------------------------------------------------------------- // //forest transparent part // glBindTexture(GL_TEXTURE_2D, forestTransTexture); // glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); // //must build a new set of data... w = forestTransImage->width; h = forestTransImage->height; unsigned char *ftData = buildAlphaData(forestTransImage); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ftData); free(ftData); //glTexImage2D(GL_TEXTURE_2D, 0, 3, w, h, 0, //GL_RGB, GL_UNSIGNED_BYTE, bigfootImage->data); //------------------------------------------------------------------------- }