Lua FBO

From Spring
Revision as of 11:25, 5 March 2008 by JK (talk | contribs)
Jump to navigationJump to search

FBO

gl.CreateFBO

 ( [ table initialization ] ) -> userdata fbo

 initialization table can contain:
   {
     depth   = luaTex or RBO or nil,
     stencil = luaTex or RBO or nil,
     color0  = luaTex or nil,
     color1  = luaTex or nil,
     color2  = luaTex or nil,
     ..
     color15 = luaTex or nil,
     drawbuffers = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT3_EXT, ..}
   }

gl.DeleteFBO (this doesn't delete the attached objects!)

 ( fbo ) -> nil

gl.IsValidFBO (search the internet for glCheckFramebufferStatusEXT to learn more about the status param)

 ( fbo [, number target ] ) -> boolean valid [, number status ]

gl.ActiveFBO

 ( fbo [, number target] [, boolean loadIdentities ] , lua_function, arg1, arg2, ... ) -> nil

gl.UnsafeSetFBO (similar to gl.ActiveFBO(). NOTE: don't forget to unbind you FBO!)

 ( nil [, number target = GL_FRAMEBUFFER_EXT ] ) -> nil (this will load the screenbuffer)
 ( fbo [, number target = fbo.target ] ) -> nil

gl.BlitFBO needs GLEW_EXT_framebuffer_blit

 ( int x0Src,y0Src,x1Src,y1Src,  int x0Dst,y0Dst,x1Dst,y1Dst
   [, number mask = GL_COLOR_BUFFER_BIT [, number filter = GL_NEAREST ] ) -> nil
 ( fboSrc, int x0Src,y0Src,x1Src,y1Src,  fboDst, int x0Dst,y0Dst,x1Dst,y1Dst
   [, number mask = GL_COLOR_BUFFER_BIT [, number filter = GL_NEAREST ] ) -> nil