Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


DirectX + Obj + Boost::Serialization


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 TheOrestes   Members   -  Reputation: 270

Like
0Likes
Like

Posted 06 January 2013 - 05:53 AM

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.



Sponsor:

#2 NewDisplayName   Members   -  Reputation: 359

Like
0Likes
Like

Posted 06 January 2013 - 06:54 AM

Boost is a very stable library to use, so I really doubt that looking at this code will help you.

However, from the callstack, you can check from where boost is getting invoked in your code, and then check if something is wrong with the values in you method call.

And, in the worst case scenario, even if it's an issue in Boost then you should probably check on Boost forums, not here.



#3 TheOrestes   Members   -  Reputation: 270

Like
0Likes
Like

Posted 06 January 2013 - 10:15 AM

Hi,

 

thanks for the reply. Well the reason for giving BOOST code is just to get idea which exception is occuring. I completely agree with Bosst's stability :)

as per the more info, this error is triggered right when I try to create the input archive of a file whose output archive has been successfully created.

 

 

std::ifstream ifs(filename.c_str());
    if(ifs.good())
    {
        boost::archive::binary_iarchive ia(ifs);
        ia >> BOOST_SERIALIZATION_NVP(objMesh);
        ifs.close();
        MessageBox(0, "Loading Done", "Success!", MB_OK);
    }

 

Cheers.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS