utilisation interne. representation d'un framebuffer. More...
#include <TPFramebuffer.h>
Public Member Functions | |
GLRendertarget (const GLenum target) | |
constructeur par defaut. | |
int | attachTexture (const GLenum target, const unsigned int buffer, GLTexture *texture, const int level=0) |
associe une texture existante au framebuffer. | |
int | attachTexture (const GLenum target, const unsigned int buffer, GLDepthTexture *texture, const int level=0) |
int | attachTexture (const GLenum target, const unsigned int buffer, GLTexture2DArray *texture, const int layer, const int level=0) |
int | attachTexture (const GLenum target, const unsigned int buffer, GLTextureCube *texture, const GLenum face, const int level=0) |
int | attachRenderbuffer (const GLenum target, const unsigned int buffer, GLRenderbuffer *renderbuffer) |
GLRendertarget (const GLenum target, const int w, const int h, const unsigned int buffer_bits, const TextureFormat &color_format=TextureRGBA, const TextureFormat &depth_format=TextureDepth) | |
constructeur : cree les textures et les associe au framebuffer. buffer_bits= gk::COLOR0_BIT | gk::DEPTH_BIT, par exemple. | |
virtual | ~GLRendertarget () |
destructeur. | |
int | createGLResource () |
creation de l'objet opengl. | |
int | releaseGLResource () |
destruction de l'objet opengl. | |
int | validate (const GLenum target) |
verifie la configuration du framebuffer. | |
int | width () const |
renvoie la largeur du framebuffer. renvoie 0, si la largeur du framebuffer n'est pas definie. | |
int | height () const |
renvoie la hauteur du framebuffer. renvoie 0, si la hauteur du framebuffer n'est pas definie. | |
GLTexture * | texture (const unsigned int buffer) |
renvoie la texture associee a buffer (cf gk::COLOR0, gk::COLOR1, etc.) | |
GLRenderbuffer * | renderbuffer (const unsigned int buffer) |
renvoie le renderbuffer associe a buffer (cf gk::COLOR0, gk::COLOR1, gk::DEPTH, etc.) | |
GLDepthTexture * | depthtexture () |
renvoie le zbuffer, la texture associee a gk::DEPTH | |
const std::vector< GLenum > & | drawBuffers () |
renvoie les draw buffers opengl / textures attachees (cf. glDrawBuffers() et GL_COLOR_ATTACHMENT0, etc.). | |
bool | colorMask () const |
renvoie vrai si des textures couleurs sont attachees. | |
bool | depthMask () const |
renvoie vrai si un zbuffer est attache. | |
GLuint | name () const |
renvoie l'identifiant de l'objet openGL. | |
Protected Member Functions | |
template<typename Texture > | |
int | attach_buffer (const unsigned int buffer, Texture *texture) |
Protected Attributes | |
std::vector< GLTexture * > | m_textures |
std::vector< GLRenderbuffer * > | m_renderbuffers |
std::vector< GLenum > | m_draw_buffers |
int | m_width |
int | m_height |
int | m_color_mask |
int | m_depth_mask |
GLuint | m_name |
utilisation interne. representation d'un framebuffer.
gk::GLRendertarget::GLRendertarget | ( | const GLenum | target, |
const int | w, | ||
const int | h, | ||
const unsigned int | buffer_bits, | ||
const TextureFormat & | color_format = TextureRGBA , |
||
const TextureFormat & | depth_format = TextureDepth |
||
) |
constructeur : cree les textures et les associe au framebuffer. buffer_bits= gk::COLOR0_BIT | gk::DEPTH_BIT, par exemple.
exemple d'utilisation :
gk::GLFramebuffer framebuffer(512, 512, gk::COLOR0_BIT | gk::DEPTH_BIT); // cree un framebuffer + une texture couleur + une texture profondeur gk::GLTexture *color= framebuffer.texture(gk::COLOR0); // pour recuperer la texture associee au framebuffer. gk::GLDepthTexture *depth= framebuffer.zbuffer(); // pour recuperer la texture de profondeur associee au framebuffer.
References gk::GLTexture::createGLResource(), gk::GLManager< Object >::insert(), gk::GLResource::name(), gk::GLTexture::target(), and validate().
int gk::GLRendertarget::attachTexture | ( | const GLenum | target, |
const unsigned int | buffer, | ||
GLTexture * | texture, | ||
const int | level = 0 |
||
) |
associe une texture existante au framebuffer.
buffer = gk::COLOR0, etc. ou gk::DEPTH. toutes les textures doivent avoir les memes dimensions.
References gk::GLResource::name(), and gk::GLTexture::target().
renvoie le zbuffer, la texture associee a gk::DEPTH
const std::vector<GLenum>& gk::GLRendertarget::drawBuffers | ( | ) | [inline] |
renvoie les draw buffers opengl / textures attachees (cf. glDrawBuffers() et GL_COLOR_ATTACHMENT0, etc.).
const std::vector<GLenum>& buffers= framebuffer->drawBuffers();
glDrawbuffers((GLsizei) buffers.size(), &buffers.front());
bool gk::GLRendertarget::colorMask | ( | ) | const [inline] |
renvoie vrai si des textures couleurs sont attachees.
cf. glColorMask( ) pour bloquer l'ecriture dans le framebuffer, si necessaire.
bool gk::GLRendertarget::depthMask | ( | ) | const [inline] |
renvoie vrai si un zbuffer est attache.
cf. glDepthMask( ) pour bloquer l'ecriture dans le framebuffer, si necessaire.