Package de.coreengine.rendering
Class FrameBufferObject
- java.lang.Object
-
- de.coreengine.rendering.FrameBufferObject
-
-
Constructor Summary
Constructors Constructor Description FrameBufferObject(int width, int height, boolean multisampled)
Creates new framebuffer in opengl and attaching first color buffer (color buffer 0) and depth buffer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind(int readAttachment)
Binding framebuffer as draw framebuffer and bind all color buffers.void
blitToFbo(FrameBufferObject out, int buffers)
Blitting/writing color and depth information from this fbo into another fbovoid
blitToScreen()
Blitting this fbo onto the glfw windowint
getColorAttachment0()
Returning the id of the color attachment texture, if multisampling is disabled.int
getDepthAttachment()
Returning the id of the depth texture, if multisampling is disabled.void
unbind()
Unbing framebuffer (bind 0) and reset glViewport to window dimension
-
-
-
Constructor Detail
-
FrameBufferObject
public FrameBufferObject(int width, int height, boolean multisampled)
Creates new framebuffer in opengl and attaching first color buffer (color buffer 0) and depth buffer- Parameters:
width
- Horizontal resolution of the fbo in pixelsheight
- Vertical resolution of the fbo in pixelsmultisampled
- Should fbo use multisampling
-
-
Method Detail
-
blitToFbo
public final void blitToFbo(FrameBufferObject out, int buffers)
Blitting/writing color and depth information from this fbo into another fbo- Parameters:
out
- Output fbo to blit inbuffers
- Wich buffers to blit (GL_DEPTH_BUFFER_BIT, GL_COLOR_BUFFER_BIT)
-
blitToScreen
public final void blitToScreen()
Blitting this fbo onto the glfw window
-
bind
public final void bind(int readAttachment)
Binding framebuffer as draw framebuffer and bind all color buffers. Sets glViewport to fbo dimension- Parameters:
readAttachment
- Color attachment to bind as read buffer
-
unbind
public final void unbind()
Unbing framebuffer (bind 0) and reset glViewport to window dimension
-
getDepthAttachment
public final int getDepthAttachment()
Returning the id of the depth texture, if multisampling is disabled. If multisampling is enabled, returning the id of the depth buffer- Returns:
- Id of the depth texture/buffer
-
getColorAttachment0
public final int getColorAttachment0()
Returning the id of the color attachment texture, if multisampling is disabled. If multisampling is enabled, returning the id of the color attachment buffer- Returns:
- Id of the color attachment 0 texture/renderbuffer
-
-