0
\$\begingroup\$
Ref<Framebuffer> colorSource = framebufferStack->peek();
colorSource->bind();
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data());

for(int i = 0; i < width*height; i++)
{
  pixels[i*4] = 127;
  pixels[i*4+1] = 127;
  pixels[i*4+2] = 127;
  pixels[i*4+3] = 255;
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data());
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data());
  1. I copy the framebuffer into some uint8_t vector

  2. I modify the uint8_t vector

  3. I try to overwrite the framebuffer on the GPU

  4. I read the framebuffer to make sure it was overwritten (I am getting the original values not the 127 127 127 255 ones).

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I needed to not only bind the framebuffer but also the texture associated with this framebuffer.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .