Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::ClusterWindow Class Reference
[Cluster]

Abstract base class for cluster configurations. More...

#include <OSGClusterWindow.h>

Inheritance diagram for osg::ClusterWindow:

osg::ClusterWindowBase osg::Window osg::WindowBase osg::AttachmentContainer osg::FieldContainer osg::MultiDisplayWindowBase osg::SortFirstWindowBase osg::MultiDisplayWindow osg::SortFirstWindow List of all members.

asynchronous initialization

bool initAsync (connectioncbfp fp)
void setConnectionCB (connectioncbfp fp)
*typedef bool(* connectioncbfp )(std::string server, Real32 progress)

Extension handling

bool hasExtension (UInt32 id)
bool hasExtension (const Char8 *s)
void * getFunction (UInt32 id)
void * getFunctionNoCheck (UInt32 id)
void dumpExtensions (void)
GLExtensionFunction getFunctionByName (const Char8 *s)
Real32 getConstantValue (GLenum val)
const Vec2fgetConstantValuev (GLenum val)
const std::vector< std::string > & getRegisteredFunctions (void)
const std::vector< std::string > & getExtensions (void)
const std::vector< std::string > & getIgnoredExtensions (void)
*static void setGLLibraryName (const Char8 *s)
static Int32 getExtensionId (const Char8 *s)
static bool hasCommonExtension (UInt32 id)
static const std::vector<
std::string > & 
getRegisteredExtensions (void)

GL object handling

*void validateGLObject (UInt32 id)
void validateAllGLObjects (void)
GLObjectStatusE getGLObjectStatus (UInt32 id)
void setGLObjectId (UInt32 id, UInt32 id2)
UInt32 getGLObjectId (UInt32 id)
static void refreshGLObject (UInt32 id)
static void reinitializeGLObject (UInt32 id)
static void destroyGLObject (UInt32 id, UInt32 num=1)
static void unpackIdStatus (UInt32 idstatus, UInt32 &id, GLObjectStatusE &status)

Sync

*void executeSyncImpl (ClusterWindowBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)

GL object handling

void doInitRegisterGLObject (UInt32 id, UInt32 num)
*static void initRegisterGLObject (UInt32 id, UInt32 num)
static UInt32 packIdStatus (UInt32 id, GLObjectStatusE status)

Public Types

typedef ClusterWindowPtr Ptr
enum  {
  ServersFieldId = Inherited::NextFieldId, ConnectionTypeFieldId = ServersFieldId + 1, ConnectionInterfaceFieldId = ConnectionTypeFieldId + 1, ConnectionDestinationFieldId = ConnectionInterfaceFieldId + 1,
  ConnectionParamsFieldId = ConnectionDestinationFieldId + 1, ServicePortFieldId = ConnectionParamsFieldId + 1, ServiceAddressFieldId = ServicePortFieldId + 1, ClientWindowFieldId = ServiceAddressFieldId + 1,
  InterleaveFieldId = ClientWindowFieldId + 1, FrameCountFieldId = InterleaveFieldId + 1, ComposerFieldId = FrameCountFieldId + 1, AutostartFieldId = ComposerFieldId + 1,
  CalibrationFieldId = AutostartFieldId + 1, NextFieldId = CalibrationFieldId + 1
}
typedef ArgsCollector< UInt32GLObjectFunctorArgs
typedef TypedVoidFunctor2Base<
PtrCallArg< Window >, GLObjectFunctorArgs
GLObjectFunctor
typedef void(* GLExtensionFunction )(void)
enum  GLObjectStatusE {
  notused = 1, initialize, reinitialize, initialized,
  needrefresh, destroy, finaldestroy
}
enum  { statusShift = 3, statusMask = 7 }

Public Member Functions

window functions
*virtual void changed (BitVector whichField, UInt32 origin)
 react to field changes
Output
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
 output the instance for debug purposes
FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Binary Access
*virtual UInt32 getBinSize (const BitVector &whichField)
virtual void copyToBin (BinaryDataHandler &pMem, const BitVector &whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField)
Copy
*virtual FieldContainerPtr shallowCopy (void) const

