BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_VIEW_RENDERING_GLOFFSCREENTARGET_H 00006 #define BALL_VIEW_RENDERING_GLOFFSCREENTARGET_H 00007 00008 #ifndef BALL_COMMON_GLOBAL_H 00009 # include <BALL/COMMON/global.h> 00010 #endif 00011 00012 #ifndef BALL_VIEW_RENDERING_RENDERWINDOW_H 00013 # include <BALL/VIEW/RENDERING/renderWindow.h> 00014 #endif 00015 00016 #ifndef BALL_VIEW_RENDERING_GLRENDERWINDOW_H 00017 # include <BALL/VIEW/RENDERING/glRenderWindow.h> 00018 #endif 00019 00020 00021 #include <QtGui/QPaintDevice> 00022 00023 #include <boost/shared_ptr.hpp> 00024 00025 class QGLPixelBuffer; 00026 00027 namespace BALL 00028 { 00029 namespace VIEW 00030 { 00036 class BALL_VIEW_EXPORT GLOffscreenTarget 00037 : public t_RenderWindow, 00038 public QPaintDevice 00039 { 00040 public: 00043 GLOffscreenTarget(GLRenderWindow* share_from, const String& filename); 00044 00045 virtual void prepareRendering(); 00046 virtual void prepareUpscaling(Size final_width, Size final_height); 00047 00048 virtual bool resize(const unsigned int width, const unsigned int height); 00049 virtual void refresh(); 00050 00051 void tryUsePixelBuffer(bool use_pbo = true); 00052 00053 QImage getImage(); 00054 void updateImageTile(Size x_lower, Size y_lower, Size x_upper, Size y_upper); 00055 00056 virtual QPaintEngine* paintEngine() const; 00057 virtual int metric(PaintDeviceMetric metric) const; 00058 00059 protected: 00060 String filename_; 00061 00062 GLRenderWindow* share_from_; 00063 00064 boost::shared_ptr<QGLPixelBuffer> pixel_buffer_; 00065 00066 bool use_pixel_buffer_; 00067 00068 QImage current_image_; 00069 }; 00070 00071 } 00072 } 00073 #endif // BALL_VIEW_RENDERING_GLOFFSCREENTARGET_H