#include "deferredmodule.h" #include "glassert.h" #include "texture.h" GBuffer::GBuffer(int width, int height) : FrameBuffer() { Texture* tex; // - Normal buffer tex = new Texture(GL_RGB, GL_RGB16F, width, height, GL_FLOAT); tex->setFiltering(GL_NEAREST); addTexture(tex, GL_COLOR_ATTACHMENT0); // - Color + Specular exponent buffer tex = new Texture(GL_RGBA, GL_RGBA, width, height); tex->setFiltering(GL_NEAREST); addTexture(tex, GL_COLOR_ATTACHMENT1); // - Specular color + objectId buffer tex = new Texture(GL_RGBA, GL_RGBA, width, height); tex->setFiltering(GL_NEAREST); addTexture(tex, GL_COLOR_ATTACHMENT2); // - depth buffer tex = new Texture(GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, width, height, GL_FLOAT); tex->setFiltering(GL_NEAREST); addTexture(tex, GL_DEPTH_ATTACHMENT); initGL(); } GBuffer::~GBuffer() { for(Texture* t : textures) delete(t); }