11/* ********************************************************************/
2- /* Copyright (c) 2014-2017 , EPFL/Blue Brain Project */
2+ /* Copyright (c) 2014-2018 , EPFL/Blue Brain Project */
33/* Raphael Dumusc <raphael.dumusc@epfl.ch> */
44/* */
55/* Copyright (c) 2011 - 2012, The University of Texas at Austin. */
@@ -60,11 +60,15 @@ bool deflectCompressImage = true;
6060bool deflectStereoStreamLeft = false ;
6161bool deflectStereoStreamRight = false ;
6262bool deflectStereoSideBySide = false ;
63+ bool deflectDualChannel = false ;
6364unsigned int deflectCompressionQuality = 75 ;
6465std::string deflectHost;
6566std::string deflectStreamId = " SimpleStreamer" ;
6667std::unique_ptr<deflect::Stream> deflectStream;
6768
69+ bool deflectFirstEventReceived = false ;
70+ bool waitToStart = false ;
71+
6872void syntax (int exitStatus);
6973void readCommandLineArguments (int argc, char ** argv);
7074void initGLWindow (int argc, char ** argv);
@@ -118,6 +122,8 @@ void syntax(const int exitStatus)
118122 << std::endl;
119123 std::cout << " -2 enable side-by-side stereo (default: OFF)"
120124 << std::endl;
125+ std::cout << " -c enable dual-channel mode (default: OFF)"
126+ << std::endl;
121127 exit (exitStatus);
122128}
123129
@@ -158,6 +164,9 @@ void readCommandLineArguments(int argc, char** argv)
158164 case ' 2' :
159165 deflectStereoSideBySide = true ;
160166 break ;
167+ case ' c' :
168+ deflectDualChannel = true ;
169+ break ;
161170 case ' h' :
162171 syntax (EXIT_SUCCESS);
163172 default :
@@ -280,7 +289,7 @@ struct Image
280289 }
281290};
282291
283- bool send (const Image& image, const deflect::View view)
292+ bool send (const Image& image, const deflect::View view, const uint8_t channel )
284293{
285294 deflect::ImageWrapper deflectImage (image.data .data (), image.width ,
286295 image.height , deflect::RGBA);
@@ -290,6 +299,7 @@ bool send(const Image& image, const deflect::View view)
290299 deflectImage.compressionQuality = deflectCompressionQuality;
291300 deflectImage.view = view;
292301 deflectImage.rowOrder = deflect::RowOrder::bottom_up;
302+ deflectImage.channel = channel;
293303 return deflectStream->send (deflectImage).get ();
294304}
295305
@@ -321,22 +331,18 @@ void drawMono()
321331 glutSolidTeapot (1 .f );
322332}
323333
324- void display ( )
334+ bool drawAndSend ( const uint8_t channel )
325335{
326- static Camera camera;
327- camera.apply ();
328-
329336 bool success = false ;
330- bool waitToStart = false ;
331- static bool deflectFirstEventReceived = false ;
337+
332338 if (deflectStereoSideBySide)
333339 {
334340 drawLeft ();
335341 const auto leftImage = Image::readGlBuffer ();
336342 drawRight ();
337343 const auto rightImage = Image::readGlBuffer ();
338344 const auto sideBySideImage = Image::sideBySide (leftImage, rightImage);
339- success = send (sideBySideImage, deflect::View::side_by_side);
345+ success = send (sideBySideImage, deflect::View::side_by_side, channel );
340346 }
341347 else if (deflectStereoStreamLeft || deflectStereoStreamRight)
342348 {
@@ -352,21 +358,41 @@ void display()
352358 {
353359 drawLeft ();
354360 const auto leftImage = Image::readGlBuffer ();
355- success = send (leftImage, deflect::View::left_eye);
361+ success = send (leftImage, deflect::View::left_eye, channel );
356362 }
357363 if (deflectStereoStreamRight && !waitToStart)
358364 {
359365 drawRight ();
360366 const auto rightImage = Image::readGlBuffer ();
361367 success = (!deflectStereoStreamLeft || success) &&
362- send (rightImage, deflect::View::right_eye);
368+ send (rightImage, deflect::View::right_eye, channel );
363369 }
364370 }
365371 else
366372 {
367373 drawMono ();
368- success = send (Image::readGlBuffer (), deflect::View::mono);
374+ success = send (Image::readGlBuffer (), deflect::View::mono, channel);
375+ }
376+
377+ return success;
378+ }
379+
380+ void display ()
381+ {
382+ static Camera camera;
383+ camera.apply ();
384+
385+ bool success = false ;
386+ if (deflectDualChannel)
387+ {
388+ glPushMatrix ();
389+ glRotatef (90 , -1 .f , 0 .f , 0 .f );
390+ success = drawAndSend (1 );
391+ glPopMatrix ();
392+ success = success && drawAndSend (0 );
369393 }
394+ else
395+ success = drawAndSend (0 );
370396
371397 if (!waitToStart)
372398 success = success && deflectStream->finishFrame ().get ();
0 commit comments