.. index:: pair: class; EE::Graphics::FrameBuffer .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer: class EE::Graphics::FrameBuffer =============================== .. toctree:: :hidden: Overview ~~~~~~~~ A frame buffer allows rendering to a off-sreen 2D texture :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class FrameBuffer { public: // construction virtual :target:`~FrameBuffer`(); // methods static FrameBuffer* :ref:`New`( const :ref:`Uint32`& Width, const :ref:`Uint32`& Height, bool StencilBuffer = true, bool DepthBuffer = false, bool useColorBuffer = false, const :ref:`Uint32`& channels = 4, :ref:`EE::Window::Window`* window = NULL ); virtual void :ref:`bind`() = 0; virtual void :ref:`unbind`() = 0; virtual void :ref:`draw`(const :ref:`Vector2f`& position, const :ref:`Sizef`& size) = 0; virtual void :ref:`draw`(:ref:`Rect` src, :ref:`Rect` dst) = 0; void :ref:`clear`(); virtual void :ref:`reload`() = 0; virtual void :ref:`resize`(const :ref:`Uint32`& Width, const :ref:`Uint32`& Height) = 0; virtual const :ref:`Int32`& :ref:`getFrameBufferId`() const = 0; :ref:`Texture`* :ref:`getTexture`() const; void :ref:`setClearColor`(const :ref:`ColorAf`& color); :ref:`ColorAf` :ref:`getClearColor`() const; const :ref:`Int32`& :ref:`getWidth`() const; const :ref:`Int32`& :ref:`getHeight`() const; const :ref:`Sizei`& :ref:`getSize`() const; const :ref:`Sizef` :ref:`getSizef`(); const bool& :ref:`hasColorBuffer`() const; const bool& :ref:`hasDepthBuffer`() const; const bool& :ref:`hasStencilBuffer`() const; const std::string& :ref:`getName`() const; void :ref:`setName`(const std::string& name); const :ref:`String::HashType`& :ref:`getId`() const; virtual bool :ref:`created`() const = 0; }; .. _details-class_e_e_1_1_graphics_1_1_frame_buffer: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ A frame buffer allows rendering to a off-sreen 2D texture Methods ------- .. index:: pair: function; New .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a6173e0443eec3837b7da6922a1bee356: .. ref-code-block:: cpp :class: doxyrest-title-code-block static FrameBuffer* New( const :ref:`Uint32`& Width, const :ref:`Uint32`& Height, bool StencilBuffer = true, bool DepthBuffer = false, bool useColorBuffer = false, const :ref:`Uint32`& channels = 4, :ref:`EE::Window::Window`* window = NULL ) Creates a new instance of a frame buffer. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - Width - The frame buffer width * - Height - The frame buffer height * - StencilBuffer - Indicates if a stencil buffer is used * - DepthBuffer - Indicates if a depth buffer is used * - useColorBuffer - Indicates if the frame buffer uses a color attachment render buffer ( instead of a texture ) \* * - channels - Number of channels of the frame buffer to create * - window - In case that the application is using more than one window, the user can indicate which one to use ( by default uses the current active window ) .. index:: pair: function; bind .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a7c749f5bc096d49e680f85ccef922230: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void bind() = 0 Enables the off-screen rendering. From this moment any rendered primitive will be rendered to the frame buffer. Anything rendered since the frame buffer is binded will use the fram buffer coordinates, so position 0,0 means 0,0 point in the frame buffer, not the screen. .. index:: pair: function; unbind .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a5805b13508d221f1dcab48d476f23d27: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void unbind() = 0 Disables the off-screen rendering. Anything rendered after this will be rendered to the back-buffer. .. index:: pair: function; draw .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a3009ed15d4d0938427ad1d206dac261e: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void draw(const :ref:`Vector2f`& position, const :ref:`Sizef`& size) = 0 Draws the buffer to the screen .. index:: pair: function; draw .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a33ae653cd5c08c68018c34415bcc1673: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void draw(:ref:`Rect` src, :ref:`Rect` dst) = 0 Draws the buffer to the screen .. index:: pair: function; clear .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1ad79fc1c8ee222be209aff3063fafd206: .. ref-code-block:: cpp :class: doxyrest-title-code-block void clear() Clears the frame buffer pixels to the default frame buffer clear color. .. index:: pair: function; reload .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a6b5202a129cd24865946ee4cd5ed4880: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void reload() = 0 Recreates the frame buffer ( delete the current and creates a new one ). This is needed by the engine to recover any context lost. .. index:: pair: function; resize .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a8dd7f317fc8d46b46bf243ed47ea63f6: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual void resize(const :ref:`Uint32`& Width, const :ref:`Uint32`& Height) = 0 Resizes the current Frame Buffer. .. index:: pair: function; getFrameBufferId .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1af5d312d913e3455682e223c75f12514f: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual const :ref:`Int32`& getFrameBufferId() const = 0 .. rubric:: Returns: The allocated Frame Buffer internal Id ( OpenGL FBO id ) .. index:: pair: function; getTexture .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a3d6036733130e6e913018a4dcbde2be3: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Texture`* getTexture() const .. rubric:: Returns: The frame buffer texture. Everything is rendered to this texture. To render the frame buffer you just need to draw the texture as any other texture. The frame buffer must be unbinded before any rendering is done outside the frame buffer. For example MyFrameBufferPtr-> :ref:`getTexture() ` ->Draw(0,0); .. index:: pair: function; setClearColor .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1af2387e2746a449b873ff233317565639: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setClearColor(const :ref:`ColorAf`& color) Sets the frame buffer clear color. .. index:: pair: function; getClearColor .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1aa89a96f8f81c00e20436b7eec4e320d6: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`ColorAf` getClearColor() const .. rubric:: Returns: The clear color used for the frame buffer. .. index:: pair: function; getWidth .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a51e0337bec3697c511d88607f702b464: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Int32`& getWidth() const .. rubric:: Returns: The frame buffer width. .. index:: pair: function; getHeight .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1ac6861370a6dfc14fed615def20cabed8: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Int32`& getHeight() const .. rubric:: Returns: The frame buffer height. .. index:: pair: function; getSize .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a82366a3bef0ba83f9fbaefb81a3a31c7: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Sizei`& getSize() const .. rubric:: Returns: The frame buffer size. .. index:: pair: function; getSizef .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a78068b775e8c756769ea27a54d5c58cd: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Sizef` getSizef() .. rubric:: Returns: The frame buffer size ( float ). .. index:: pair: function; hasColorBuffer .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a497ad7e427038f830bcc044e25b5adb5: .. ref-code-block:: cpp :class: doxyrest-title-code-block const bool& hasColorBuffer() const .. rubric:: Returns: True if the frame buffer has a color buffer. .. index:: pair: function; hasDepthBuffer .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a460220cb4028924f5365688a1bb100e5: .. ref-code-block:: cpp :class: doxyrest-title-code-block const bool& hasDepthBuffer() const .. rubric:: Returns: True if the frame buffer has a depth buffer. .. index:: pair: function; hasStencilBuffer .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a120e629af7e6eb3eede6fad587c0e674: .. ref-code-block:: cpp :class: doxyrest-title-code-block const bool& hasStencilBuffer() const .. rubric:: Returns: True if the frame buffer has a stencil buffer .. index:: pair: function; getName .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a32b6597bf058f971605d51770ae4e858: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::string& getName() const .. rubric:: Returns: The frame buffer name. .. index:: pair: function; setName .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a128682ed437b17845855f230b6beec43: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setName(const std::string& name) Set a name to the frame buffer .. index:: pair: function; getId .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1acfe61d1b78d8d0757008b8070257f243: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`String::HashType`& getId() const .. rubric:: Returns: The hash id from its name .. index:: pair: function; created .. _doxid-class_e_e_1_1_graphics_1_1_frame_buffer_1a4f93a802b963ef679d845785ff13e24b: .. ref-code-block:: cpp :class: doxyrest-title-code-block virtual bool created() const = 0 .. rubric:: Returns: If the frame buffer was created