Skip to main content
Commonmark migration
Source Link

You are missing a glDrawBuffers (...) call. You need to establish that color attachment 0 is the first buffer your fragment shader is going to output.

###This should fix your problem:

This should fix your problem:

glBindFramebuffer(GL_FRAMEBUFFER, _fbo);

const GLenum draw_buffer = GL_COLOR_ATTACHMENT0;
glDrawBuffers (1, &draw_buffer);

//Draw Scene

glBindFramebuffer(GL_FRAMEBUFFER, 0);

You do not have to do this in the loop, you could do it once when you initialize your FBO. But you do have to do it somewhere while your FBO is bound.

You are missing a glDrawBuffers (...) call. You need to establish that color attachment 0 is the first buffer your fragment shader is going to output.

###This should fix your problem:

glBindFramebuffer(GL_FRAMEBUFFER, _fbo);

const GLenum draw_buffer = GL_COLOR_ATTACHMENT0;
glDrawBuffers (1, &draw_buffer);

//Draw Scene

glBindFramebuffer(GL_FRAMEBUFFER, 0);

You do not have to do this in the loop, you could do it once when you initialize your FBO. But you do have to do it somewhere while your FBO is bound.

You are missing a glDrawBuffers (...) call. You need to establish that color attachment 0 is the first buffer your fragment shader is going to output.

This should fix your problem:

glBindFramebuffer(GL_FRAMEBUFFER, _fbo);

const GLenum draw_buffer = GL_COLOR_ATTACHMENT0;
glDrawBuffers (1, &draw_buffer);

//Draw Scene

glBindFramebuffer(GL_FRAMEBUFFER, 0);

You do not have to do this in the loop, you could do it once when you initialize your FBO. But you do have to do it somewhere while your FBO is bound.

Source Link

You are missing a glDrawBuffers (...) call. You need to establish that color attachment 0 is the first buffer your fragment shader is going to output.

###This should fix your problem:

glBindFramebuffer(GL_FRAMEBUFFER, _fbo);

const GLenum draw_buffer = GL_COLOR_ATTACHMENT0;
glDrawBuffers (1, &draw_buffer);

//Draw Scene

glBindFramebuffer(GL_FRAMEBUFFER, 0);

You do not have to do this in the loop, you could do it once when you initialize your FBO. But you do have to do it somewhere while your FBO is bound.