Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - weremsoft

Pages: [1]
1
General / Update texture in Rust
« on: December 13, 2018, 08:35:03 pm »
Anyone knows how to update the texture in rust? I have the following:


Quote
let mut image = Image::from_color(WIDTH, HEIGHT, &Color::GREEN).unwrap();
let mut texture = Texture::from_image(&image).unwrap();
let sprite = Sprite::with_texture(&texture); // -------- immutable borrow occurs here
texture.update_from_image(&image, 0, 0); // ERROR!!! --- cannot borrow `texture` as mutable because it is also borrowed as immutable


Thanks

2
General / Re: fastest way to draw pixels in screen.
« on: December 13, 2018, 01:34:13 pm »
Thanks. I'd like to avoid render shader since it's a totally different beast. BUT!, I saw this guy that uses "Quads".

https://github.com/Hopson97/CellularAutomaton/blob/master/Source/CellularAutomaton.cpp

He says that is very performant but It's hard to me to understand that code.

What do you think. Is there any advantage of using quads that way?

Maybe "pixels" is not what I need.

3
General / fastest way to draw pixels in screen.
« on: December 13, 2018, 12:39:15 pm »
I'd like to implement several celular automatas algorithms and play with pixels arround. And I wonder what's the most efficient way(the one that will give me the highest FPS count) to draw an image in the screen.

I have two approachs:

1. Use an image, to update a texture of a sprite on the screen.
2. Use an array of RectangleShape's to draw squares on the screen.

My guess is that the first one is better, since the individual pixels are not "transformables", but I don't know for sure.

Just to clarify myself. I'm looking to achieve something like this at a high framerrate without using shaders.

https://www.ssaurel.com/fireeffect/fireeffect.htm

Pages: [1]