Static Public Member Functions

Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static ClusterWindowPtr create (void)
 create a new instance of the class
static ClusterWindowPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype

Static Public Attributes

static const osg::BitVector ServersFieldMask
static const osg::BitVector ConnectionTypeFieldMask
static const osg::BitVector ConnectionInterfaceFieldMask
static const osg::BitVector ConnectionDestinationFieldMask
static const osg::BitVector ConnectionParamsFieldMask
static const osg::BitVector ServicePortFieldMask
static const osg::BitVector ServiceAddressFieldMask
static const osg::BitVector ClientWindowFieldMask
static const osg::BitVector InterleaveFieldMask
static const osg::BitVector FrameCountFieldMask
static const osg::BitVector ComposerFieldMask
static const osg::BitVector AutostartFieldMask
static const osg::BitVector CalibrationFieldMask
static const osg::BitVector MTInfluenceMask
static const Real32 unknownConstant = -1e100
static const osg::BitVector WidthFieldMask
static const osg::BitVector HeightFieldMask
static const osg::BitVector PortFieldMask
static const osg::BitVector ResizePendingFieldMask
static const osg::BitVector GlObjectEventCounterFieldMask
static const osg::BitVector GlObjectLastRefreshFieldMask
static const osg::BitVector GlObjectLastReinitializeFieldMask
static const BitVector AttachmentsFieldMask
static const BitVector NextFieldMask

Protected Member Functions

client window funcitons
*virtual void clientInit (void)
virtual void clientPreSync (void)
virtual void clientRender (RenderActionBase *action)
virtual void clientSwap (void)
server window funcitons
*virtual void serverInit (WindowPtr window, UInt32 id)
virtual void serverRender (WindowPtr window, UInt32 id, RenderActionBase *action)
virtual void serverSwap (WindowPtr window, UInt32 id)
Constructors / Destructor
ClusterWindow (void)
 Constructor.
 ClusterWindow (const ClusterWindow &source)
 Copy Constructor.
virtual ~ClusterWindow (void)
 Destructor.

Private Types

typedef ClusterWindowBase Inherited

Private Member Functions

void operator= (const ClusterWindow &source)

Static Private Member Functions

init method
*static void initMethod (void)

Private Attributes

private members
*connectioncbfp _connectionFP
ClusterNetwork_network

Friends

class FieldContainer
class ClusterWindowBase
class ClusterServer
class ClusterClient

Classes

class  AsyncCancel

Detailed Description

A ClusterWindow describes a clustering algorithm. A ClusterWindow inherits the ability to connect rendering servers and initiate remote rendering. By configuring the cluster algorithm with an OpenSG Window structure, it is possible to use cluster rendering in the same way as rendering in a GLUT or Qt window.

Definition at line 57 of file OSGClusterWindow.h.


Member Typedef Documentation

typedef ClusterWindowBase osg::ClusterWindow::Inherited [private]
 

Reimplemented from osg::ClusterWindowBase.

Reimplemented in osg::MultiDisplayWindow, osg::MultiDisplayWindowBase, osg::SortFirstWindow, and osg::SortFirstWindowBase.

Definition at line 61 of file OSGClusterWindow.h.

typedef ClusterWindowPtr osg::ClusterWindowBase::Ptr [inherited]
 

Reimplemented from osg::WindowBase.

Reimplemented in osg::MultiDisplayWindowBase, and osg::SortFirstWindowBase.

Definition at line 102 of file OSGClusterWindowBase.h.

typedef ArgsCollector<UInt32> osg::Window::GLObjectFunctorArgs [inherited]
 

Definition at line 96 of file OSGWindow.h.

typedef TypedVoidFunctor2Base<PtrCallArg<Window> , GLObjectFunctorArgs> osg::Window::GLObjectFunctor [inherited]
 

Definition at line 99 of file OSGWindow.h.

typedef void(* osg::Window::GLExtensionFunction)(void) [inherited]
 

Definition at line 101 of file OSGWindow.h.


Member Enumeration Documentation

anonymous enum [inherited]
 

