Skip to content

Instantly share code, notes, and snippets.

@BlockoS
Created September 5, 2012 21:36
Show Gist options
  • Save BlockoS/3645271 to your computer and use it in GitHub Desktop.
Save BlockoS/3645271 to your computer and use it in GitHub Desktop.
Fbo creation from hell
CALL_GLPROC(GenFramebuffers)(FRAMEBUFFER_COUNT, framebuffer);
for(i=0, j=0, texId[TEXTURE_COUNT]=0; i<=NORMALIZE;)
{
CALL_GLPROC(BindFramebuffer)(GL_FRAMEBUFFER, framebuffer[i++]);
CALL_GLPROC(FramebufferTexture2D)( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texId[g_fboTexId[j++]], 0 );
CALL_GLPROC(FramebufferTexture2D)( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, texId[g_fboTexId[j++]], 0 );
}
for(i=0; i<SCALE_COUNT; i++)
{
CALL_GLPROC(BindFramebuffer)(GL_FRAMEBUFFER, framebuffer[SCALE_FIRST+i]);
CALL_GLPROC(FramebufferTextureLayer)(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texId[TEXTURE_ARRAY], 0, i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment