|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectcom.jme3.renderer.GLObject
com.jme3.texture.FrameBuffer
public class FrameBuffer
FrameBuffer
s are rendering surfaces allowing
off-screen rendering and render-to-texture functionality.
Instead of the scene rendering to the screen, it is rendered into the
FrameBuffer, the result can be either a texture or a buffer.
A FrameBuffer
supports two methods of rendering,
using a Texture
or using a buffer.
When using a texture, the result of the rendering will be rendered
onto the texture, after which the texture can be placed on an object
and rendered as if the texture was uploaded from disk.
When using a buffer, the result is rendered onto
a buffer located on the GPU, the data of this buffer is not accessible
to the user. buffers are useful if one
wishes to retrieve only the color content of the scene, but still desires
depth testing (which requires a depth buffer).
Buffers can be copied to other framebuffers
including the main screen, by using
Renderer.copyFrameBuffer(com.jme3.texture.FrameBuffer, com.jme3.texture.FrameBuffer)
.
The content of a FrameBuffer.RenderBuffer
can be retrieved by using
Renderer.readFrameBuffer(com.jme3.texture.FrameBuffer, java.nio.ByteBuffer)
.
FrameBuffer
s have several attachment points, there are
several color attachment points and a single depth
attachment point.
The color attachment points support image formats such as
Image.Format.RGBA8
, allowing rendering the color content of the scene.
The depth attachment point requires a depth image format.
Renderer.setFrameBuffer(com.jme3.texture.FrameBuffer)
入れ子のクラスの概要 | |
---|---|
class |
FrameBuffer.RenderBuffer
RenderBuffer represents either a texture or a
buffer that will be rendered to. |
クラス com.jme3.renderer.GLObject から継承された入れ子のクラス/インタフェース |
---|
GLObject.Type |
コンストラクタの概要 | |
---|---|
FrameBuffer(int width,
int height,
int samples)
Creates a new FrameBuffer with the given width, height, and number of samples. |
メソッドの概要 | |
---|---|
void |
addColorTexture(Texture2D tex)
Add a color texture to use for this framebuffer. |
void |
clearColorTargets()
Clears all color targets that were set or added previously. |
GLObject |
createDestructableClone()
Creates a shallow clone of this GL Object. |
void |
deleteObject(Renderer r)
Deletes the GL object from the GPU when it is no longer used. |
FrameBuffer.RenderBuffer |
getColorBuffer()
|
FrameBuffer.RenderBuffer |
getColorBuffer(int index)
|
FrameBuffer.RenderBuffer |
getDepthBuffer()
|
int |
getHeight()
|
int |
getNumColorBuffers()
|
int |
getSamples()
|
int |
getTargetIndex()
|
int |
getWidth()
|
boolean |
isMultiTarget()
|
void |
resetObject()
Called when the GL context is restarted to reset all IDs. |
void |
setColorBuffer(Image.Format format)
Enables the use of a color buffer for this FrameBuffer . |
void |
setColorTexture(Texture2D tex)
Set the color texture to use for this framebuffer. |
void |
setDepthBuffer(Image.Format format)
Enables the use of a depth buffer for this FrameBuffer . |
void |
setDepthTexture(Texture2D tex)
Set the depth texture to use for this framebuffer. |
void |
setMultiTarget(boolean enabled)
If enabled, any shaders rendering into this FrameBuffer
will be able to write several results into the renderbuffers
by using the gl_FragData array. |
void |
setTargetIndex(int index)
If MRT is not enabled ( setMultiTarget(boolean) is false)
then this specifies the color target to which the scene should be rendered. |
java.lang.String |
toString()
|
クラス com.jme3.renderer.GLObject から継承されたメソッド |
---|
clearUpdateNeeded, getId, isUpdateNeeded, setId, setUpdateNeeded |
クラス java.lang.Object から継承されたメソッド |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
コンストラクタの詳細 |
---|
public FrameBuffer(int width, int height, int samples)
Creates a new FrameBuffer with the given width, height, and number of samples. If any textures are attached to this FrameBuffer, then they must have the same number of samples as given in this constructor.
Note that if the Renderer
does not expose the
Caps.NonPowerOfTwoTextures
, then an exception will be thrown
if the width and height arguments are not power of two.
width
- The width to useheight
- The height to usesamples
- The number of samples to use for a multisampled
framebuffer, or 1 if the framebuffer should be singlesampled.
java.lang.IllegalArgumentException
- If width or height are not positive.メソッドの詳細 |
---|
public void setDepthBuffer(Image.Format format)
FrameBuffer
.
format
- The format to use for the depth buffer.
java.lang.IllegalArgumentException
- If format
is not a depth format.public void setColorBuffer(Image.Format format)
FrameBuffer
.
format
- The format to use for the color buffer.
java.lang.IllegalArgumentException
- If format
is not a color format.public void setMultiTarget(boolean enabled)
FrameBuffer
will be able to write several results into the renderbuffers
by using the gl_FragData
array. Every slot in that
array maps into a color buffer attached to this framebuffer.
enabled
- True to enable MRT (multiple rendering targets).public boolean isMultiTarget()
setMultiTarget(boolean)
public void setTargetIndex(int index)
setMultiTarget(boolean)
is false)
then this specifies the color target to which the scene should be rendered.
By default the value is 0.
index
- The color attachment index.
java.lang.IllegalArgumentException
- If index is negative or doesn't map
to any attachment on this framebuffer.public int getTargetIndex()
setTargetIndex(int)
public void setColorTexture(Texture2D tex)
addColorTexture(com.jme3.texture.Texture2D)
and adds this texture as the only target.
tex
- The color texture to set.public void clearColorTargets()
public void addColorTexture(Texture2D tex)
gl_FragData
.
If MRT is not enabled, then the index set with setTargetIndex(int)
is rendered to by the shader.
tex
- The texture to add.public void setDepthTexture(Texture2D tex)
tex
- The color texture to set.public int getNumColorBuffers()
public FrameBuffer.RenderBuffer getColorBuffer(int index)
index
-
public FrameBuffer.RenderBuffer getColorBuffer()
public FrameBuffer.RenderBuffer getDepthBuffer()
public int getHeight()
public int getWidth()
public int getSamples()
public java.lang.String toString()
GLObject
内の toString
public void resetObject()
GLObject
の記述:
GLObject
内の resetObject
public void deleteObject(Renderer r)
GLObject
の記述:
GLObject
内の deleteObject
r
- The renderer to be used to delete the objectpublic GLObject createDestructableClone()
GLObject
の記述:
GLObject
内の createDestructableClone
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |