Fixed crash for secondary node

- Added SGCT config two_nodes.xml
This commit is contained in:
Jonas Strandstedt
2014-05-22 13:50:35 -04:00
parent 472869e1db
commit c5c42f2d72
3 changed files with 52 additions and 5 deletions

44
config/sgct/two_nodes.xml Normal file
View File

@@ -0,0 +1,44 @@
<?xml version="1.0" ?>
<Cluster masterAddress="127.0.0.1">
<Node address="127.0.0.1" port="20401">
<Window fullScreen="false">
<Pos x="0" y="300" />
<!-- 16:9 aspect ratio -->
<Size x="640" y="360" />
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Viewplane>
<!-- Lower left -->
<Pos x="-1.778" y="-1.0" z="0.0" />
<!-- Upper left -->
<Pos x="-1.778" y="1.0" z="0.0" />
<!-- Upper right -->
<Pos x="1.778" y="1.0" z="0.0" />
</Viewplane>
</Viewport>
</Window>
</Node>
<Node address="127.0.0.2" port="20402">
<Window fullScreen="false">
<Pos x="640" y="300" />
<!-- 16:9 aspect ratio -->
<Size x="640" y="360" />
<Viewport>
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<Viewplane>
<!-- Lower left -->
<Pos x="-1.778" y="-1.0" z="0.0" />
<!-- Upper left -->
<Pos x="-1.778" y="1.0" z="0.0" />
<!-- Upper right -->
<Pos x="1.778" y="1.0" z="0.0" />
</Viewplane>
</Viewport>
</Window>
</Node>
<User eyeSeparation="0.065">
<Pos x="0.0" y="0.0" z="4.0" />
</User>
</Cluster>

View File

@@ -10,6 +10,7 @@ return {
CONFIG = "${BASE_PATH}/config"
},
SGCTConfig = "${SGCT}/single.xml",
--sgctConfig = "${SGCT}/single_sbs_stereo.xml",
--SGCTConfig = "${SGCT}/two_nodes.xml",
--SGCTConfig = "${SGCT}/single_sbs_stereo.xml",
Scene = "${SCENEPATH}/default.scene"
}

View File

@@ -397,6 +397,9 @@ void OpenSpaceEngine::mouseScrollWheelCallback(int pos)
void OpenSpaceEngine::encode()
{
#ifdef FLARE_ONLY
_flare->encode();
#else
std::vector<char> dataStream(1024);
size_t offset = 0;
@@ -405,21 +408,20 @@ void OpenSpaceEngine::encode()
_synchronizationBuffer.setVal(dataStream);
sgct::SharedData::instance()->writeVector(&_synchronizationBuffer);
#ifdef FLARE_ONLY
_flare->encode();
#endif
}
void OpenSpaceEngine::decode()
{
#ifdef FLARE_ONLY
_flare->decode();
#else
sgct::SharedData::instance()->readVector(&_synchronizationBuffer);
std::vector<char> dataStream = std::move(_synchronizationBuffer.getVal());
size_t offset = 0;
// deserialize in the same order as done in serialization
_renderEngine->deserialize(dataStream, offset);
#ifdef FLARE_ONLY
_flare->decode();
#endif
}