Enumerator:
ServersFieldId 
ConnectionTypeFieldId 
ConnectionInterfaceFieldId 
ConnectionDestinationFieldId 
ConnectionParamsFieldId 
ServicePortFieldId 
ServiceAddressFieldId 
ClientWindowFieldId 
InterleaveFieldId 
FrameCountFieldId 
ComposerFieldId 
AutostartFieldId 
CalibrationFieldId 
NextFieldId 

Reimplemented from osg::Window.

Definition at line 104 of file OSGClusterWindowBase.h.

00105     {
00106         ServersFieldId               = Inherited::NextFieldId,
00107         ConnectionTypeFieldId        = ServersFieldId               + 1,
00108         ConnectionInterfaceFieldId   = ConnectionTypeFieldId        + 1,
00109         ConnectionDestinationFieldId = ConnectionInterfaceFieldId   + 1,
00110         ConnectionParamsFieldId      = ConnectionDestinationFieldId + 1,
00111         ServicePortFieldId           = ConnectionParamsFieldId      + 1,
00112         ServiceAddressFieldId        = ServicePortFieldId           + 1,
00113         ClientWindowFieldId          = ServiceAddressFieldId        + 1,
00114         InterleaveFieldId            = ClientWindowFieldId          + 1,
00115         FrameCountFieldId            = InterleaveFieldId            + 1,
00116         ComposerFieldId              = FrameCountFieldId            + 1,
00117         AutostartFieldId             = ComposerFieldId              + 1,
00118         CalibrationFieldId           = AutostartFieldId             + 1,
00119         NextFieldId                  = CalibrationFieldId           + 1
00120     };

enum osg::Window::GLObjectStatusE [inherited]
 

Enumeration values for the status of the GL objects. This is primarily used to signal the object's callback functions what to do. See OpenGL Objects & Extension Handling for a description.

Enumerator:
notused  Object is not used at all right now.
initialize  The object is being initialized for the first time.
reinitialize  The object is being re-initialized, i.e. it has changed significantly.
initialized  The object is initialized and valid.
needrefresh  The object is initialized but needs a refresh.
destroy  The object is to be destroyed, i.e. removed from the current OpenGL context.
finaldestroy  The object has been removed from all OpenGL contexts and used ressources but be freed now.

Definition at line 78 of file OSGWindow.h.

00079     {
00080         notused      = 1, 
00081         initialize, 
00082         reinitialize, 
00083         initialized,
00084         needrefresh, 
00085         destroy, 
00086         finaldestroy 
00087     };

anonymous enum [inherited]
 

Enumerator:
statusShift  Shift value to transform object id and status into asingle int.
statusMask  Mask value to transform object id and status into asingle int.

Definition at line 92 of file OSGWindow.h.

00092 { statusShift = 3, statusMask = 7 }; 


Constructor & Destructor Documentation

ClusterWindow::ClusterWindow void   )  [protected]
 

Definition at line 829 of file OSGClusterWindow.cpp.

00829                                  :
00830      Inherited(),
00831     _firstFrame(true),
00832     _statistics(NULL),
00833     _connectionFP(NULL),
00834     _network(NULL)
00835 {
00836 }

ClusterWindow::ClusterWindow const ClusterWindow source  )  [protected]
 

Definition at line 840 of file OSGClusterWindow.cpp.

00840                                                         :
00841     Inherited(source),
00842     _firstFrame(true),
00843     _statistics(NULL),
00844     _connectionFP(source._connectionFP),
00845     _network(NULL)
00846 {
00847 }

ClusterWindow::~ClusterWindow void   )  [protected, virtual]
 

Definition at line 851 of file OSGClusterWindow.cpp.

References _network, and osg::subRefP().

00852 {
00853     if(_network)
00854         subRefP(_network);
00855     _network=NULL;
00856 }


Member Function Documentation

void ClusterWindow::changed BitVector  whichField,
UInt32  origin
[virtual]
 

Reimplemented from osg::Window.

Reimplemented in osg::MultiDisplayWindow, and osg::SortFirstWindow.

Definition at line 81 of file OSGClusterWindow.cpp.

References osg::Window::changed().

