Equalizer  1.6.1
eqPly/main.cpp
1 
2 /* Copyright (c) 2005-2011, Stefan Eilemann <eile@equalizergraphics.com>
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * - Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  * - Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12  * - Neither the name of Eyescale Software GmbH nor the names of its
13  * contributors may be used to endorse or promote products derived from this
14  * software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #include "eqPly.h"
30 
31 #include "channel.h"
32 #include "config.h"
33 #include "error.h"
34 #include "node.h"
35 #include "pipe.h"
36 #include "view.h"
37 #include "window.h"
38 
39 #include <stdlib.h>
40 
41 class NodeFactory : public eq::NodeFactory
42 {
43 public:
45  { return new eqPly::Config( parent ); }
46  virtual eq::Node* createNode( eq::Config* parent )
47  { return new eqPly::Node( parent ); }
48  virtual eq::Pipe* createPipe( eq::Node* parent )
49  { return new eqPly::Pipe( parent ); }
50  virtual eq::Window* createWindow( eq::Pipe* parent )
51  { return new eqPly::Window( parent ); }
52  virtual eq::Channel* createChannel( eq::Window* parent )
53  { return new eqPly::Channel( parent ); }
54  virtual eq::View* createView( eq::Layout* parent )
55  { return new eqPly::View( parent ); }
56 };
57 
58 int main( const int argc, char** argv )
59 {
60  // 1. Equalizer initialization
61  NodeFactory nodeFactory;
63 
64  if( !eq::init( argc, argv, &nodeFactory ))
65  {
66  LBERROR << "Equalizer init failed" << std::endl;
67  return EXIT_FAILURE;
68  }
69 
70  // 2. parse arguments
71  eqPly::LocalInitData initData;
72  initData.parseArguments( argc, argv );
73 
74  // 3. initialization of local client node
75  lunchbox::RefPtr< eqPly::EqPly > client = new eqPly::EqPly( initData );
76  if( !client->initLocal( argc, argv ))
77  {
78  LBERROR << "Can't init client" << std::endl;
79  eq::exit();
80  return EXIT_FAILURE;
81  }
82 
83  // 4. run client
84  const int ret = client->run();
85 
86  // 5. cleanup and exit
87  client->exitLocal();
88 
89  LBASSERTINFO( client->getRefCount() == 1, client );
90  client = 0;
91 
92  eq::exit();
94  return ret;
95 }
virtual eq::Window * createWindow(eq::Pipe *parent)
Create a new window.
Definition: eqPly/main.cpp:50
A configuration is a visualization session driven by an application.
virtual eq::Config * createConfig(eq::ServerPtr parent)
Create a new config.
Definition: eqPly/main.cpp:44
virtual eq::Node * createNode(eq::Config *parent)
Create a new node.
Definition: eqPly/main.cpp:46
A channel represents a two-dimensional viewport within a Window.
A View is a 2D area of a Layout.
A Window represents an on-screen or off-screen drawable.
virtual eq::Pipe * createPipe(eq::Node *parent)
Create a new pipe.
Definition: eqPly/main.cpp:48
A layout groups one or more View, logically belonging together.
Definition: client/layout.h:44
The rendering entity, updating a part of a Window.
A Node represents a single computer in the cluster.
A Pipe represents a graphics card (GPU) on a Node.
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
A window represent an OpenGL drawable and context.
void initErrors()
Set up eqPly-specific error codes.
Definition: eqPly/error.cpp:50
The node factory is a per-node singleton used to create and release Equalizer resource instances...
Definition: nodeFactory.h:36
Representation of a node in the cluster.
The representation of one GPU.
virtual eq::View * createView(eq::Layout *parent)
Create a new view.
Definition: eqPly/main.cpp:54
bool init(const int argc, char **argv, NodeFactory *nodeFactory)
Initialize the Equalizer client library.
Definition: client/init.h:57
bool exit()
De-initialize the Equalizer client library.
Manages the argument parsing and non-distributed part of the initialization data. ...
void exitErrors()
Clear eqPly-specific error codes.
Definition: eqPly/error.cpp:58
The EqPly application instance.
Definition: eqPly.h:56
virtual eq::Channel * createChannel(eq::Window *parent)
Create a new channel.
Definition: eqPly/main.cpp:52
The configuration, run be the EqPly application.