Framebuffer.hpp
1// Copyright 2019 Arthur Sonzogni. All rights reserved.
2// Use of this source code is governed by the MIT license that can be found in
3// the LICENSE file.
4
5#ifndef SMK_FRAMEBUFFER_HPP
6#define SMK_FRAMEBUFFER_HPP
7
8#include <iostream>
9#include <smk/OpenGL.hpp>
10#include <smk/RenderTarget.hpp>
11#include <smk/Texture.hpp>
12
13namespace smk {
14
15/// @example framebuffer.cpp
16
17/// An off-screen drawable area. You can also draw it later in a smk::Sprite.
18class Framebuffer : public RenderTarget {
19 public:
20 explicit Framebuffer(int width, int height);
21 Framebuffer(std::vector<Texture> color_textures);
23
24 // Move only ressource.
25 Framebuffer(Framebuffer&&) noexcept;
26 Framebuffer(const Framebuffer&) = delete;
27 Framebuffer& operator=(Framebuffer&&) noexcept;
28 void operator=(const Framebuffer&) = delete;
29
30 smk::Texture& color_texture();
31
32 private:
33 void Init();
34 GLuint render_buffer_ = 0;
35 std::vector<smk::Texture> color_textures_;
36};
37
38} // namespace smk
39
40#endif /* end of include guard: SMK_FRAMEBUFFER_HPP */
An off-screen drawable area. You can also draw it later in a smk::Sprite.
Definition: Framebuffer.hpp:18
Framebuffer(int width, int height)
Construct a Framebuffer of a given dimensions.
Definition: Framebuffer.cpp:15
int height() const
the height of the surface.
int width() const
the width of the surface.