diff --git a/modules/gfx/src/impl/cgl_offscreen_buffer.cc b/modules/gfx/src/impl/cgl_offscreen_buffer.cc index 4afb5395633dfbb4a659ae7ea42c036bcf78f450..eb6ec1987305f0536638a96409b4278f3e1439c1 100644 --- a/modules/gfx/src/impl/cgl_offscreen_buffer.cc +++ b/modules/gfx/src/impl/cgl_offscreen_buffer.cc @@ -28,10 +28,10 @@ namespace ost { namespace gfx { -OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, const OffscreenBufferFormat& f, bool shared): +OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, + const OffscreenBufferFormat& f, bool shared): width_(width), height_(height), valid_(false), active_(false) { -#if 0 CGLPixelFormatAttribute attributes[]={ kCGLPFAPBuffer, kCGLPFAColorSize, CGLPixelFormatAttribute(f.cbits), @@ -48,10 +48,11 @@ OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, const } // if a context exists, share resources such as shader programs and display // lists. - - // TODO: honor if shared? - - err=CGLCreateContext(pix_format_, CGLGetCurrentContext(), &context_); + if (shared) { + err=CGLCreateContext(pix_format_, CGLGetCurrentContext(), &context_); + } else { + err=CGLCreateContext(pix_format, NULL, &context_); + } if(err) { LOGN_ERROR("error creating offscreen rendering context. " "CGLCreateContext failed" << CGLErrorString(err)); @@ -73,14 +74,11 @@ OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, const return; } - valid_=true; -#endif } -bool OffscreenBuffer::Resize(unsigned int w, unsigned int h) +bool OffscreenBuffer::Resize(unsigned int width, unsigned int height) { -#if 0 CGLPBufferObj new_pbuffer; CGLError err=CGLCreatePBuffer(width, height, GL_TEXTURE_RECTANGLE_EXT, GL_RGBA, 0, &new_pbuffer); @@ -106,14 +104,11 @@ bool OffscreenBuffer::Resize(unsigned int w, unsigned int h) width_=width; height_=height; -#else - return false; -#endif + return true; } bool OffscreenBuffer::MakeActive() { -#if 0 if(active_) return true; if (CGLError err=CGLSetCurrentContext(context_)) { @@ -122,10 +117,6 @@ bool OffscreenBuffer::MakeActive() return false; } return true; -#else - return false; -#endif - } }} // ns diff --git a/modules/gfx/src/impl/cgl_offscreen_buffer.hh b/modules/gfx/src/impl/cgl_offscreen_buffer.hh index 1545e68a4c8996ff1f4404a952a8cc947c153e93..a9a673fb1085c74d379d3b611132cdd1dc261813 100644 --- a/modules/gfx/src/impl/cgl_offscreen_buffer.hh +++ b/modules/gfx/src/impl/cgl_offscreen_buffer.hh @@ -29,10 +29,11 @@ namespace ost { namespace gfx { Author: Marco Biasini */ -class CGLOffscreenBuffer +class OffscreenBuffer { public: - CGLOffscreenBuffer(unsigned int width, unsigned int height, const OffscreenBufferFormat& f, bool shared=true); + OffscreenBuffer(unsigned int width, unsigned int height, + const OffscreenBufferFormat& f, bool shared=true); bool Resize(unsigned int w, unsigned int h); diff --git a/modules/gfx/src/impl/wgl_offscreen_buffer.cc b/modules/gfx/src/impl/wgl_offscreen_buffer.cc index 6c268fb144440830319d858f368b80a02097e286..135e5c3ee70a383b5cbba1838b6456a4d9390242 100644 --- a/modules/gfx/src/impl/wgl_offscreen_buffer.cc +++ b/modules/gfx/src/impl/wgl_offscreen_buffer.cc @@ -21,12 +21,12 @@ namespace ost { namespace gfx { -WGLOffscreenBuffer::WGLOffscreenBuffer(unsigned int width, unsigned int height, const OffscreenBufferFormat& f, bool shared=true): +OffscreenBuffer::OffscreenBuffer(unsigned int width, unsigned int height, const OffscreenBufferFormat& f, bool shared=true): width_(width), height_(height), valid_(false), active_(false) {} -bool WGLOffscreenBuffer::Resize(unsigned int w, unsigned int h) {return false;} +bool OffscreenBuffer::Resize(unsigned int w, unsigned int h) {return false;} -bool WGLOffscreenBuffer::MakeActive() {return false;} +bool OffscreenBuffer::MakeActive() {return false;} }} // ns diff --git a/modules/gfx/src/impl/wgl_offscreen_buffer.hh b/modules/gfx/src/impl/wgl_offscreen_buffer.hh index 4a6efda5f1b30a1b4b1e9427bded6fcd4f8b2c8e..ae846a2ba3b354de3d7bed5ad2211d040e0ccc39 100644 --- a/modules/gfx/src/impl/wgl_offscreen_buffer.hh +++ b/modules/gfx/src/impl/wgl_offscreen_buffer.hh @@ -27,10 +27,11 @@ namespace ost { namespace gfx { wgl implementation for offscreen buffers */ -class WGLOffscreenBuffer: public OffscreenBuffer +class OffscreenBuffer { public: - WGLOffscreenBuffer(unsigned int width, unsigned int height, const OffscreenBufferFormat& f, bool shared=true); + OffscreenBuffer(unsigned int width, unsigned int height, + const OffscreenBufferFormat& f, bool shared=true); bool Resize(unsigned int w, unsigned int h);