Members
-
The sampler to use when sampling this texture. Create a sampler by calling
Sampler
. If this parameter is not specified, a default sampler is used. The default sampler clamps texture coordinates in both directions, uses linear filtering for both magnification and minifcation, and uses a maximum anisotropy of 1.0.
Methods
-
staticCesium.Texture.fromFramebuffer(options) → Texture
-
Creates a texture, and copies a subimage of the framebuffer to it. When called without arguments, the texture is the same width and height as the framebuffer and contains its contents.
Name Type Description options
Object Object with the following properties: Name Type Default Description context
Context The context in which the Texture gets created. pixelFormat
PixelFormat PixelFormat.RGB
optional The texture's internal pixel format. framebufferXOffset
Number 0
optional An offset in the x direction in the framebuffer where copying begins from. framebufferYOffset
Number 0
optional An offset in the y direction in the framebuffer where copying begins from. width
Number canvas.clientWidth
optional The width of the texture in texels. height
Number canvas.clientHeight
optional The height of the texture in texels. framebuffer
Framebuffer defaultFramebuffer
optional The framebuffer from which to create the texture. If this parameter is not specified, the default framebuffer is used. Returns:
A texture with contents from the framebuffer.Throws:
-
DeveloperError : Invalid pixelFormat.
-
DeveloperError : pixelFormat cannot be DEPTH_COMPONENT, DEPTH_STENCIL or a compressed format.
-
DeveloperError : framebufferXOffset must be greater than or equal to zero.
-
DeveloperError : framebufferYOffset must be greater than or equal to zero.
-
DeveloperError : framebufferXOffset + width must be less than or equal to canvas.clientWidth.
-
DeveloperError : framebufferYOffset + height must be less than or equal to canvas.clientHeight.
- Sampler
Example:
// Create a texture with the contents of the framebuffer. var t = Texture.fromFramebuffer({ context : context });
See:
-
-
Copy new image data into this texture, from a source
ImageData
,Image
,Canvas
, orVideo
. or an object with width, height, and arrayBufferView properties.Name Type Default Description source
Object The source ImageData
,Image
,Canvas
, orVideo
, or an object with width, height, and arrayBufferView properties.xOffset
Number 0
optional The offset in the x direction within the texture to copy into. yOffset
Number 0
optional The offset in the y direction within the texture to copy into. Throws:
-
DeveloperError : Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.
-
DeveloperError : Cannot call copyFrom with a compressed texture pixel format.
-
DeveloperError : xOffset must be greater than or equal to zero.
-
DeveloperError : yOffset must be greater than or equal to zero.
-
DeveloperError : xOffset + source.width must be less than or equal to width.
-
DeveloperError : yOffset + source.height must be less than or equal to height.
-
DeveloperError : This texture was destroyed, i.e., destroy() was called.
Example:
texture.copyFrom({ width : 1, height : 1, arrayBufferView : new Uint8Array([255, 0, 0, 255]) });
-
-
Name Type Default Description xOffset
Number 0
optional The offset in the x direction within the texture to copy into. yOffset
Number 0
optional The offset in the y direction within the texture to copy into. framebufferXOffset
Number 0
optional optional framebufferYOffset
Number 0
optional optional width
Number width
optional optional height
Number height
optional optional Throws:
-
DeveloperError : Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.
-
DeveloperError : Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.
-
DeveloperError : Cannot call copyFrom with a compressed texture pixel format.
-
DeveloperError : This texture was destroyed, i.e., destroy() was called.
-
DeveloperError : xOffset must be greater than or equal to zero.
-
DeveloperError : yOffset must be greater than or equal to zero.
-
DeveloperError : framebufferXOffset must be greater than or equal to zero.
-
DeveloperError : framebufferYOffset must be greater than or equal to zero.
-
DeveloperError : xOffset + width must be less than or equal to width.
-
DeveloperError : yOffset + height must be less than or equal to height.
-
-
Name Type Default Description hint
MipmapHint MipmapHint.DONT_CARE
optional optional. Throws:
-
DeveloperError : Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.
-
DeveloperError : Cannot call generateMipmap when the texture pixel format is a compressed format.
-
DeveloperError : hint is invalid.
-
DeveloperError : This texture's width must be a power of two to call generateMipmap().
-
DeveloperError : This texture's height must be a power of two to call generateMipmap().
-
DeveloperError : This texture was destroyed, i.e., destroy() was called.
-