Skip to content

TextureWriteOptions

Options to control how raw bytes are uploaded into a texture.

Fields

  • origin_x, origin_y, origin_z
  • size_width, size_height, size_depth
  • bytes_per_row: optional; must be a multiple of 256 when provided
  • rows_per_image: optional; defaults to height
1 collapsed line
fn main() -> Result<(), Box<dyn std::error::Error>> {
use fragmentcolor::TextureWriteOptions;
let _opt = TextureWriteOptions::whole().with_bytes_per_row(256).with_rows_per_image(64);
2 collapsed lines
Ok(())
}

Create an options object that targets the entire texture region.

  • Origin defaults to (0,0,0)
  • Size is inferred from the texture at call time
  • bytes_per_row and rows_per_image are inferred if not set
1 collapsed line
fn main() -> Result<(), Box<dyn std::error::Error>> {
use fragmentcolor::TextureWriteOptions;
let _opt = TextureWriteOptions::whole();
2 collapsed lines
Ok(())
}

TextureWriteOptions::with_bytes_per_row(bytes)

Section titled “TextureWriteOptions::with_bytes_per_row(bytes)”

Set the bytes-per-row for the upload. Must be a multiple of 256.

1 collapsed line
fn main() -> Result<(), Box<dyn std::error::Error>> {
use fragmentcolor::TextureWriteOptions;
let _opt = TextureWriteOptions::whole().with_bytes_per_row(256);
2 collapsed lines
Ok(())
}

TextureWriteOptions::with_rows_per_image(rows)

Section titled “TextureWriteOptions::with_rows_per_image(rows)”

Set the number of rows per image for the upload (usually equals the height).

1 collapsed line
fn main() -> Result<(), Box<dyn std::error::Error>> {
use fragmentcolor::TextureWriteOptions;
let _opt = TextureWriteOptions::whole().with_rows_per_image(64);
2 collapsed lines
Ok(())
}