I ran across a problem with using OpenSG's binary data handler between different platforms with Mac OS X is involved. On Mac OS X, the bool type is four bytes, and it is of course only one byte on most (all?) other platforms. Unfortunately, OGS::BinaryDataHandler::putValue(bool) does not account for this, so synchronization errors can occur when a bool is put into the data stream. In my code, I could work around this easily by passing OSG::UInt8 instead of bool, but this could trip up other people--especially those who are not writing custom OpenSG-based clustering protocols.
I don't necessarily have the best solution for working around this, but the
following would be the OpenSG equivalent of VR Juggler handles it:
inline
void BinaryDataHandler::putValue(const bool &value)
{
#ifdef __APPLE__
OSG::UInt8 temp = (OSG::UInt8) value;
put(&temp, sizeof(OSG::UInt8));
#else
put(&value, sizeof(bool));
#endif
}
-Patrick
--
Patrick L. Hartling | VP Engineering, Infiscape Corp.
PGP: http://tinyurl.com/2msw3 | http://www.infiscape.com/
signature.asc
Description: OpenPGP digital signature
