-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Glitch in drawing of sparse console with variable size #91
Comments
I don't reproduce it using the same code. Are you running it with default features? |
I've tried it with and without. The above was created and run from the |
yeah same thing. I put the code in bracket-lib/bracket-terminal/examples/test.rs and ran it with cargo run --example test. no glitch here |
I am reproducing it on a different computer as well. Both are running Windows 10 with default features but one builds with |
are you using bracket-lib from git or the latest crates.io release? I don't reproduce with the master branch from git : bracket-lib = {git="https://github.com/thebracket/bracket-lib"} |
I'm using the one from git. |
I reproduce it on another computer ! investigating... This might be dependant on the opengl version |
The problem occurs only when using DrawBatch, and the glitch appears only when current frame is different from the last one. This code not using batches works fine : fn tick(&mut self, ctx: &mut BTerm) {
ctx.cls();
self.n = (self.n + 1) % 80;
ctx.draw_box(0, 0, self.n, 1, RGB::named(WHITE), RGB::named(BLACK));
} Also when pausing the animation with the batch version so that it changes only when you press a key : if ctx.key.is_some() {
self.n = (self.n + 1) % 80;
} you can see that the rendering is ok for any value of n. But every time n changes, the next frame is broken. |
Found it ! draw_batch.target(1); should be draw_batch.target(0); You have only one console and consoles id start with 0. On the other hand, Bterm accepting an invalid console id is probably a bug |
That's not right.. I'm following directly from the bracket-lib/bracket-terminal/examples/sparse.rs example. |
Indeed. What I don't get with sparse consoles is how to handle several operation on the same console cell. For example, draw_box first fills the area with white spaces, then draws the rectangle around the box. As far as I understand, this means there are two SparseTile with the same id in the tiles array and I don't understand how this is handled in the rendering backend. |
Just thought I'd mention that I've reverted to the more stable crates.io version for development and this issue doesn't seem to be present in there. |
I ran the attached (original) code on my workstation, and it ran glitch-free on the latest HEAD/master. It ran ok in my Ubuntu VM, also. Scaling the window and messing with display scaling didn't seem to make it fail. Overdraw: Anyway, the overdraw is a feature on flexible consoles - and a bug on sparse consoles. I'll see about cleaning up the sparse console and adding index checking on the set target call. |
The glitch seems to be gone now. Great! |
The following changes the sparse console's size every tick. Is this just happening on my end or is the drawing glitchy?
Here's a screenshot of the glitch:
The text was updated successfully, but these errors were encountered: