Consider this simple test of increment stencil functionality:
use piston_window::*;
fn main() {
let mut window: PistonWindow = WindowSettings::new("test", [800; 2]).build().unwrap();
while let Some(event) = window.next() {
window.draw_2d(&event, |Context { transform, .. }, g, _| {
// Clear with black
clear([0.0, 0.0, 0.0, 1.0], g);
// Draw 2 stencil-incrementing circles
Ellipse::new([1.0; 4]).draw(
[0.0, 0.0, 400.0, 400.0],
&DrawState::new_increment(),
transform,
g,
);
Ellipse::new([1.0; 4]).draw(
[200.0, 0.0, 400.0, 400.0],
&DrawState::new_increment(),
transform,
g,
);
// Draw a rectangle that should only fill the circles' overlapping region
Rectangle::new([1.0; 4]).draw(
[0.0, 0.0, 600.0, 400.0],
&DrawState {
stencil: Some(draw_state::Stencil::Inside(2)),
..Default::default()
},
transform,
g,
);
});
}
}
I compiled this with piston_window 0.113.0, which uses gfx_graphics 0.70.0, the latest version at time of writing. I think this code should draw a white shape that is the intersection of the two circles. However, it simply draws a black screen.
Consider this simple test of increment stencil functionality:
I compiled this with
piston_window 0.113.0
, which usesgfx_graphics 0.70.0
, the latest version at time of writing. I think this code should draw a white shape that is the intersection of the two circles. However, it simply draws a black screen.Is this a bug, or am I misusing the API?