Equalizer  1.12.0
Parallel Rendering Framework
compressorReadDrawPixels.h
1 
2 /* Copyright (c) 2010, Cedric Stalder <cedric.stalder@gmail.com>
3  * 2010-2014, Stefan Eilemann <eile@eyescale.ch>
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef EQ_PLUGIN_COMPRESSORREADDRAWPIXELS
20 #define EQ_PLUGIN_COMPRESSORREADDRAWPIXELS
21 
22 #include "compressor.h"
23 #include <eq/gl.h>
24 #include <eq/util/types.h>
25 
26 namespace eq
27 {
28 namespace plugin
29 {
30 
31 enum FlushMode
32 {
33  FLUSH_TEXTURE,
34  KEEP_TEXTURE
35 };
36 
38 {
39 public:
40  explicit CompressorReadDrawPixels( const unsigned name );
41  virtual ~CompressorReadDrawPixels();
42 
43  static void* getNewCompressor( const unsigned name )
44  { return new CompressorReadDrawPixels( name ); }
45 
46  static void* getNewDecompressor( const unsigned name )
47  { return new CompressorReadDrawPixels( name ); }
48 
49  void compress( const void* const, const eq_uint64_t, const bool ) override
50  { LBDONTCALL; }
51 
52  static bool isCompatible( const GLEWContext* );
53 
54  void download( const GLEWContext*, const eq_uint64_t*, const unsigned,
55  const eq_uint64_t, eq_uint64_t*, void** ) override;
56 
57  void upload( const GLEWContext*, const void*, const eq_uint64_t*,
58  const eq_uint64_t, const eq_uint64_t*,
59  const unsigned ) override;
60 
61  void startDownload( const GLEWContext*, const eq_uint64_t*, const unsigned,
62  const eq_uint64_t) override;
63 
64  void finishDownload( const GLEWContext*, const eq_uint64_t*,
65  const eq_uint64_t, eq_uint64_t*, void** ) override;
66 
67 protected:
68  lunchbox::Bufferb _buffer;
69  util::Texture* _texture;
71  unsigned _internalFormat;
72  unsigned _format;
73  unsigned _type;
74  const unsigned _depth;
75 
76  void _resizeBuffer( const eq_uint64_t );
77  void _initTexture( const GLEWContext*, const eq_uint64_t );
78  void _initAsyncTexture( const GLEWContext*, const eq_uint64_t,
79  const eq_uint64_t );
80  bool _initPBO( const GLEWContext*, const eq_uint64_t );
81  void _initDownload( const GLEWContext*, const eq_uint64_t*, eq_uint64_t* );
82  void* _downloadTexture( const GLEWContext* glewContext,
83  const FlushMode mode );
84 };
85 
86 }
87 }
88 #endif // EQ_PLUGIN_COMPRESSORREADDRAWPIXELS
A C++ class to abstract OpenGL pixel buffer objects.
A wrapper around OpenGL textures.
Definition: texture.h:38
const unsigned _depth
the size of one output token
The Equalizer client library.
Definition: eq/agl/types.h:23
Compression plugin provided with Equalizer.
Includes OpenGL and GLEW headers.
void compress(const void *const, const eq_uint64_t, const bool) override
Compress data.