Original Post
Hi, im currently saving a surface to a file, opening it, skipping past the headers (128 bytes) and reading in the rest of the file to save it to a stream. Was wondering if anyone knew a better / faster way than having to go through the trouble of using an external file. I posted the code below for anyone needing a clearer picture of what im at, thanks for any help, -Dave
IDirect3DSurface9 *surface;
ifstream fileStream;
char *chunk;
long chunkSize = 0;
texture->GetSurfaceLevel(0, &surface);
D3DXSaveSurfaceToFile(L"temp.tmp", D3DXIFF_DDS, surface, NULL, NULL);
fileStream.open("temp.tmp", std::ios::binary);
chunkSize = fileLength(fileStream) - 128;
chunk = new char[chunkSize];
fileStream.ignore(128);
fileStream.read(chunk, chunkSize);
writeBinary(outputStream, chunkSize);
outputStream.write(chunk, chunkSize);
fileStream.close();
delete [] chunk;
surface->Release();