lib/dgr.c
/** Send or receive data depending on DGR configuration. If we are a
 * DGR master, dgr_update() will send data to the network. if we are
 * DGR slave, dgr_update() will receive data from the network. In an
 * OpenGL DGR program, you would typically call this method every time
 * you render a frame. This function may call exit() if we are a slave
 * which has received a special packet indicating that we should
 * exit.
 *
 * The master process and the slave process migh want to call
 * dgr_update() at different times, however. For example, a master
 * process should send information as soon as it is set (perhaps after
 * rendering but before buffer swap). A slave process should receive
 * last minute before any dgr variables are used. To support this, you
 * can use the parameters passed to dgr_update() to disable sending or
 * receiving.
 *
 * @param send If set to 1 and if process is a DGR master, will call
 * dgr_send().
 *
 * @param receive If set to 1 and if process is a DGR slave, will call
 * dgr_receive().
 */
Send or receive data depending on DGR configuration. If we are a
DGR master, dgr_update() will send data to the network. if we are
DGR slave, dgr_update() will receive data from the network. In an
OpenGL DGR program, you would typically call this method every time
you render a frame. This function may call exit() if we are a slave
which has received a special packet indicating that we should
exit.

The master process and the slave process migh want to call
dgr_update() at different times, however. For example, a master
process should send information as soon as it is set (perhaps after
rendering but before buffer swap). A slave process should receive
last minute before any dgr variables are used. To support this, you
can use the parameters passed to dgr_update() to disable sending or
receiving.

@param send If set to 1 and if process is a DGR master, will call
dgr_send().

@param receive If set to 1 and if process is a DGR slave, will call
dgr_receive().
Send or receive data depending on DGR configuration . If we are a DGR master dgr_update () will send data to the network . if we are DGR slave dgr_update () will receive data from the network . In an OpenGL DGR program you would typically call this method every time you render a frame . This function may call exit () if we are a slave which has received a special packet indicating that we should exit . The master process and the slave process migh want to call dgr_update () at different times however . For example a master process should send information as soon as it is set ( perhaps after rendering but before buffer swap ) . A slave process should receive last minute before any dgr variables are used . To support this you can use the parameters passed to dgr_update () to disable sending or receiving . @param send If set to 1 and if process is a DGR master will call dgr_send () . @param receive If set to 1 and if process is a DGR slave will call dgr_receive () .
void dgr_update(int send, int receive)
{
	if(dgr_disabled)
		return;
	if(dgr_is_master() && send == 1)
		dgr_send();
	if(dgr_is_master() == 0 && receive == 1)
	{
		if(dgr_time_lastreceive == 0)
		{
			dgr_receive(300000);  
		}
		else
			dgr_receive(0);
	}
}
void dgr_update ( int send , int receive ) { if ( dgr_disabled ) return ; if ( dgr_is_master ( ) && send == 1 ) dgr_send ( ) ; if ( dgr_is_master ( ) == 0 && receive == 1 ) { if ( dgr_time_lastreceive == 0 ) { dgr_receive ( 300000 ) ; } else dgr_receive ( 0 ) ; } }
Send or receive data depending on DGR configuration.
Send or receive data depending on DGR configuration .
// if it is our first time receiving, allow for a delay. /* Give plenty of time for us to receive the first
			 * packet. It might arrive very slowly if the master
			 * process is starting up slowly because it is loading a
			 * large image or model file. */ // 300000 milliseconds = 30 seconds