@ -21,8 +21,6 @@
# include "AbstractFramebuffer.h"
# include "CubeMapTexture.h"
# include "Texture.h"
# include "Renderbuffer.h"
namespace Magnum {
@ -40,7 +38,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* Generates new OpenGL framebuffer .
* @ see @ fn_gl { GenFramebuffers }
*/
inline Framebuffer ( ) { glGenFramebuffers ( 1 , & _id ) ; }
Framebuffer ( const Vector2i & viewportPosition , const Vector2i & viewportSize ) ;
/**
* @ brief Destructor
@ -67,15 +65,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @ see mapForDraw ( ) , @ fn_gl { BindFramebuffer } , @ fn_gl { ReadBuffer }
* @ requires_gles30 % Extension @ es_extension2 { NV , read_buffer , GL_NV_read_buffer }
*/
inline void mapForRead ( std : : uint8_t colorAttachment ) {
bind ( Target : : Read ) ;
/** @todo Get some extension wrangler instead to avoid undeclared glReadBuffer() on ES2 */
# ifndef MAGNUM_TARGET_GLES2
glReadBuffer ( GL_COLOR_ATTACHMENT0 + colorAttachment ) ;
# else
static_cast < void > ( colorAttachment ) ;
# endif
}
void mapForRead ( std : : uint8_t colorAttachment ) ;
/**
* @ brief Attachment for depth / stencil part of fragment shader output
@ -107,10 +97,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
*
* @ see @ fn_gl { BindFramebuffer } , @ fn_gl { FramebufferRenderbuffer }
*/
inline void attachRenderbuffer ( Target target , DepthStencilAttachment depthStencilAttachment , Renderbuffer * renderbuffer ) {
bind ( target ) ;
glFramebufferRenderbuffer ( static_cast < GLenum > ( target ) , static_cast < GLenum > ( depthStencilAttachment ) , GL_RENDERBUFFER , renderbuffer - > id ( ) ) ;
}
void attachRenderbuffer ( Target target , DepthStencilAttachment depthStencilAttachment , Renderbuffer * renderbuffer ) ;
/**
* @ brief Attach renderbuffer to given framebuffer color attachment
@ -120,10 +107,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
*
* @ see @ fn_gl { BindFramebuffer } , @ fn_gl { FramebufferRenderbuffer }
*/
inline void attachRenderbuffer ( Target target , std : : uint8_t colorAttachment , Renderbuffer * renderbuffer ) {
bind ( target ) ;
glFramebufferRenderbuffer ( static_cast < GLenum > ( target ) , GL_COLOR_ATTACHMENT0 + colorAttachment , GL_RENDERBUFFER , renderbuffer - > id ( ) ) ;
}
void attachRenderbuffer ( Target target , std : : uint8_t colorAttachment , Renderbuffer * renderbuffer ) ;
# ifndef MAGNUM_TARGET_GLES
/**
@ -136,11 +120,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @ see @ fn_gl { BindFramebuffer } , @ fn_gl { FramebufferTexture }
* @ requires_gl Only 2 D and 3 D textures are available in OpenGL ES .
*/
inline void attachTexture1D ( Target target , DepthStencilAttachment depthStencilAttachment , Texture1D * texture , GLint mipLevel ) {
/** @todo Check for texture target compatibility */
bind ( target ) ;
glFramebufferTexture1D ( static_cast < GLenum > ( target ) , static_cast < GLenum > ( depthStencilAttachment ) , static_cast < GLenum > ( texture - > target ( ) ) , texture - > id ( ) , mipLevel ) ;
}
void attachTexture1D ( Target target , DepthStencilAttachment depthStencilAttachment , Texture1D * texture , GLint mipLevel ) ;
/**
* @ brief Attach 1 D texture to given framebuffer color attachment
@ -152,11 +132,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @ see @ fn_gl { BindFramebuffer } , @ fn_gl { FramebufferTexture }
* @ requires_gl Only 2 D and 3 D textures are available in OpenGL ES .
*/
inline void attachTexture1D ( Target target , std : : uint8_t colorAttachment , Texture1D * texture , GLint mipLevel ) {
/** @todo Check for texture target compatibility */
bind ( target ) ;
glFramebufferTexture1D ( static_cast < GLenum > ( target ) , GL_COLOR_ATTACHMENT0 + colorAttachment , static_cast < GLenum > ( texture - > target ( ) ) , texture - > id ( ) , mipLevel ) ;
}
void attachTexture1D ( Target target , std : : uint8_t colorAttachment , Texture1D * texture , GLint mipLevel ) ;
# endif
/**
@ -170,11 +146,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @ see attachCubeMapTexture ( ) , @ fn_gl { BindFramebuffer } ,
* @ fn_gl { FramebufferTexture }
*/
inline void attachTexture2D ( Target target , DepthStencilAttachment depthStencilAttachment , Texture2D * texture , GLint mipLevel ) {
/** @todo Check for texture target compatibility */
bind ( target ) ;
glFramebufferTexture2D ( static_cast < GLenum > ( target ) , static_cast < GLenum > ( depthStencilAttachment ) , static_cast < GLenum > ( texture - > target ( ) ) , texture - > id ( ) , mipLevel ) ;
}
void attachTexture2D ( Target target , DepthStencilAttachment depthStencilAttachment , Texture2D * texture , GLint mipLevel ) ;
/**
* @ brief Attach 2 D texture to given framebuffer color attachment
@ -187,11 +159,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @ see attachCubeMapTexture ( ) , @ fn_gl { BindFramebuffer } ,
* @ fn_gl { FramebufferTexture }
*/
inline void attachTexture2D ( Target target , std : : uint8_t colorAttachment , Texture2D * texture , GLint mipLevel ) {
/** @todo Check for texture target compatibility */
bind ( target ) ;
glFramebufferTexture2D ( static_cast < GLenum > ( target ) , GL_COLOR_ATTACHMENT0 + colorAttachment , static_cast < GLenum > ( texture - > target ( ) ) , texture - > id ( ) , mipLevel ) ;
}
void attachTexture2D ( Target target , std : : uint8_t colorAttachment , Texture2D * texture , GLint mipLevel ) ;
/**
* @ brief Attach cube map texture to given framebuffer depth / stencil attachment
@ -204,11 +172,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @ see attachTexture2D ( ) , @ fn_gl { BindFramebuffer } ,
* @ fn_gl { FramebufferTexture }
*/
inline void attachCubeMapTexture ( Target target , DepthStencilAttachment depthStencilAttachment , CubeMapTexture * texture , CubeMapTexture : : Coordinate coordinate , GLint mipLevel ) {
/** @todo Check for internal format compatibility */
bind ( target ) ;
glFramebufferTexture2D ( static_cast < GLenum > ( target ) , static_cast < GLenum > ( depthStencilAttachment ) , static_cast < GLenum > ( coordinate ) , texture - > id ( ) , mipLevel ) ;
}
void attachCubeMapTexture ( Target target , DepthStencilAttachment depthStencilAttachment , CubeMapTexture * texture , CubeMapTexture : : Coordinate coordinate , GLint mipLevel ) ;
/**
* @ brief Attach cube map texture to given framebuffer color attachment
@ -221,11 +185,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @ see attachTexture2D ( ) , @ fn_gl { BindFramebuffer } ,
* @ fn_gl { FramebufferTexture }
*/
inline void attachCubeMapTexture ( Target target , std : : uint8_t colorAttachment , CubeMapTexture * texture , CubeMapTexture : : Coordinate coordinate , GLint mipLevel ) {
/** @todo Check for internal format compatibility */
bind ( target ) ;
glFramebufferTexture2D ( static_cast < GLenum > ( target ) , GL_COLOR_ATTACHMENT0 + colorAttachment , static_cast < GLenum > ( coordinate ) , texture - > id ( ) , mipLevel ) ;
}
void attachCubeMapTexture ( Target target , std : : uint8_t colorAttachment , CubeMapTexture * texture , CubeMapTexture : : Coordinate coordinate , GLint mipLevel ) ;
/**
* @ brief Attach 3 D texture to given framebuffer depth / stencil attachment
@ -238,19 +198,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @ see @ fn_gl { BindFramebuffer } , @ fn_gl { FramebufferTexture }
* @ requires_es_extension % Extension @ es_extension { OES , texture_3D }
*/
inline void attachTexture3D ( Target target , DepthStencilAttachment depthStencilAttachment , Texture3D * texture , GLint mipLevel , GLint layer ) {
/** @todo Check for texture target compatibility */
bind ( target ) ;
/** @todo Get some extension wrangler for glFramebufferTexture3D() (extension only) */
# ifndef MAGNUM_TARGET_GLES
glFramebufferTexture3D ( static_cast < GLenum > ( target ) , static_cast < GLenum > ( depthStencilAttachment ) , static_cast < GLenum > ( texture - > target ( ) ) , texture - > id ( ) , mipLevel , layer ) ;
# else
static_cast < void > ( depthStencilAttachment ) ;
static_cast < void > ( texture ) ;
static_cast < void > ( mipLevel ) ;
static_cast < void > ( layer ) ;
# endif
}
void attachTexture3D ( Target target , DepthStencilAttachment depthStencilAttachment , Texture3D * texture , GLint mipLevel , GLint layer ) ;
/**
* @ brief Attach 3 D texture to given framebuffer color attachment
@ -263,19 +211,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer {
* @ see @ fn_gl { BindFramebuffer } , @ fn_gl { FramebufferTexture }
* @ requires_es_extension % Extension @ es_extension { OES , texture_3D }
*/
inline void attachTexture3D ( Target target , std : : uint8_t colorAttachment , Texture3D * texture , GLint mipLevel , GLint layer ) {
/** @todo Check for texture target compatibility */
bind ( target ) ;
/** @todo Get some extension wrangler for glFramebufferTexture3D() (extension only) */
# ifndef MAGNUM_TARGET_GLES
glFramebufferTexture3D ( static_cast < GLenum > ( target ) , GL_COLOR_ATTACHMENT0 + colorAttachment , static_cast < GLenum > ( texture - > target ( ) ) , texture - > id ( ) , mipLevel , layer ) ;
# else
static_cast < void > ( colorAttachment ) ;
static_cast < void > ( texture ) ;
static_cast < void > ( mipLevel ) ;
static_cast < void > ( layer ) ;
# endif
}
void attachTexture3D ( Target target , std : : uint8_t colorAttachment , Texture3D * texture , GLint mipLevel , GLint layer ) ;
} ;
}