Referenced by osg::SortFirstWindow::changed(), and osg::MultiDisplayWindow::changed().

00082 {
00083     Inherited::changed(whichField, origin);
00084 }

void ClusterWindow::dump UInt32  uiIndent = 0,
const BitVector  bvFlags = 0
const [virtual]
 

Reimplemented from osg::Window.

Reimplemented in osg::MultiDisplayWindow, and osg::SortFirstWindow.

Definition at line 88 of file OSGClusterWindow.cpp.

References SLOG.

00090 {
00091     SLOG << "Dump ClusterWindow NI" << std::endl;
00092 }

* virtual void(* osg::ClusterWindow::getFunctionByName const Char8 s  )  [virtual]
 

void ClusterWindow::activate void   )  [virtual]
 

Activate the Window's OpenGL context, so that OpenGL can be called.

Implements osg::Window.

Definition at line 424 of file OSGClusterWindow.cpp.

Referenced by render().

00425 {
00426 }

void ClusterWindow::deactivate void   )  [virtual]
 

Deativate the Window's OpenGL context. OpenGL calls are no longer possible after this call.

Implements osg::Window.

Definition at line 428 of file OSGClusterWindow.cpp.

00429 {
00430 }

void ClusterWindow::swap void   )  [virtual]
 

Swap the back and front buffers.

Warning:
The correct OpenGL context needs to be active for this to work!

Implements osg::Window.

Definition at line 432 of file OSGClusterWindow.cpp.

References clientSwap(), osg::ClusterNetwork::getAspect(), osg::ClusterNetwork::getMainConnection(), and getNetwork().

Referenced by render().

00433 {
00434     if(getNetwork()->getMainConnection() && getNetwork()->getAspect())
00435     {
00436         clientSwap();
00437     }
00438 }

void ClusterWindow::init void   )  [virtual]
 

init cluster window. connect to all servers

Implements osg::Window.

Definition at line 102 of file OSGClusterWindow.cpp.

References _connectionFP, osg::ClusterWindowBase::_sfServiceAddress, _statistics, osg::MField< FieldTypeT, fieldNameSpace >::begin(), osg::SocketAddress::BROADCAST, osg::Connection::Channel, osg::BinaryMessage::clear(), osg::DgramSocket::close(), osg::Connection::connectPoint(), osg::ConnectionFactory::createGroup(), osg::MField< FieldTypeT, fieldNameSpace >::end(), osg::MField< FieldTypeT, fieldNameSpace >::find(), osg::BinaryDataHandler::flush(), osg::ClusterWindowBase::getAutostart(), osg::ClusterWindowBase::getConnectionDestination(), osg::ClusterWindowBase::getConnectionInterface(), osg::ClusterWindowBase::getConnectionParams(), osg::ClusterWindowBase::getConnectionType(), osg::ClusterNetwork::getMainConnection(), getNetwork(), osg::ClusterWindowBase::getServers(), osg::ClusterWindowBase::getServicePort(), osg::BinaryMessage::getString(), osg::BinaryDataHandler::getValue(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), osg::DgramSocket::open(), osg::BinaryMessage::putString(), osg::BinaryDataHandler::putValue(), osg::Socket::recv(), osg::GroupConnection::resetSelection(), osg::Connection::selectChannel(), osg::DgramSocket::sendTo(), osg::ClusterNetwork::setAspect(), osg::ClusterWindowBase::setConnectionType(), osg::GroupConnection::setDestination(), osg::Connection::setInterface(), osg::ClusterNetwork::setMainConnection(), osg::BinaryDataHandler::setNetworkOrder(), osg::Connection::setParams(), osg::RemoteAspect::setStatistics(), osg::DgramSocket::setTTL(), SFATAL, SINFO, osg::MField< FieldTypeT, fieldNameSpace >::size(), osg::GroupConnection::subSelection(), SWARNING, osg::ConnectionFactory::the(), and osg::Socket::waitReadable().

Referenced by initAsync().

