Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
vertexBufferState.h
1 
2 /* Copyright (c) 2009-2013, Stefan Eilemann <eile@equalizergraphics.com>
3  * 2007, Tobias Wolf <twolf@access.unizh.ch>
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 #ifndef EQPLY_VERTEXBUFFERSTATE_H
31 #define EQPLY_VERTEXBUFFERSTATE_H
32 
33 #include "channel.h"
34 
35 #include <triply/vertexBufferState.h>
36 #include <eq/eq.h>
37 
38 namespace eqPly
39 {
40 /* State for Equalizer usage, uses Eq's Object Manager. */
41 class VertexBufferState : public triply::VertexBufferState
42 {
43 public:
45  : triply::VertexBufferState( objectManager.glewGetContext( ))
46  , _objectManager( objectManager )
47  , _channel( 0 )
48  {}
49 
50  virtual ~VertexBufferState() {};
51 
52  virtual GLuint getDisplayList( const void* key )
53  { return _objectManager.getList( key ); }
54 
55  virtual GLuint newDisplayList( const void* key )
56  { return _objectManager.newList( key ); }
57 
58  virtual GLuint getTexture( const void* key )
59  { return _objectManager.getTexture( key ); }
60 
61  virtual GLuint newTexture( const void* key )
62  { return _objectManager.newTexture( key ); }
63 
64  virtual GLuint getBufferObject( const void* key )
65  { return _objectManager.getBuffer( key ); }
66 
67  virtual GLuint newBufferObject( const void* key )
68  { return _objectManager.newBuffer( key ); }
69 
70  virtual GLuint getProgram( const void* key )
71  { return _objectManager.getProgram( key ); }
72 
73  virtual GLuint newProgram( const void* key )
74  { return _objectManager.newProgram( key ); }
75 
76  virtual GLuint getShader( const void* key )
77  { return _objectManager.getShader( key ); }
78 
79  virtual GLuint newShader( const void* key, GLenum type )
80  { return _objectManager.newShader( key, type ); }
81 
82  virtual void deleteAll() { _objectManager.deleteAll(); }
83  bool isShared() const { return _objectManager.isShared(); }
84 
85  void setChannel( Channel* channel ) { _channel = channel; }
86 
87  virtual bool stopRendering( ) const
88  { return _channel ? _channel->stopRendering() : false; }
89 
90  virtual void declareRegion( const triply::Vector4f& region )
91  { if( _channel ) _channel->declareRegion( eq::Viewport( region )); }
92 
93 private:
94  eq::util::ObjectManager& _objectManager;
95  Channel* _channel;
96 };
97 } // namespace eqPly
98 
99 #endif // EQ_MESH_VERTEXBUFFERSTATE_H
The rendering entity, updating a part of a Window.
A facility class to manage OpenGL objects across shared contexts.
Definition: objectManager.h:51
EQ_API bool isShared() const
EQ_API void deleteAll()
Delete all managed objects and associated GL objects.
virtual EQ_API void declareRegion(const eq::PixelViewport &region)
Declare a region covered by the current draw or assemble operation.