Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
eqAsync/main.cpp
1 
2 /* Copyright (c) 2007-2014, 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  eq::exit();
57  return EXIT_FAILURE;
58  }
59 
60  // 2. get a configuration
61  bool error = false;
62  eq::Config* config = eq::getConfig( argc, argv );
63  if( config )
64  {
65  // 3. init config
66  if( config->init( co::uint128_t( )))
67  {
68  // 4. run main loop
69  eq::uint128_t spin;
70  while( config->isRunning( ))
71  {
72  config->startFrame( ++spin );
73  config->finishFrame();
74  }
75 
76  // 5. exit config
77  config->exit();
78  }
79  else
80  error = true;
81 
82  // 6. release config
83  eq::releaseConfig( config );
84  }
85  else
86  {
87  LBERROR << "Cannot get config" << std::endl;
88  error = true;
89  }
90 
91  // 7. exit
92  eq::exit();
93  return error ? EXIT_FAILURE : EXIT_SUCCESS;
94 }
virtual EQ_API bool init(const uint128_t &initID)
Initialize this configuration.
A channel represents a two-dimensional viewport within a Window.
EQ_API bool isRunning() const
A configuration is a visualization session driven by an application.
virtual EQ_API uint32_t finishFrame()
Finish the rendering of a frame.
EQ_API void releaseConfig(Config *config)
Convenience function to release a configuration.
virtual EQ_API bool exit()
Exit this configuration.
A Pipe represents a graphics card (GPU) on a Node.
A Node represents a single computer in the cluster.
virtual EQ_API uint32_t startFrame(const uint128_t &frameID)
Request a new frame of rendering.
EQ_API Config * getConfig(const int argc, char **argv)
Convenience function to retrieve a configuration.
A Window represents an on-screen or off-screen drawable.
virtual eq::Channel * createChannel(eq::Window *parent)
Create a new channel.
virtual eq::Window * createWindow(eq::Pipe *parent)
Create a new window.
bool init(const int argc, char **argv, NodeFactory *nodeFactory)
Initialize the Equalizer client library.
Definition: client/init.h:58
EQ_API bool exit()
De-initialize the Equalizer client library.
virtual eq::Pipe * createPipe(eq::Node *parent)
Create a new pipe.
The node factory is a per-node singleton used to create and release Equalizer resource instances...
Definition: nodeFactory.h:36