1 #ifndef INCLUDE_AL_GRAPHICS_FBO_HPP
2 #define INCLUDE_AL_GRAPHICS_FBO_HPP
47 #include "al/graphics/al_GPUObject.hpp"
48 #include "al/graphics/al_OpenGL.hpp"
49 #include "al/graphics/al_Texture.hpp"
107 bool resize(
unsigned width,
unsigned height);
109 void create(
unsigned int width,
unsigned int height,
110 unsigned int format = GL_DEPTH_COMPONENT16) {
118 static void bind(
unsigned id);
119 static bool resize(
unsigned int format,
unsigned width,
unsigned height);
122 unsigned int mFormat;
154 COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0,
155 COLOR_ATTACHMENT1 = GL_COLOR_ATTACHMENT1,
156 COLOR_ATTACHMENT2 = GL_COLOR_ATTACHMENT2,
157 COLOR_ATTACHMENT3 = GL_COLOR_ATTACHMENT3,
158 DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT,
159 STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT,
160 DEPTH_STENCIL_ATTACHMENT = GL_DEPTH_STENCIL_ATTACHMENT
177 unsigned int attach = GL_COLOR_ATTACHMENT0,
183 FBO &attachCubemapFace(
Texture const &tex,
unsigned int target_face,
184 unsigned int attachment = GL_COLOR_ATTACHMENT0,
187 FBO &detachCubemapFace(
unsigned int target_face,
unsigned int attachment,
196 void begin() {
bind(); }
201 const char *statusString();
202 const char *statusString(GLenum stat);
204 static void bind(
unsigned fboID);
205 static void renderBuffer(
unsigned rboID,
unsigned int attachment);
206 static void texture2D(
unsigned texID,
207 unsigned int attachment = GL_COLOR_ATTACHMENT0,
209 static void textureCubemapFace(
unsigned int texID,
unsigned int target_face,
210 unsigned int attachment = GL_COLOR_ATTACHMENT0,
218 static unsigned int const DEFAULT{0};
Frame buffer object class.
FBO & detachTexture2D(unsigned int attachment, int level=0)
Detach texture at a specified attachment point and mipmap level.
virtual void onCreate()
Called when currently assigned context is created.
virtual void onDestroy()
Called when currently assigned context is destroyed.
FBO & attachTexture2D(Texture const &tex, unsigned int attach=GL_COLOR_ATTACHMENT0, int level=0)
Attach a texture.
FBO & attachRBO(const RBO &rbo, unsigned int attachment=GL_DEPTH_ATTACHMENT)
Attach RBO at specified attachment point.
GLenum status()
Get status of frame buffer object.
FBO & detachRBO(unsigned int attachment)
Detach RBO at specified attachment point.
void bind()
Bind object (start rendering to attached objects)
void unbind()
Unbind object.
Attachment
Attachment type.
void destroy()
Destroys object on GPU.
void create()
Creates object on GPU.
Render buffer object class.
RBO(unsigned int format=GL_DEPTH_COMPONENT16)
unsigned int format() const
Get internal pixel format.
RBO & format(unsigned int v)
Set internal pixel format.
virtual void onCreate()
Called when currently assigned context is created.
bool resize(unsigned width, unsigned height)
Set dimensions, in pixels.
virtual void onDestroy()
Called when currently assigned context is destroyed.
void unbind()
Unbind object.
static unsigned maxSize()
Get maximum buffer size.