Hi,
Recently I wrote a very basic Obj format loader in DIrectX, thanks to this wonderful article by Adel Amro : http://my.opera.com/adelamro/blog/direct3d-obj-viewer-sample
Obj file was taking time to load. I decided to give Boost's binary serialization a try just to check if after converting data into custom mesh format in binary if I get any speed benifits or not. Just to keep things very simple to begin with, I simply chose 4 members to be a part of my custom mesh format : vertex buffer, index buffer, attribute buffer & custom material structure just as blog above uses.
To start off with, i chose boost::text_archive to get hang of boost, am using Boost for the very first time. I was able to successfully read data from obj into my own data format & later use my data format to render it on the screen. This assured that all the required setup to render the mesh was correct & properly set.
Then I switched to boost::binary_archive. I was able to write the data in Binary format, but when I tried loading it, I got error which hangs up at following code inside boost library. Am absolutely beginner in boost & not able to dig down the root cause for the error. The error occurs at following line inside "boost_binary_iprimitive.hpp" file :
std::streamsize s = static_cast<std::streamsize>(count / sizeof(Elem));
std::streamsize scount = m_sb.sgetn(
static_cast<Elem *>(address),
s
);
if(scount != s)
boost::serialization::throw_exception(
archive_exception(archive_exception::input_stream_error)
);
where the value of s is 4 & scount is 2, which throws the exception. Can anyone let me know what am I doing wrong & what causes for this type of error?
Thanks,
TheOrestes.