Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
eqAsync.h
1 
2 /* Copyright (c) 2009-2011, Maxim Makhinya <maxmah@gmail.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 #ifndef EQASYNC_ASYNC_H
31 #define EQASYNC_ASYNC_H
32 
33 #include "asyncFetcher.h"
34 
35 #include <eq/eq.h>
36 
37 namespace eqAsync
38 {
39 
40 /* Simple Channel class */
41 class Channel : public eq::Channel
42 {
43 public:
44  Channel( eq::Window* parent ) : eq::Channel( parent ) {}
45 
46 protected:
47  virtual void frameDraw( const eq::uint128_t& spin );
48 };
49 
50 
51 /* Simple Window class that will call init of the pipe to create a shared
52  context */
53 class Window : public eq::Window
54 {
55 public:
56  Window( eq::Pipe* parent ) : eq::Window( parent ) {}
57  bool configInitGL( const eq::uint128_t& initID );
58 };
59 
60 
61 /* Simple Pipe class that creates a shared window for async fetching */
62 class Pipe : public eq::Pipe
63 {
64 public:
65  Pipe( eq::Node* parent )
66  : eq::Pipe( parent ), _initialized( false ), _txId( 0 ) {}
67 
68  void startAsyncFetcher( Window* wnd );
69  AsyncFetcher& getAsyncFetcher() { return _asyncFetcher; }
70  GLuint getTextureId() const { return _txId.id; }
71 
72 protected:
73  /* checks if new textures are avaliable */
74  virtual void frameStart( const eq::uint128_t& frameID,
75  const uint32_t frameNumber );
76  virtual bool configExit();
77 
78 private:
79  bool _initialized;
80  AsyncFetcher _asyncFetcher;
81  TextureId _txId;
82 };
83 
84 }
85 
86 #endif // EQASYNC_ASYNC_H
A channel represents a two-dimensional viewport within a Window.
virtual void frameStart(const eq::uint128_t &frameID, const uint32_t frameNumber)
Start rendering a frame.
Definition: eqAsync.cpp:56
Asynchronous fetching thread.
Definition: asyncFetcher.h:56
A Pipe represents a graphics card (GPU) on a Node.
A Node represents a single computer in the cluster.
virtual bool configExit()
De-initialize this pipe.
Definition: eqAsync.cpp:70
A Window represents an on-screen or off-screen drawable.
virtual void frameDraw(const eq::uint128_t &spin)
Draw the scene.
Definition: eqAsync.cpp:76
Structure to associate OpenGL texture ids with an external key.
Definition: asyncFetcher.h:42
bool configInitGL(const eq::uint128_t &initID)
Initialize the OpenGL state for this window.
Definition: eqAsync.cpp:36