// trying to write into a BMP file int RGBpixmap:: writeBMPFile(char * fname) { fstream outStream(fname, ios ::out); // open the output stream if (outStream.fail()) { cout << "cannot open new file : " << fname << endl; return 0;} ulong myLong = 0; ushort myShort = 1; // file header outStream << "BM" ; // first 2 bytes outStream << myLong; //size of file ! outStream << myLong; //reserved, must be zero outStream << myLong; //offset from Bitmap File Header // bitmap info myLong = 40; outStream << myLong; //num.bytes in header (= 40) myLong = 200; //width in pixels outStream << myLong; myLong = 200; //height in pixels outStream << myLong; outStream << myShort; //number of color planes (must be 1) myShort=24; outStream << myShort; //number of bits per pixel myLong = 0; //type of compression: outStream << myLong; // 0=no compresion myLong = 200*200*3; //size in bytes outStream << myLong; return 1; } // //<<<<<<<<<<<<<<<<<<<<<<<<<<<< write mesh>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // void writeMesh(char * fname) // { // write this mesh object into a new Chapter 6 format file. // if(numVerts == 0 || numNorms == 0 || numFaces == 0) return; //empty // fstream outStream(fname, ios ::out); // open the output stream // if(outStream.fail()) {cout << "can't make new file: " << fname << endl; return;} // outStream << numVerts << " " << numNorms << " " << numFaces << "\n"; // // write the vertex and vertex normal list // for(int i = 0; i < numVerts; i++) // outStream << pt[i].x << " " << pt[i].y << " " << pt[i].z << "\n"; // for(int ii = 0; ii < numNorms; ii++) // outStream << norm[ii].x << " " << norm[ii].y << " " << norm[ii].z << "\n"; // // write the face data // for(int f = 0; f < numFaces; f++) // { // int n = face[f].nVerts; // outStream << n << "\n"; // for(int v = 0; v < n; v++)// write vertex indices for this face // outStream << face[f].vert[v].vertIndex << " "; outStream << "\n"; // for(int k = 0; k < n; k++) // write normal indices for this face // outStream << face[f].vert[k].normIndex << " "; outStream << "\n"; // } // outStream.close(); // }