public void SaveAsJpeg(Stream stream, int width, int height) { int len = Width * Height * GetFormatSize(Format); IntPtr data = Marshal.AllocHGlobal(len); FNA3D.FNA3D_GetTextureData2D( GraphicsDevice.GLDevice, texture, 0, 0, Width, height, 0, data, len ); FNA3D.WriteJPGStream( stream, Width, Height, width, height, data, 100 // FIXME: What does XNA pick for quality? -flibit ); Marshal.FreeHGlobal(data); }