00103 {
00104     GroupConnection    *connection;
00105     RemoteAspect       *remoteAspect;
00106     int                 c,i,id;
00107     MFString::iterator  s;
00108     Connection::Channel channel;
00109     bool                directConnect=false;
00110 
00111     if(getNetwork()->getMainConnection())
00112     {
00113         SWARNING << "init called twice" << std::endl;
00114         return;
00115     }
00116     // create connection
00117     if(getConnectionType().empty())
00118     {
00119         setConnectionType("StreamSock");
00120     }
00121 
00122     connection = ConnectionFactory::the().createGroup(getConnectionType());
00123     if(connection == NULL)
00124     {
00125         SFATAL << "Unknown connection type " 
00126                << getConnectionType() 
00127                << std::endl;
00128         return;
00129     }
00130 
00131     connection->setDestination(getConnectionDestination());
00132     connection->setInterface(getConnectionInterface());
00133     connection->setParams(getConnectionParams());
00134 
00135     getNetwork()->setMainConnection(connection);
00136     // create remote aspect
00137     remoteAspect = new RemoteAspect();
00138     getNetwork()->setAspect(remoteAspect);
00139     if(_statistics)
00140         remoteAspect->setStatistics(_statistics);
00141 
00142     // autostart servers
00143     std::string server;
00144     std::string autostart;
00145     std::string env;
00146 
00147     Real32 progress = 0.0f;
00148     Real32 progressStep = 1.0f / Real32(getServers().size());
00149 
00150     if(getAutostart().size())
00151     {
00152         progressStep /= 2;
00153         std::vector<FILE*>           pipes;
00154 
00155         for(id=0 ; id<getServers().size() ; ++id)
00156         {
00157             std::ostringstream command;
00158 
00159             server    = getServers()[id];
00160             int pos=server.find(":");
00161             if(pos>=0)
00162                 server.erase(pos);
00163 
00164             autostart = getAutostart()[id % getAutostart().size()];
00165 
00166             for(c = 0 ; c < autostart.length() ; ++c)
00167             {
00168                 if(autostart[c] == '%' && c+1 < autostart.length())  
00169                     switch(autostart[++c])
00170                     {
00171                         case 's': 
00172                             command << server;
00173                             break;
00174                         case 'n': 
00175                             command << getServers()[id];
00176                             break;
00177                         case 'i':
00178                             command << id;
00179                             break;
00180                         case '{':
00181                             env = "" ;
00182                             while(++c < autostart.length() &&
00183                                   autostart[c] != '}')
00184                                 env += autostart[c];
00185                             if(getenv(env.c_str()))
00186                                 command << getenv(env.c_str());
00187                             break;
00188                         case '%':
00189                             command << '%';
00190                             break;
00191                         default:
00192                             command << '%' << autostart[c];
00193                     }
00194                 else
00195                     command << autostart[c];
00196             } 
00197             SINFO << command.str() << std::endl;
00198 #ifdef WIN32
00199             FILE *pipe = _popen(command.str().c_str(),"r");
00200 #else
00201             FILE *pipe = popen(command.str().c_str(),"r");
00202 #endif
00203             if(!pipe)
00204                 SFATAL << "Error starting: " << command << std::endl;
00205             pipes.push_back(pipe);
00206         }
00207         for(id=0 ; id<getServers().size() ; ++id)
00208         {
00209             if(pipes[id]) 
00210             {
00211                 // update progress
00212                 if(_connectionFP != NULL)
00213                 {
00214                     std::string message;
00215                     message += "Starting:" + getServers()[id]; 
00216                     if(!_connectionFP(message, progress))
00217                     {
00218                         // abort, cleanup remaining pipes
00219                         for( ; id<getServers().size() ; ++id)
00220                         {
00221                             if(pipes[id]) 
00222                             {
00223 #ifdef WIN32
00224                                 _pclose(pipes[id]);
00225 #else
00226                                 pclose(pipes[id]);
00227 #endif
00228                             }
00229                             throw AsyncCancel();
00230                         }
00231                     }
00232                 }
00233                 SINFO << "Waiting for " << getServers()[id] << " to start." << std::endl;
00234                 char result;
00235                 std::string line="";
00236                 while((result=fgetc(pipes[id])) != EOF)
00237                 {
00238                     line += result;
00239                     if(result == '\n')
00240                     {
00241                         SINFO << line;
00242                         line = "";
00243                     }
00244                 }
00245                 if(!line.empty())
00246                     SINFO << line << std::endl;
00247 #ifdef WIN32
00248                 _pclose(pipes[id]);
00249 #else
00250                 pclose(pipes[id]);
00251 #endif
00252                 SINFO << getServers()[id] << " started." << std::endl;
00253                 progress += progressStep;
00254             }
00255         }
00256     }
00257 
00258     // connect to all servers
00259     for(s =getServers().begin();
00260         s!=getServers().end();
00261         s++)
00262     {
00263         DgramSocket      serviceSock;
00264         BinaryMessage    msg;
00265         std::string      respServer;
00266         std::string      respAddress;
00267         bool             retry=true;
00268 
00269         if(strstr((*s).c_str(),":"))
00270             directConnect = true;
00271         else
00272             directConnect = false;
00273 
00274         SINFO << "Connect to " << (*s) << std::endl;
00275         serviceSock.open();
00276         serviceSock.setTTL(8);
00277         while(retry)
00278         {
00279             try
00280             {
00281                 // update progress
00282                 if(_connectionFP != NULL)
00283                 {
00284                     std::string message;
00285                     message += "Connecting:" + *s; 
00286                     if(!_connectionFP(message, progress))
00287                     {
00288                         serviceSock.close();
00289                         throw AsyncCancel();
00290                     }
00291                 }
00292 
00293                 // try to connect with the servers name
00294                 try 
00295                 {
00296                     if(directConnect)
00297                     {
00298                         channel = connection->connectPoint(*s,0.5);
00299                         if(channel >= 0) {
00300                             retry=false;
00301                             SINFO << "Connected with address:" << *s << std::endl;
00302                             break;
00303                         }
00304                     }
00305                 }
00306                 catch(...)
00307                 {
00308                 }
00309                 // find server
00310                 msg.clear();
00311                 msg.putString(*s);
00312                 msg.putString(getConnectionType());
00313                     
00314                 if(_sfServiceAddress.getValue().size() != 0)
00315                 {
00316                     SINFO << "send request to:" << 
00317                         _sfServiceAddress.getValue()
00318                           << std::endl;
00319                     serviceSock.sendTo(
00320                         msg,SocketAddress(
00321                             _sfServiceAddress.getValue().c_str(),
00322                             getServicePort()));
00323                 }
00324                 SINFO << "send request to:" 
00325                       << SocketAddress(SocketAddress::BROADCAST,
00326                                        getServicePort()).getHost().c_str()
00327                       << std::endl;
00328                 serviceSock.sendTo(
00329                     msg,SocketAddress(SocketAddress::BROADCAST,
00330                                       getServicePort()));
00331                 if(serviceSock.waitReadable(0.1))
00332                 {
00333                     serviceSock.recv(msg);
00334                     msg.getString(respServer);
00335                     msg.getString(respAddress);
00336                     if(respServer == *s)
00337                     {
00338                         SINFO << "Found at address " << respAddress << std::endl;
00339                         // connect to server
00340                         channel = connection->connectPoint(respAddress);
00341                         if(channel >= 0)
00342                             retry=false;
00343                     }
00344                 }
00345             }
00346             catch(AsyncCancel &)
00347             {
00348                 throw;
00349             }
00350             catch(OSG_STDEXCEPTION_NAMESPACE::exception &e)
00351             {
00352                 SINFO << e.what() << std::endl;
00353             }
00354         }
00355         serviceSock.close();
00356         progress += progressStep;
00357     }
00358     // determine byte order
00359     UInt8 serverLittleEndian;
00360     UInt8 forceNetworkOrder=false;
00361 #if BYTE_ORDER == LITTLE_ENDIAN
00362     UInt8 littleEndian = true;
00363 #else
00364     UInt8 littleEndian = false;
00365 #endif
00366     for(UInt32 i=0;i<getServers().size();++i)
00367     {
00368         channel = connection->selectChannel();
00369         connection->subSelection(channel);
00370         connection->getValue(serverLittleEndian);
00371         if(serverLittleEndian != littleEndian)
00372         {
00373             forceNetworkOrder=true;
00374         }
00375     }
00376     connection->resetSelection();
00377     // tell the servers the encoding mode
00378     connection->putValue(forceNetworkOrder);
00379     connection->flush();
00380     connection->setNetworkOrder((forceNetworkOrder != 0));
00381     if(forceNetworkOrder)
00382     {
00383         SINFO << "Run clustering in network order mode" << std::endl;
00384     }
00385     // inform connection finished
00386     if(_connectionFP != NULL)
00387         _connectionFP("ok", 1.0);
00388 }

