Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
eqPly/main.cpp
1 
2 /* Copyright (c) 2005-2014, 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 
30 #ifdef EQUALIZER_USE_QT4
31 # include <QApplication>
32 #endif
33 
34 #include "eqPly.h"
35 
36 #include "channel.h"
37 #include "config.h"
38 #include "error.h"
39 #include "node.h"
40 #include "pipe.h"
41 #include "view.h"
42 #include "window.h"
43 
44 #include <stdlib.h>
45 
46 class NodeFactory : public eq::NodeFactory
47 {
48 public:
50  { return new eqPly::Config( parent ); }
51  virtual eq::Node* createNode( eq::Config* parent )
52  { return new eqPly::Node( parent ); }
53  virtual eq::Pipe* createPipe( eq::Node* parent )
54  { return new eqPly::Pipe( parent ); }
55  virtual eq::Window* createWindow( eq::Pipe* parent )
56  { return new eqPly::Window( parent ); }
57  virtual eq::Channel* createChannel( eq::Window* parent )
58  { return new eqPly::Channel( parent ); }
59  virtual eq::View* createView( eq::Layout* parent )
60  { return new eqPly::View( parent ); }
61 };
62 
63 int main( int argc, char** argv )
64 {
65  // 1. Equalizer initialization
66  NodeFactory nodeFactory;
68 
69  // 2. parse arguments
70  eqPly::LocalInitData initData;
71  initData.parseArguments( argc, argv );
72 
73 #ifdef EQUALIZER_USE_QT4
74  QApplication* app = 0;
75  if( initData.getWindowSystem() == "Qt" )
76  {
77  #ifdef GLX
78  ::XInitThreads();
79  #endif
80  app = new QApplication( argc, argv );
81  }
82 #endif
83 
84  if( !eq::init( argc, argv, &nodeFactory ))
85  {
86  LBERROR << "Equalizer init failed" << std::endl;
87  eq::exit();
88  return EXIT_FAILURE;
89  }
90 
91  // 3. initialization of local client node
92  lunchbox::RefPtr< eqPly::EqPly > client = new eqPly::EqPly( initData );
93  if( !client->initLocal( argc, argv ))
94  {
95  LBERROR << "Can't init client" << std::endl;
96  eq::exit();
97  return EXIT_FAILURE;
98  }
99 
100  // 4. run client
101  const int ret = client->run();
102 
103  // 5. cleanup and exit
104  client->exitLocal();
105 
106  LBASSERTINFO( client->getRefCount() == 1, client );
107  client = 0;
108 
109 #ifdef EQUALIZER_USE_QT4
110  delete app;
111 #endif
112 
113  eq::exit();
115  return ret;
116 }
A channel represents a two-dimensional viewport within a Window.
The representation of one GPU.
A configuration is a visualization session driven by an application.
virtual eq::View * createView(eq::Layout *parent)
Create a new view.
Definition: eqPly/main.cpp:59
A Pipe represents a graphics card (GPU) on a Node.
A Node represents a single computer in the cluster.
The rendering entity, updating a part of a Window.
lunchbox::RefPtr< Server > ServerPtr
A reference-counted pointer to an eq::Server.
A Window represents an on-screen or off-screen drawable.
virtual eq::Channel * createChannel(eq::Window *parent)
Create a new channel.
Definition: eqPly/main.cpp:57
virtual eq::Window * createWindow(eq::Pipe *parent)
Create a new window.
Definition: eqPly/main.cpp:55
bool init(const int argc, char **argv, NodeFactory *nodeFactory)
Initialize the Equalizer client library.
Definition: client/init.h:58
A layout groups one or more View, logically belonging together.
Definition: client/layout.h:46
A View is a 2D area of a Layout.
void exitErrors()
Clear eqPly-specific error codes.
Definition: eqPly/error.cpp:58
A window represent an OpenGL drawable and context.
void initErrors()
Set up eqPly-specific error codes.
Definition: eqPly/error.cpp:50
Representation of a node in the cluster.
Manages the argument parsing and non-distributed part of the initialization data. ...
The EqPly application instance.
Definition: eqPly.h:46
EQ_API bool exit()
De-initialize the Equalizer client library.
The configuration, run be the EqPly application.
virtual eq::Node * createNode(eq::Config *parent)
Create a new node.
Definition: eqPly/main.cpp:51
virtual eq::Pipe * createPipe(eq::Node *parent)
Create a new pipe.
Definition: eqPly/main.cpp:53
The node factory is a per-node singleton used to create and release Equalizer resource instances...
Definition: nodeFactory.h:36
virtual eq::Config * createConfig(eq::ServerPtr parent)
Create a new config.
Definition: eqPly/main.cpp:49