29 dataPtr =
new unsigned int[columns*lines];
37 assert(dataPtr &&
"No memory allocated for PNMExporter!");
38 static int counter = 0;
39 static ostringstream oss;
42 oss <<
"frame" << setw(5) << counter <<
".pnm";
44 ofstream outFile(oss.str().c_str());
45 outFile <<
"P6\n#Creator: V-ART framework PNMExporter class\n"
46 << numColumns <<
" " << numLines <<
"\n255\n";
47 glReadPixels(0,0,numColumns,numLines,GL_RGBA,GL_UNSIGNED_BYTE,dataPtr);
49 for (
int lin = numLines; lin > 0; --lin)
51 pixelPtr =
reinterpret_cast<char*
>(dataPtr + ((lin-1)*numColumns));
52 for (
int col = 0; col < numColumns; ++col)
54 outFile.write(pixelPtr,3);
virtual void OnDraw()
Reads frame buffer and writes to file.
void SetBufferSize(int columns, int lines)
Changes the buffer size.