YourGameLib
Loading...
Searching...
No Matches
framebuffer.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019-2024 Alexander Scholz
3
4This software is provided 'as-is', without any express or implied
5warranty. In no event will the authors be held liable for any damages
6arising from the use of this software.
7
8Permission is granted to anyone to use this software for any purpose,
9including commercial applications, and to alter it and redistribute it
10freely, subject to the following restrictions:
11
121. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
162. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
183. This notice may not be removed or altered from any source distribution.
19*/
20#ifndef YOURGAME_GLFRAMEBUFFER_H
21#define YOURGAME_GLFRAMEBUFFER_H
22
23#include <vector>
24#include "yourgame/gl_include.h"
25#include "yourgame/gl/texture.h"
26
27namespace yourgame
28{
29 namespace gl
30 {
32 {
33 public:
35 {
37 GLenum format;
38 GLenum type;
39 GLenum unit;
40 std::vector<std::pair<GLenum, GLint>> parameteri;
41 GLenum attachment;
42 };
43
44 static Framebuffer *make(GLsizei width,
45 GLsizei height,
46 std::vector<TextureAttachDescr> texAttachDescrs);
48 void bind();
49 void unbindTarget();
50 void resize(GLsizei width, GLsizei height);
52
53 /* deleting the copy constructor and the copy assignment operator
54 prevents copying (and moving) of the object. */
55 Framebuffer(Framebuffer const &) = delete;
56 Framebuffer &operator=(Framebuffer const &) = delete;
57
58 private:
59 Framebuffer() {}
60 GLuint m_handle;
61 std::vector<yourgame::gl::Texture *> m_textureAttachments;
62 std::vector<TextureAttachDescr> m_texAttachDescrs;
63 };
64 } // namespace gl
65} // namespace yourgame
66
67#endif
Definition framebuffer.h:32
static Framebuffer * make(GLsizei width, GLsizei height, std::vector< TextureAttachDescr > texAttachDescrs)
Definition framebuffer.cpp:26
yourgame::gl::Texture * textureAttachment(int idx)
Definition framebuffer.cpp:103
void resize(GLsizei width, GLsizei height)
Definition framebuffer.cpp:86
void bind()
Definition framebuffer.cpp:76
Framebuffer & operator=(Framebuffer const &)=delete
~Framebuffer()
Definition framebuffer.cpp:67
void unbindTarget()
Definition framebuffer.cpp:81
Framebuffer(Framebuffer const &)=delete
Definition texture.h:69
Definition audio.h:27
GLenum format
Definition framebuffer.h:37
std::vector< std::pair< GLenum, GLint > > parameteri
Definition framebuffer.h:40
GLenum unit
Definition framebuffer.h:39
GLenum type
Definition framebuffer.h:38
GLint internalformat
Definition framebuffer.h:36
GLenum attachment
Definition framebuffer.h:41