Equalizer  1.6.1
eqAsync/main.cpp
1 
2 /* Copyright (c) 2007-2013, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2010-2011, Maxim Makhinya <maxmah@gmail.com>
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * - Redistributions of source code must retain the above copyright notice, this
9  * list of conditions and the following disclaimer.
10  * - Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * - Neither the name of Eyescale Software GmbH nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  */
30 
31 #include "eqAsync.h"
32 
33 #include <stdlib.h>
34 
36 {
37 public:
38  virtual eq::Pipe* createPipe( eq::Node* parent )
39  { return new eqAsync::Pipe( parent ); }
40 
41  virtual eq::Window* createWindow( eq::Pipe* parent )
42  { return new eqAsync::Window( parent ); }
43 
44  virtual eq::Channel* createChannel( eq::Window* parent )
45  { return new eqAsync::Channel( parent ); }
46 };
47 
48 
49 int main( const int argc, char** argv )
50 {
51  // 1. Equalizer initialization
52  NodeFactory nodeFactory;
53  if( !eq::init( argc, argv, &nodeFactory ))
54  {
55  LBERROR << "Equalizer init failed" << std::endl;
56  return EXIT_FAILURE;
57  }
58 
59  // 2. get a configuration
60  bool error = false;
61  eq::Config* config = eq::getConfig( argc, argv );
62  if( config )
63  {
64  // 3. init config
65  if( config->init( eq::uint128_t( 0 )))
66  {
67  if( config->getError( ))
68  LBWARN << "Error during initialization: " << config->getError()
69  << std::endl;
70 
71  // 4. run main loop
72  eq::uint128_t spin( 0 );
73  while( config->isRunning( ))
74  {
75  config->startFrame( ++spin );
76  config->finishFrame();
77  }
78 
79  // 5. exit config
80  config->exit();
81  }
82  else
83  error = true;
84 
85  // 6. release config
86  eq::releaseConfig( config );
87  }
88  else
89  {
90  LBERROR << "Cannot get config" << std::endl;
91  error = true;
92  }
93 
94  // 7. exit
95  eq::exit();
96  return error ? EXIT_FAILURE : EXIT_SUCCESS;
97 }
virtual eq::Window * createWindow(eq::Pipe *parent)
Create a new window.
A configuration is a visualization session driven by an application.
A channel represents a two-dimensional viewport within a Window.
eq::fabric::Error getError() const
Definition: object.h:82
virtual bool init(const uint128_t &initID)
Initialize this configuration.
A Window represents an on-screen or off-screen drawable.
virtual eq::Pipe * createPipe(eq::Node *parent)
Create a new pipe.
A Node represents a single computer in the cluster.
A Pipe represents a graphics card (GPU) on a Node.
virtual uint32_t startFrame(const uint128_t &frameID)
Request a new frame of rendering.
The node factory is a per-node singleton used to create and release Equalizer resource instances...
Definition: nodeFactory.h:36
virtual uint32_t finishFrame()
Finish the rendering of a frame.
Config * getConfig(const int argc, char **argv)
Convenience function to retrieve a configuration.
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.
virtual bool exit()
Exit this configuration.
bool isRunning() const
void releaseConfig(Config *config)
Convenience function to release a configuration.
virtual eq::Channel * createChannel(eq::Window *parent)
Create a new channel.