(bind-func FBO
(lambda (colour:Texture* depth:Texture*)
(let ((fbo (FBO:[FBO*,i32,Texture*,Texture*,i32,i32]* 0 colour depth (width colour) (height colour))))
(glGenFramebuffers 1 (tref-ptr fbo 0))
(gl_print_error "Error creating FBO")
(glBindFramebuffer GL_FRAMEBUFFER (tref fbo 0))
(bind colour)
(glFramebufferTexture2D GL_FRAMEBUFFER GL_COLOR_ATTACHMENT0 GL_TEXTURE_2D (id colour) 0)
(unbind colour)
(update colour)
(bind depth)
(glFramebufferTexture2D GL_FRAMEBUFFER GL_DEPTH_ATTACHMENT GL_TEXTURE_2D (id depth) 0)
(unbind depth)
(update depth)
(glBindFramebuffer GL_FRAMEBUFFER 0)
fbo)))