rendering fbo to texture, doesn't seem to work


Code here:

expected behaviour: texture attached to fbo is filled with red, red square then renders in bottom left 50x50 pixel square. rest of screen remains black

actual behavior: white square renders in bottom left 50x50 pixel square, rest of screen is red.

At the moment I’m just trying to get the frame buffer to render anything, although my eventual goal is to render some triangles into it.

Any help would be appreciated :slight_smile:

an update:
the colors from the two FBOs seem to be being combined, but the wrong way around. I’d expect the red square to be at the bottom left, and the green square to be the rest of the screen. However, it’s the opposite way around.

some changes for you

  1. you must set the clear colour before you clear


  1. you must activate a texture before you bind

glBindTexture(GL_TEXTURE_2D, textureId);