texturing works, next will be images

This commit is contained in:
2019-08-30 00:50:45 -07:00
parent a2de3557f0
commit 3f14555c99
7 changed files with 178 additions and 16 deletions

View File

@@ -91,7 +91,9 @@ fn main() {
let sprite = Sprite::new_with_color((0.,0.), (0.1,0.1), (1.,0.,0.,1.));
let sprite2 = Sprite::new_with_color((-1.,-0.5), (0.1,0.1), (0.,1.,0.,1.));
let compu_sprite1 = CompuSprite::new((-1.,-0.5), (0.1,0.1), processor.new_swap_image((300, 300)));
let compu_sprite1 = CompuSprite::new((-1.,-0.5), (0.1,0.1),
// This swap image needs to match the size of the compute
processor.new_swap_image((720, 756)));
let image_data = load_raw(String::from("funky-bird.jpg"));
let compute_buffer = processor.new_compute_buffer(image_data.0, image_data.1, 4);
@@ -99,8 +101,9 @@ fn main() {
let compute_kernel = processor.get_kernel_handle(String::from("simple-edge.compute"))
.expect("Can't find that kernel");
let handle = processor.get_texture_handle(String::from("funky-bird.jpg")).unwrap();
let sprite3 = Sprite::new_with_texture((0.3, 0.5), (0.1,0.1), handle.clone());
while let Some(p) = window.get_position() {
@@ -158,6 +161,7 @@ fn main() {
let mut canvas = CanvasFrame::new();
canvas.draw(&sprite);
canvas.draw(&sprite2);
canvas.draw(&sprite3);
canvas.draw(&compu_sprite1);
(frame_future) = processor.run(&surface, frame_future,