OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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_OFFSCREEN_BUFFER_HH
20 #define OST_GFX_OFFSCREEN_BUFFER_HH
21 
22 /*
23  Wraps GL offscreen rendering per platform
24 
25  boilerplate header, includes platform dependent stuff
26 */
27 
28 #include <vector>
29 
30 namespace ost { namespace gfx {
31 
33 {
34 public:
35  OffscreenBufferFormat(): cbits(8),abits(8),dbits(12),accum(false),multisample(false),samples(0) {}
36 
37  unsigned int cbits,abits,dbits; // color, alpha, depth bits
38  bool accum;
40  unsigned int samples;
41 };
42 
43 }} // ns
44 
45 /*
46  instead of creating an abstract base class and
47  making runtime polymorphic classes for each
48  platform, we do a bit more typing and copy
49  the minimal interface to each of the platform
50  specific OffscreenBuffer implementations
51 
52  OffscreenBuffer interface:
53 
54  OffscreenBuffer(unsigned int width, unsigned int height, const OffscreenBufferFormat& f, bool shared=true);
55  bool Resize(unsigned int w, unsigned int h);
56  bool MakeActive();
57  bool IsActive();
58  bool IsValid();
59 */
60 
61 #if defined(__linux__)
62 #if OST_MESA_SUPPORT_ENABLED
63 #include "impl/mesa_offscreen_buffer.hh"
64 #else
66 #endif
67 #elif defined(__APPLE__)
68 #include "impl/cgl_offscreen_buffer.hh"
69 #elif defined(_MSC_VER)
70 #include "impl/wgl_offscreen_buffer.hh"
71 #else
72 #error platform not found for offscreen rendering
73 #endif
74 
75 #ifdef Complex
76 # undef Complex
77 #endif
78 
79 #endif