OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
glx_offscreen_buffer.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GFX_GLX_OFFSCREEN_BUFFER_HH
20 #define OST_GFX_GLX_OFFSCREEN_BUFFER_HH
21 
22 #include <stack>
23 #include <ost/gfx/glext_include.hh>
24 #include <GL/glx.h>
25 
26 namespace ost { namespace gfx {
27 
28 /*
29  glx implementation for offscreen buffers
30 
31  Author: Ansgar Philippsen
32 */
33 
35 {
36 public:
37  OffscreenBuffer(unsigned int width, unsigned int height, const OffscreenBufferFormat& f, bool shared=true);
39 
40  bool Resize(unsigned int w, unsigned int h);
41 
42  bool MakeActive();
43 
44  bool IsActive() {return active_;}
45 
46  bool IsValid() {return valid_;}
47 
48 private:
49  int width_;
50  int height_;
51  bool valid_;
52  bool active_;
53 
54  Display* dpy_;
55  GLXFBConfig* fbconfig_;
56  GLXPbuffer pbuffer_;
57  GLXContext context_;
58 };
59 
60 }} // ns
61 
62 #endif