void ClusterWindow::render RenderActionBase action = NULL  )  [virtual]
 

Render the Window using the given RenderAction.

It takes care of all initialisation and cleanup functions and contains just 5 lines of code. If you know that the correct context is active or you want to delay swaps you can just copy and manipulate it.

Reimplemented from osg::Window.

Definition at line 415 of file OSGClusterWindow.cpp.

References activate(), frameExit(), frameInit(), renderAllViewports(), and swap().

00416 {
00417     activate();
00418     frameInit();
00419     renderAllViewports(action);
00420     swap();
00421     frameExit();
00422 }

void ClusterWindow::renderAllViewports RenderActionBase action = NULL  )  [virtual]
 

Render all the Viewports of the Window using the given RenderAction.

A simple convenience function that loops all Viewports and call their draw method.

Reimplemented from osg::Window.

Definition at line 440 of file OSGClusterWindow.cpp.

References clientRender(), osg::ClusterNetwork::getAspect(), osg::ClusterNetwork::getMainConnection(), and getNetwork().

Referenced by render().

00441 {
00442     if(getNetwork()->getMainConnection() && getNetwork()->getAspect())
00443     {
00444         clientRender(action);
00445     }
00446 }

void ClusterWindow::frameInit void   )  [virtual]
 

Do everything that needs to be done before the Window is redrawn. This function has to be called for every frame the Window is drawn.

