-
Notifications
You must be signed in to change notification settings - Fork 6
Frame buffers
Frame buffers are in the same package as textures.
Their interface is IFrameBuffer.
Use SimpleFrameBuffer to create simple frame buffer. It can be used for some simple postprocessing shaders. SimpleFrameBuffer implements ITexture interface, and all texture functions are delegated to first texture attachment of this frame buffer. So you can use this frame buffer as simple texture.
val fb = SimpleFrameBuffer(width = 1024, height = 1024)
fb.render {
// render some meshes...
}Also there is simple geomtry buffer GBuffer. It can used for deferred shading, and rendering color, normal, position and depth textures. Note that, such feature, as multiple render targets requires GL ES 3 (WebGL 2) or extensions.
You can create frame buffer with any attachments you want, using FrameBuffer. You can use existing attachment constructors from Attachments, add attachments to buffer and then call buildAttachments().
val fb = FrameBuffer(width = 1024, height = 1024)
fb.attachments.add(Attachments.color(index = 0, internalFormat = GL_RGBA32F, pixelFormat = GL_RGBA, type = GL_FLOAT))
fb.attachments.add(Attachments.color(index = 1, internalFormat = GL_RGBA32F, pixelFormat = GL_RGBA, type = GL_FLOAT))
fb.attachments.add(Attachments.color(index = 2, internalFormat = GL_RGBA32F, pixelFormat = GL_RGBA, type = GL_FLOAT))
fb.attachments.add(Attachments.depth())
fb.buildAttachments()-
Quick Start
-
3D graphics
-
Math