Reputation: 2122
Then we create buffer object we can specify many colour attachments from 0 to N
glBindFramebuffer(GL_FRAMEBUFFER, some_buffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,some_texture_0, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D,some_texture_1, 0);
But then we draw to buffer, how to control which colour attachment we use in FBO? (default is 0), or multiple colour attachments works different way?
glBindFramebuffer(GL_FRAMEBUFFER, some_buffer);
//draw something
//switch to colour_attachment1
//draw something
//switch back to colour_attacment0
Upvotes: 0
Views: 732
Reputation: 473976
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D,some_texture_1, 0);
This line is not allowed in OpenGL ES 2.0. At least, not without extensions. OpenGL ES simply does not support having multiple color buffers. There is only GL_COLOR_ATTACHMENT0
; nothing more than that.
So if you want to draw to one buffer then another, you need to bind a new FBO to do so.
Upvotes: 2