00001
00002
00003
00004
00005 #ifndef BALL_VIEW_RENDERING_RENDERINGWINDOW_H
00006 #define BALL_VIEW_RENDERING_RENDERINGWINDOW_H
00007
00008 #include <BALL/COMMON/global.h>
00009 #include <BALL/VIEW/RENDERING/renderTarget.h>
00010
00011 #include <boost/static_assert.hpp>
00012 #include <boost/type_traits/is_same.hpp>
00013
00015 #define BALLVIEW_IS_SAME_TYPE(aTypeA, aTypeB) (boost::is_same<aTypeA, aTypeB>::value)
00016
00018 #define BALLVIEW_STATIC_ASSERT_TYPE_IS_INT_OR_FLOAT(aType) \
00019 BOOST_STATIC_ASSERT(BALLVIEW_IS_SAME_TYPE(aType, int) || BALLVIEW_IS_SAME_TYPE(aType, float))
00020
00021 namespace BALL
00022 {
00023 namespace VIEW
00024 {
00030 template<typename taPixelDatatype>
00031 class BALL_VIEW_EXPORT RenderWindow : public RenderTarget
00032 {
00033
00034 BALLVIEW_STATIC_ASSERT_TYPE_IS_INT_OR_FLOAT(taPixelDatatype);
00035
00036
00037 typedef boost::shared_array<taPixelDatatype> t_PixelPtr;
00038
00039 public:
00040
00041 RenderWindow();
00042
00043 virtual ~RenderWindow();
00044
00045
00046
00047
00048 virtual bool init();
00049
00056 virtual bool resize(const unsigned int width, const unsigned int height);
00057
00066 virtual void refresh();
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 virtual FrameBufferPtr getBuffer() throw(BALL::Exception::NoBufferAvailable);
00079
00080
00081
00082
00083 virtual FrameBufferFormat getFormat() const;
00084
00085
00086
00087
00088 virtual void releaseBuffer(FrameBufferPtr buffer);
00089
00090
00091
00092 virtual void prepareRendering() {};
00093
00094 protected:
00095 t_PixelPtr m_pixels;
00096 FrameBufferPtr m_framebuffer;
00097 FrameBufferFormat m_fmt;
00098 const PixelFormat m_pfm;
00099 bool m_bufferLocked;
00100 const unsigned int m_minimalWidth;
00101 const unsigned int m_minimalHeight;
00102 };
00103
00104 typedef RenderWindow<float> t_RenderWindow;
00105
00106 }
00107
00108 }
00109
00110 #endif // BALL_VIEW_RENDERING_RENDERINGWINDOW_H