Esempio n. 1
0
void Framebuffer::set_depth_stencil_attachment(Renderbuffer &renderbuffer)
{
  assert(renderbuffer.format() == PixelFormat::D24S8);  // zatial len depth 24b stencil 8b
  GL_ERROR_GUARD;

  my_vs.bind_write_framebuffer(*this, false);
  glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
                            renderbuffer.gl_renderbuffer());
}
Esempio n. 2
0
void Framebuffer::set_color_attachment(unsigned index, Renderbuffer &renderbuffer)
{
  GL_ERROR_GUARD;
  assert(index < 16); // momentalne je podporovanych len 16 attachmentov
                      // dobre by bolo zistit max pocet cez glGet
//  assert(texture.type() == TextureType::TEXTURE_2D);
  my_vs.bind_write_framebuffer(*this, false);
  GLenum attachment = GL_COLOR_ATTACHMENT0 + index;
  glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, attachment, GL_RENDERBUFFER,
    renderbuffer.gl_renderbuffer());
  my_color_attachments |= 1 << index;
}