00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_GFX_OFFSCREEN_BUFFER_HH 00020 #define OST_GFX_OFFSCREEN_BUFFER_HH 00021 00022 /* 00023 Wraps GL offscreen rendering per platform 00024 00025 boilerplate header, includes platform dependent stuff 00026 */ 00027 00028 #include <vector> 00029 00030 namespace ost { namespace gfx { 00031 00032 class OffscreenBufferFormat 00033 { 00034 public: 00035 OffscreenBufferFormat(): cbits(8),abits(8),dbits(12),accum(false),multisample(false),samples(0) {} 00036 00037 unsigned int cbits,abits,dbits; // color, alpha, depth bits 00038 bool accum; 00039 bool multisample; 00040 unsigned int samples; 00041 }; 00042 00043 }} // ns 00044 00045 /* 00046 instead of creating an abstract base class and 00047 making runtime polymorphic classes for each 00048 platform, we do a bit more typing and copy 00049 the minimal interface to each of the platform 00050 specific OffscreenBuffer implementations 00051 00052 OffscreenBuffer interface: 00053 00054 OffscreenBuffer(unsigned int width, unsigned int height, const OffscreenBufferFormat& f, bool shared=true); 00055 bool Resize(unsigned int w, unsigned int h); 00056 bool MakeActive(); 00057 bool IsActive(); 00058 bool IsValid(); 00059 */ 00060 00061 #if defined(__linux__) 00062 #if OST_MESA_SUPPORT_ENABLED 00063 #include "impl/mesa_offscreen_buffer.hh" 00064 #else 00065 #include "impl/glx_offscreen_buffer.hh" 00066 #endif 00067 #elif defined(__APPLE__) 00068 #include "impl/cgl_offscreen_buffer.hh" 00069 #elif defined(_MSC_VER) 00070 #include "impl/wgl_offscreen_buffer.hh" 00071 #else 00072 #error platform not found for offscreen rendering 00073 #endif 00074 00075 #ifdef Complex 00076 # undef Complex 00077 #endif 00078 00079 #endif