GlistEngine
Loading...
Searching...
No Matches
gFbo.h
Go to the documentation of this file.
1/*
2 * gFbo.h
3 *
4 * Created on: 23 Feb 2021
5 * Author: Noyan
6 */
7
8#ifndef GRAPHICS_GFBO_H_
9#define GRAPHICS_GFBO_H_
10
11#include "gRenderObject.h"
12#include "gTexture.h"
13
14
15class gFbo : public gRenderObject {
16public:
18 virtual ~gFbo();
19
20 void allocate(int width, int height, bool isDepthMap = false, bool useDepthTexture = false);
21 unsigned int getId() const;
22 int getWidth() const;
23 int getHeight() const;
24 unsigned int getTextureId() const;
25 unsigned int getDepthTextureId() const;
27
28 void bind();
29 void unbind();
30
31 void draw(int x, int y);
32 void draw(int x, int y, int w, int h);
33 void draw(int x, int y, int w, int h, float rotate);
34 void draw(glm::vec2 position, glm::vec2 size, float rotate = 0.0f);
35
36 void drawSub(int x, int y, int sx, int sy, int sw, int sh);
37 void drawSub(int x, int y, int w, int h, int sx, int sy, int sw, int sh);
38 void drawSub(int x, int y, int w, int h, int sx, int sy, int sw, int sh, float rotate);
39 void drawSub(glm::vec2 pos, glm::vec2 size, glm::vec2 subpos, glm::vec2 subsize, float rotate = 0.0f);
40 void drawSub(const gRect& src, const gRect& dst, float rotate = 0.f);
41
42 void allocateMipChain(int width, int height, int miplevels);
43 void bindMip(int level);
44
45 static int defaultfbo;
46
47private:
48 unsigned int framebuffer;
49 unsigned int rbo;
50 int miplevels = 1;
51 gTexture* texture;
52 gTexture* depthtexture;
53 int width, height;
54 bool isdepthmap;
55 bool usedepthtexture;
56 bool isallocated;
57
58};
59
60#endif /* GRAPHICS_GFBO_H_ */
unsigned int getDepthTextureId() const
unsigned int getId() const
void draw(int x, int y, int w, int h, float rotate)
void allocateMipChain(int width, int height, int miplevels)
void bind()
int getWidth() const
unsigned int getTextureId() const
void bindMip(int level)
void allocate(int width, int height, bool isDepthMap=false, bool useDepthTexture=false)
void drawSub(int x, int y, int sx, int sy, int sw, int sh)
void draw(glm::vec2 position, glm::vec2 size, float rotate=0.0f)
void drawSub(int x, int y, int w, int h, int sx, int sy, int sw, int sh, float rotate)
void drawSub(const gRect &src, const gRect &dst, float rotate=0.f)
static int defaultfbo
Definition gFbo.h:45
void draw(int x, int y, int w, int h)
void unbind()
void draw(int x, int y)
virtual ~gFbo()
void drawSub(glm::vec2 pos, glm::vec2 size, glm::vec2 subpos, glm::vec2 subsize, float rotate=0.0f)
gTexture & getTexture()
void drawSub(int x, int y, int w, int h, int sx, int sy, int sw, int sh)
int getHeight() const
Definition gRect.h:27
Definition gTexture.h:17