gKit2 light
Loading...
Searching...
No Matches
framebuffer.h
Go to the documentation of this file.
1
3
4#ifndef _FRAMEBUFFER_H
5#define _FRAMEBUFFER_H
6
7#include <vector>
8#include <array>
9
10#include "texture.h"
11
12
51
52struct Framebuffer
53{
54 Framebuffer( ) = default;
55
57 GLuint create( const int width, const int height );
59 void release( );
60
62 int width( ) const;
64 int height( ) const;
65
68 void clear_color( const Color& value );
69 void clear_depth( const float value );
70 void clear_position( const Point& value );
71 void clear_texcoord( const vec2& value );
72 void clear_normal( const Vector& value );
73 void clear_material( const unsigned value );
75
77 void bind( const GLuint program, const bool store_color, const bool store_depth, const bool store_position, const bool store_texcoord, const bool store_normal, const bool store_material );
78
80 void unbind( const int width, const int height );
81
83 void unbind_textures( );
84
89 void use_color_texture( const GLuint program, const char *uniform, const int unit, const GLuint sampler= 0 );
90 void use_depth_texture( const GLuint program, const char *uniform, const int unit, const GLuint sampler= 0 );
91 void use_position_texture( const GLuint program, const char *uniform, const int unit, const GLuint sampler= 0 );
92 void use_texcoord_texture( const GLuint program, const char *uniform, const int unit, const GLuint sampler= 0 );
93 void use_normal_texture( const GLuint program, const char *uniform, const int unit, const GLuint sampler= 0 );
94 void use_material_texture( const GLuint program, const char *uniform, const int unit, const GLuint sampler= 0 );
96
101 void blit_depth( const int dstX0, const int dstY0, const int dstX1, const int dstY1 );
102 void blit_color( const int dstX0, const int dstY0, const int dstX1, const int dstY1 );
103 void blit_position( const int dstX0, const int dstY0, const int dstX1, const int dstY1 );
104 void blit_texcoord( const int dstX0, const int dstY0, const int dstX1, const int dstY1 );
105 void blit_normal( const int dstX0, const int dstY0, const int dstX1, const int dstY1 );
106 //~ void blit_material( const int dstX0, const int dstY0, const int dstX1, const int dstY1 );
108
109protected:
110 bool status( );
111
112 std::vector<GLenum> m_draw_buffers;
113 std::vector<GLuint> m_color_textures;
114
115 std::vector< std::array<unsigned,4> > m_clear_colors;
116 std::vector<int> m_color_units;
117 float m_clear_depth;
118 int m_depth_unit;
119
120 GLuint m_depth_texture;
121 GLuint m_fbo;
122 int m_width;
123 int m_height;
124};
125
126
127#endif
representation d'une couleur (rgba) transparente ou opaque.
Definition color.h:14
void release()
destruction.
int height() const
renvoie la hauteur du framebuffer.
void clear_texcoord(const vec2 &value)
texcoord par defaut.
void clear_position(const Point &value)
position par defaut.
void clear_material(const unsigned value)
indice de matiere par defaut.
int width() const
renvoie la largeur du framebuffer.
void unbind(const int width, const int height)
desactive le framebuffer, selection du framebuffer par defaut associe a la fenetre.
GLuint create(const int width, const int height)
creation du framebuffer
void clear_color(const Color &value)
couleur par defaut.
void clear_depth(const float value)
profondeur par defaut.
void unbind_textures()
nettoyage, desactive les textures utilisees par les autres shaders, cf use_color_texture(),...
void bind(const GLuint program, const bool store_color, const bool store_depth, const bool store_position, const bool store_texcoord, const bool store_normal, const bool store_material)
selection du framebuffer, stocker les sorties du fragment shader. les textures sont initialisees avec...
void clear_normal(const Vector &value)
normale par defaut.
representation d'un point 3d.
Definition vec.h:21
representation d'un vecteur 3d.
Definition vec.h:67
vecteur generique, utilitaire.
Definition vec.h:152