The convenience functions render and draw take care of it, if they are used.

The main task currently is checking and updating OpenGL extensions.

Reimplemented from osg::Window.

Definition at line 448 of file OSGClusterWindow.cpp.

References _firstFrame, osg::beginEditCP(), osg::ChangeList::clearAll(), clientInit(), clientPreSync(), osg::endEditCP(), osg::ClusterWindowBase::FrameCountFieldMask, osg::ClusterNetwork::getAspect(), osg::PThreadBase::getCurrentChangeList(), osg::ClusterWindowBase::getFrameCount(), osg::ClusterNetwork::getMainConnection(), getNetwork(), osg::ChangeList::merge(), osg::RemoteAspect::sendSync(), and osg::ClusterWindowBase::setFrameCount().

Referenced by render().

00449 {
00450     ClusterWindowPtr ptr(this);
00451     Connection   *connection  =getNetwork()->getMainConnection();
00452     RemoteAspect *remoteAspect=getNetwork()->getAspect();
00453 
00454     if(remoteAspect && connection)
00455     {
00456         if(_firstFrame)
00457         {
00458             beginEditCP(ptr,ClusterWindow::FrameCountFieldMask);
00459             setFrameCount(0);
00460             endEditCP(ptr,ClusterWindow::FrameCountFieldMask);
00461             // send sync
00462             remoteAspect->sendSync(*connection);
00463             ChangeList cl;
00464             cl.clearAll();
00465             cl.merge(*Thread::getCurrentChangeList());
00466             Thread::getCurrentChangeList()->clearAll();
00467             // init client window
00468             clientInit();
00469             // last chance to modifie before sync
00470             clientPreSync();
00471             // send sync
00472             remoteAspect->sendSync(*connection);
00473             cl.merge(*Thread::getCurrentChangeList());
00474             Thread::getCurrentChangeList()->clearAll();
00475             Thread::getCurrentChangeList()->merge(cl);
00476             _firstFrame=false;
00477         }
00478         else
00479         {
00480